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(); }
300 virtual void itemsCleared();
309 virtual void cellChanged(
int index,
int colnum,
const std::string & newtext );
317 NClabel getCellContents(
int index,
int colnum );
325 virtual NCursesEvent wHandleInput( wint_t key );
343 bool changeStatus( ZyppStatus newstat,
344 const ZyppSel & slbPtr,
348 bool changeObjStatus(
int key );
350 bool changeListObjStatus( NCPkgTableListAction key );
352 bool toggleObjStatus( );
365 ZyppStatus getStatus(
int index );
373 bool SourceInstall(
bool install );
388 delete statusStrategy;
389 statusStrategy = strategy;
395 NCPkgTableType getTableType() {
return tableType; }
402 ZyppObj getDataPointer(
int index );
409 ZyppSel getSelPointer(
int index );
429 bool createListEntry ( ZyppPkg pkgPtr, ZyppSel slbPtr );
436 bool createPatchEntry ( ZyppPatch pkgPtr, ZyppSel slbPtr );
443 bool createInfoEntry ( std::string text );
449 bool showInformation ( );
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
This class is used for the first column of the package table which contains the status information of...
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)
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.