50 #include <zypp/ui/Selectable.h> 52 #include <yui/ncurses/NCPadWidget.h> 53 #include <yui/ncurses/NCTablePad.h> 54 #include <yui/ncurses/NCTable.h> 55 #include <yui/ncurses/NCTableItem.h> 57 #include "NCPkgStrings.h" 58 #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; }
103 virtual void sort( YItemIterator itemsBegin,
104 YItemIterator itemsEnd )
override 106 if ( _header[ sortCol() ] == NCPkgStrings::PkgSize() )
108 std::sort( itemsBegin, itemsEnd, CompareSize() );
110 else if ( _header[ sortCol() ] == NCPkgStrings::PkgName() )
112 std::sort( itemsBegin, itemsEnd, CompareName( sortCol() ) );
116 std::sort( itemsBegin, itemsEnd, Compare( sortCol() ) );
120 std::reverse( itemsBegin, itemsEnd );
125 std::vector<std::string> _header;
131 static std::wstring cellContent( YItem * item,
int col )
138 YTableItem * tableItem =
dynamic_cast<YTableItem *
>( item );
143 YTableCell * tableCell = tableItem->cell( col );
148 return NCstring( tableCell->label() ).str();
158 bool operator() ( YItem * item1, YItem * item2 )
const 160 YTableItem * tableItem1 =
dynamic_cast<YTableItem *
>( item1 );
161 YTableItem * tableItem2 =
dynamic_cast<YTableItem *
>( item2 );
163 if ( ! tableItem1 )
return true;
164 if ( ! tableItem2 )
return true;
169 return tag1->getDataPointer()->installSize() <
170 tag2->getDataPointer()->installSize();
178 CompareName(
int uiCol )
182 bool operator() ( YItem * item1, YItem * item2 )
const 184 std::wstring w1 = cellContent( item1, _uiCol );
185 std::wstring w2 = cellContent( item2, _uiCol );
192 int result = wcscasecmp( w1.data(), w2.data() );
209 bool operator() ( YItem * item1, YItem * item2 )
const 211 std::wstring w1 = cellContent( item1, _uiCol );
212 std::wstring w2 = cellContent( item2, _uiCol );
214 int result = wcscoll ( w1.data(), w2.data() );
249 enum NCPkgTableListAction
259 enum NCPkgTableListType
266 enum NCPkgTableInfoType
286 NCPkgTableType tableType;
287 bool haveInstalledVersion;
292 NCPkgTableInfoType visibleInfo;
294 std::vector<std::string> header;
302 NCPkgTable( YWidget * parent, YTableHeader * tableHeader );
315 virtual void addLine( ZyppStatus status,
316 const std::vector<std::string> & elements,
323 void drawList() { sortItems( 1 );
return DrawPad(); }
363 const ZyppSel & slbPtr,
367 bool changeObjStatus(
int key );
369 bool changeListObjStatus( NCPkgTableListAction key );
371 bool cycleObjStatus();
392 bool SourceInstall(
bool install );
408 delete statusStrategy;
409 statusStrategy = strategy;
415 NCPkgTableType getTableType() {
return tableType; }
477 void setVisibleInfo( NCPkgTableInfoType info) { visibleInfo = info; }
479 NCPkgTableInfoType VisibleInfo() {
return visibleInfo; }
481 bool fillAvailableList ( ZyppSel slb );
482 bool fillSummaryList ( NCPkgTableListType type );
484 void updateInfo( ZyppObj pkgPtr, ZyppSel slbPtr, NCPkgTableInfoType mode );
490 #endif // NCPkgTable_h virtual NCursesEvent wHandleInput(wint_t key)
Definition: NCPkgTable.cc:766
bool showInformation()
Definition: NCPkgTable.cc:728
bool createPatchEntry(ZyppPatch pkgPtr, ZyppSel slbPtr)
Definition: NCPkgTable.cc:693
Definition: NCPkgTable.h:232
virtual void addLine(ZyppStatus status, const std::vector< std::string > &elements, ZyppObj objPtr, ZyppSel slbPtr)
Definition: NCPkgTable.cc:144
ZyppObj getDataPointer(int index)
Definition: NCPkgTable.cc:835
void fillHeader()
Definition: NCPkgTable.cc:406
Definition: NCPkgStatusStrategy.h:52
bool createListEntry(ZyppPkg pkgPtr, ZyppSel slbPtr)
Definition: NCPkgTable.cc:513
Definition: NCPkgTable.h:68
bool createInfoEntry(std::string text)
Definition: NCPkgTable.cc:678
ZyppStatus getStatus(int index)
Definition: NCPkgTable.cc:825
ZyppSel getSelPointer(int index)
Definition: NCPkgTable.cc:845
bool updateTable()
Definition: NCPkgTable.cc:333
bool setTableType(NCPkgTableType type, NCPkgStatusStrategy *strategy)
Definition: NCPkgTable.h:403
unsigned int getNumLines()
Definition: NCPkgTable.h:435
Definition: NCPkgTable.h:95
Definition: NCPackageSelector.h:109
virtual void itemsCleared()
Definition: NCPkgTable.cc:162
bool confirmRetracted(ZyppObj pkg, ZyppSel sel)
Definition: NCPkgTable.cc:1195
NClabel getCellContents(int index, int colnum)
void drawList()
Definition: NCPkgTable.h:323
void setPackager(NCPackageSelector *pkg)
Definition: NCPkgTable.h:351
bool changeStatus(ZyppStatus newstat, const ZyppSel &slbPtr, ZyppObj objPtr, bool singleChange)
Definition: NCPkgTable.cc:171