46 #include "NCPadWidget.h" 47 #include "NCTablePad.h" 49 #include "NCPkgStrings.h" 55 #include <zypp/ui/Selectable.h> 57 #include "NCPkgStatusStrategy.h" 81 ZyppStatus stat = S_NoInst );
85 void setStatus( ZyppStatus stat ) { status = stat; }
86 ZyppStatus getStatus()
const {
return status; }
88 std::string statusToString( ZyppStatus stat )
const;
90 ZyppObj getDataPointer()
const {
return dataPointer; }
91 ZyppSel getSelPointer()
const {
return selPointer; }
104 std::vector<NCTableLine *>::iterator itemsBegin,
105 std::vector<NCTableLine *>::iterator itemsEnd,
109 if ( _header[ uiColumn ] == NCPkgStrings::PkgSize() )
111 std::sort( itemsBegin, itemsEnd, CompareSize() );
113 else if ( _header[ uiColumn ] == NCPkgStrings::PkgName() )
115 std::sort( itemsBegin, itemsEnd, CompareName( uiColumn ) );
119 std::sort( itemsBegin, itemsEnd, Compare( uiColumn ) );
124 std::vector<std::string> _header;
132 bool operator() ( NCTableLine * first,
136 YTableItem *firstItem =
dynamic_cast<YTableItem*
> (first->origItem() );
137 YTableItem *secondItem =
dynamic_cast<YTableItem*
> (second->origItem() );
141 return firstTag->getDataPointer()->installSize() <
142 secondTag->getDataPointer()->installSize();
150 CompareName(
int uiCol)
154 bool operator() ( NCTableLine * first,
158 std::wstring w1 = first->GetCol( _uiCol )->Label().getText().begin()->str();
159 std::wstring w2 = second->GetCol( _uiCol )->Label().getText().begin()->str();
166 int result = wcscasecmp( w1.data(), w2.data() );
182 bool operator() ( NCTableLine * first,
186 std::wstring w1 = first->GetCol( _uiCol )->Label().getText().begin()->str();
187 std::wstring w2 = second->GetCol( _uiCol )->Label().getText().begin()->str();
188 int result = wcscoll ( w1.data(), w2.data() );
210 enum NCPkgTableType {
222 enum NCPkgTableListAction {
231 enum NCPkgTableListType {
237 enum NCPkgTableInfoType {
256 NCPkgTableType tableType;
257 bool haveInstalledVersion;
262 NCPkgTableInfoType visibleInfo;
264 std::vector<std::string> header;
274 NCPkgTable( YWidget * parent, YTableHeader * tableHeader );
287 virtual void addLine( ZyppStatus status,
288 const std::vector<std::string> & elements,
295 void drawList( ) { myPad()->setOrder(1);
return DrawPad(); }
309 virtual void cellChanged(
int index,
int colnum,
const std::string & newtext );
344 const ZyppSel & slbPtr,
348 bool changeObjStatus(
int key );
350 bool changeListObjStatus( NCPkgTableListAction key );
352 bool toggleObjStatus( );
373 bool SourceInstall(
bool install );
388 delete statusStrategy;
389 statusStrategy = strategy;
395 NCPkgTableType getTableType() {
return tableType; }
451 void setVisibleInfo( NCPkgTableInfoType info) { visibleInfo = info; }
453 NCPkgTableInfoType VisibleInfo() {
return visibleInfo ; }
455 bool fillAvailableList ( ZyppSel slb );
456 bool fillSummaryList ( NCPkgTableListType type );
458 void updateInfo( ZyppObj pkgPtr, ZyppSel slbPtr, NCPkgTableInfoType mode );
464 #endif // NCPkgTable_h virtual NCursesEvent wHandleInput(wint_t key)
Handles the events concerning the package table (e.g.
bool showInformation()
Show the corresponding information (e.g.
bool createPatchEntry(ZyppPatch pkgPtr, ZyppSel slbPtr)
Creates a line in the YOU patch table.
virtual void cellChanged(int index, int colnum, const std::string &newtext)
Changes the contents of a certain cell in table.
virtual void addLine(ZyppStatus status, const std::vector< std::string > &elements, ZyppObj objPtr, ZyppSel slbPtr)
This method is called to add a line to the package list.
ZyppObj getDataPointer(int index)
Gets the data pointer of a certain package.
void fillHeader()
Fills the header of the table.
bool createListEntry(ZyppPkg pkgPtr, ZyppSel slbPtr)
Creates a line in the package table.
This class is used for the first column of the package table which contains the status information of...
bool createInfoEntry(std::string text)
Creates a line in the table shwing an info text.
ZyppStatus getStatus(int index)
Gets the currently displayed package status.
ZyppSel getSelPointer(int index)
Gets the selectable pointer of a certain package.
bool updateTable()
Set the status information if status has changed.
bool setTableType(NCPkgTableType type, NCPkgStatusStrategy *strategy)
Sets the type of the table and the status strategy (which means call particular methods to set/get th...
unsigned int getNumLines()
Returns the number of lines in the table (the table size)
virtual void itemsCleared()
Clears the package list.
NClabel getCellContents(int index, int colnum)
Returns the contents of a certain cell in table.
void drawList()
Draws the package list (has to be called after the loop with addLine() calls)
void setPackager(NCPackageSelector *pkg)
Sets the member variable PackageSelector *packager.
bool changeStatus(ZyppStatus newstat, const ZyppSel &slbPtr, ZyppObj objPtr, bool singleChange)
Informs the package manager about the status change of the currently selected package and updates the...