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() );
115 std::sort( itemsBegin, itemsEnd, Compare( uiColumn ) );
120 std::vector<std::string> _header;
128 bool operator() ( NCTableLine * first,
132 YTableItem *firstItem =
dynamic_cast<YTableItem*
> (first->origItem() );
133 YTableItem *secondItem =
dynamic_cast<YTableItem*
> (second->origItem() );
137 return firstTag->getDataPointer()->installSize() <
138 secondTag->getDataPointer()->installSize();
150 bool operator() ( NCTableLine * first,
154 std::wstring w1 = first->GetCol( _uiCol )->Label().getText().begin()->str();
155 std::wstring w2 = second->GetCol( _uiCol )->Label().getText().begin()->str();
156 int result = wcscoll ( w1.data(), w2.data() );
178 enum NCPkgTableType {
190 enum NCPkgTableListAction {
199 enum NCPkgTableListType {
205 enum NCPkgTableInfoType {
224 NCPkgTableType tableType;
225 bool haveInstalledVersion;
230 NCPkgTableInfoType visibleInfo;
232 std::vector<std::string> header;
242 NCPkgTable( YWidget * parent, YTableHeader * tableHeader );
255 virtual void addLine( ZyppStatus status,
256 const std::vector<std::string> & elements,
263 void drawList( ) { myPad()->setOrder(1);
return DrawPad(); }
268 virtual void itemsCleared();
277 virtual void cellChanged(
int index,
int colnum,
const std::string & newtext );
285 NClabel getCellContents(
int index,
int colnum );
293 virtual NCursesEvent wHandleInput( wint_t key );
311 bool changeStatus( ZyppStatus newstat,
312 const ZyppSel & slbPtr,
316 bool changeObjStatus(
int key );
318 bool changeListObjStatus( NCPkgTableListAction key );
320 bool toggleObjStatus( );
333 ZyppStatus getStatus(
int index );
341 bool SourceInstall(
bool install );
356 delete statusStrategy;
357 statusStrategy = strategy;
363 NCPkgTableType getTableType() {
return tableType; }
370 ZyppObj getDataPointer(
int index );
377 ZyppSel getSelPointer(
int index );
397 bool createListEntry ( ZyppPkg pkgPtr, ZyppSel slbPtr );
404 bool createPatchEntry ( ZyppPatch pkgPtr, ZyppSel slbPtr );
411 bool createInfoEntry ( std::string text );
417 bool showInformation ( );
419 void setVisibleInfo( NCPkgTableInfoType info) { visibleInfo = info; }
421 NCPkgTableInfoType VisibleInfo() {
return visibleInfo ; }
423 bool fillAvailableList ( ZyppSel slb );
424 bool fillSummaryList ( NCPkgTableListType type );
426 void updateInfo( ZyppObj pkgPtr, ZyppSel slbPtr, NCPkgTableInfoType mode );
432 #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.