47 #include "NCPadWidget.h"
48 #include "NCTablePad.h"
50 #include "NCTableItem.h"
51 #include "NCPkgStrings.h"
57 #include <zypp/ui/Selectable.h>
59 #include "NCPkgStatusStrategy.h"
82 ZyppStatus stat = S_NoInst );
86 void setStatus( ZyppStatus stat ) { status = stat; }
87 ZyppStatus getStatus()
const {
return status; }
89 std::string statusToString( ZyppStatus stat )
const;
91 ZyppObj getDataPointer()
const {
return dataPointer; }
92 ZyppSel getSelPointer()
const {
return selPointer; }
104 virtual void sort( YItemIterator itemsBegin,
105 YItemIterator itemsEnd )
override
107 if ( _header[ sortCol() ] == NCPkgStrings::PkgSize() )
109 std::sort( itemsBegin, itemsEnd, CompareSize() );
111 else if ( _header[ sortCol() ] == NCPkgStrings::PkgName() )
113 std::sort( itemsBegin, itemsEnd, CompareName( sortCol() ) );
117 std::sort( itemsBegin, itemsEnd, Compare( sortCol() ) );
121 std::reverse( itemsBegin, itemsEnd );
126 std::vector<std::string> _header;
132 static std::wstring cellContent( YItem * item,
int col )
139 YTableItem * tableItem =
dynamic_cast<YTableItem *
>( item );
144 YTableCell * tableCell = tableItem->cell( col );
149 return NCstring( tableCell->label() ).str();
159 bool operator() ( YItem * item1, YItem * item2 )
const
161 YTableItem * tableItem1 =
dynamic_cast<YTableItem *
>( item1 );
162 YTableItem * tableItem2 =
dynamic_cast<YTableItem *
>( item2 );
164 if ( ! tableItem1 )
return true;
165 if ( ! tableItem2 )
return true;
170 return tag1->getDataPointer()->installSize() <
171 tag2->getDataPointer()->installSize();
179 CompareName(
int uiCol )
183 bool operator() ( YItem * item1, YItem * item2 )
const
185 std::wstring w1 = cellContent( item1, _uiCol );
186 std::wstring w2 = cellContent( item2, _uiCol );
193 int result = wcscasecmp( w1.data(), w2.data() );
210 bool operator() ( YItem * item1, YItem * item2 )
const
212 std::wstring w1 = cellContent( item1, _uiCol );
213 std::wstring w2 = cellContent( item2, _uiCol );
215 int result = wcscoll ( w1.data(), w2.data() );
250 enum NCPkgTableListAction
260 enum NCPkgTableListType
267 enum NCPkgTableInfoType
287 NCPkgTableType tableType;
288 bool haveInstalledVersion;
293 NCPkgTableInfoType visibleInfo;
295 std::vector<std::string> header;
303 NCPkgTable( YWidget * parent, YTableHeader * tableHeader );
316 virtual void addLine( ZyppStatus status,
317 const std::vector<std::string> & elements,
324 void drawList() { sortItems( 1 );
return DrawPad(); }
364 const ZyppSel & slbPtr,
368 bool changeObjStatus(
int key );
370 bool changeListObjStatus( NCPkgTableListAction key );
372 bool cycleObjStatus();
393 bool SourceInstall(
bool install );
409 delete statusStrategy;
410 statusStrategy = strategy;
416 NCPkgTableType getTableType() {
return tableType; }
478 void setVisibleInfo( NCPkgTableInfoType info) { visibleInfo = info; }
480 NCPkgTableInfoType VisibleInfo() {
return visibleInfo; }
482 bool fillAvailableList ( ZyppSel slb );
483 bool fillSummaryList ( NCPkgTableListType type );
485 void updateInfo( ZyppObj pkgPtr, ZyppSel slbPtr, NCPkgTableInfoType mode );
491 #endif // NCPkgTable_h