32#include <zypp/ui/Selectable.h>
34#include <yui/ncurses/NCPadWidget.h>
35#include <yui/ncurses/NCTablePad.h>
36#include <yui/ncurses/NCTable.h>
37#include <yui/ncurses/NCTableItem.h>
39#include "NCPkgStrings.h"
40#include "NCPkgStatusStrategy.h"
63 ZyppStatus stat = S_NoInst );
67 void setStatus( ZyppStatus stat ) { status = stat; }
68 ZyppStatus getStatus()
const {
return status; }
70 std::string statusToString( ZyppStatus stat )
const;
72 ZyppObj getDataPointer()
const {
return dataPointer; }
73 ZyppSel getSelPointer()
const {
return selPointer; }
85 virtual void sort( YItemIterator itemsBegin,
86 YItemIterator itemsEnd )
override
88 if ( _header[ sortCol() ] == NCPkgStrings::PkgSize() )
90 std::sort( itemsBegin, itemsEnd, CompareSize() );
92 else if ( _header[ sortCol() ] == NCPkgStrings::PkgName() )
94 std::sort( itemsBegin, itemsEnd, CompareName( sortCol() ) );
98 std::sort( itemsBegin, itemsEnd, Compare( sortCol() ) );
102 std::reverse( itemsBegin, itemsEnd );
107 std::vector<std::string> _header;
113 static std::wstring cellContent( YItem * item,
int col )
120 YTableItem * tableItem =
dynamic_cast<YTableItem *
>( item );
125 YTableCell * tableCell = tableItem->cell( col );
130 return NCstring( tableCell->label() ).str();
140 bool operator() ( YItem * item1, YItem * item2 )
const
142 YTableItem * tableItem1 =
dynamic_cast<YTableItem *
>( item1 );
143 YTableItem * tableItem2 =
dynamic_cast<YTableItem *
>( item2 );
145 if ( ! tableItem1 )
return true;
146 if ( ! tableItem2 )
return true;
151 return tag1->getDataPointer()->installSize() <
152 tag2->getDataPointer()->installSize();
160 CompareName(
int uiCol )
164 bool operator() ( YItem * item1, YItem * item2 )
const
166 std::wstring w1 = cellContent( item1, _uiCol );
167 std::wstring w2 = cellContent( item2, _uiCol );
174 int result = wcscasecmp( w1.data(), w2.data() );
191 bool operator() ( YItem * item1, YItem * item2 )
const
193 std::wstring w1 = cellContent( item1, _uiCol );
194 std::wstring w2 = cellContent( item2, _uiCol );
196 int result = wcscoll ( w1.data(), w2.data() );
231 enum NCPkgTableListAction
241 enum NCPkgTableListType
248 enum NCPkgTableInfoType
268 NCPkgTableType tableType;
269 bool haveInstalledVersion;
274 NCPkgTableInfoType visibleInfo;
276 std::vector<std::string> header;
284 NCPkgTable( YWidget * parent, YTableHeader * tableHeader );
297 virtual void addLine( ZyppStatus status,
298 const std::vector<std::string> & elements,
305 void drawList() { sortItems( 1 );
return DrawPad(); }
345 const ZyppSel & slbPtr,
349 bool changeObjStatus(
int key );
351 bool changeListObjStatus( NCPkgTableListAction key );
353 bool cycleObjStatus();
374 bool SourceInstall(
bool install );
390 delete statusStrategy;
391 statusStrategy = strategy;
397 NCPkgTableType getTableType() {
return tableType; }
459 void setVisibleInfo( NCPkgTableInfoType info) { visibleInfo = info; }
461 NCPkgTableInfoType VisibleInfo() {
return visibleInfo; }
463 bool fillAvailableList ( ZyppSel slb );
464 bool fillSummaryList ( NCPkgTableListType type );
466 void updateInfo( ZyppObj pkgPtr, ZyppSel slbPtr, NCPkgTableInfoType mode );
Definition NCPackageSelector.h:105
Definition NCPkgStatusStrategy.h:35
Definition NCPkgTable.h:78
Definition NCPkgTable.h:51
Definition NCPkgTable.h:215
bool showInformation()
Definition NCPkgTable.cc:710
void drawList()
Definition NCPkgTable.h:305
ZyppStatus getStatus(int index)
Definition NCPkgTable.cc:807
ZyppObj getDataPointer(int index)
Definition NCPkgTable.cc:817
unsigned int getNumLines()
Definition NCPkgTable.h:417
bool confirmRetracted(ZyppObj pkg, ZyppSel sel)
Definition NCPkgTable.cc:1177
void setPackager(NCPackageSelector *pkg)
Definition NCPkgTable.h:333
bool createInfoEntry(std::string text)
Definition NCPkgTable.cc:660
bool setTableType(NCPkgTableType type, NCPkgStatusStrategy *strategy)
Definition NCPkgTable.h:385
bool changeStatus(ZyppStatus newstat, const ZyppSel &slbPtr, ZyppObj objPtr, bool singleChange)
Definition NCPkgTable.cc:153
bool createPatchEntry(ZyppPatch pkgPtr, ZyppSel slbPtr)
Definition NCPkgTable.cc:675
virtual void addLine(ZyppStatus status, const std::vector< std::string > &elements, ZyppObj objPtr, ZyppSel slbPtr)
Definition NCPkgTable.cc:126
virtual NCursesEvent wHandleInput(wint_t key)
Definition NCPkgTable.cc:748
NClabel getCellContents(int index, int colnum)
bool createListEntry(ZyppPkg pkgPtr, ZyppSel slbPtr)
Definition NCPkgTable.cc:495
virtual void itemsCleared()
Definition NCPkgTable.cc:144
ZyppSel getSelPointer(int index)
Definition NCPkgTable.cc:827
bool updateTable()
Definition NCPkgTable.cc:315
void fillHeader()
Definition NCPkgTable.cc:388