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; }
103 virtual void sort ( std::vector<NCTableLine *>::iterator itemsBegin,
104 std::vector<NCTableLine *>::iterator itemsEnd )
override 106 if ( _header[ getColumn() ] == NCPkgStrings::PkgSize() )
108 std::sort( itemsBegin, itemsEnd, CompareSize() );
110 else if ( _header[ getColumn() ] == NCPkgStrings::PkgName() )
112 std::sort( itemsBegin, itemsEnd, CompareName( getColumn() ) );
116 std::sort( itemsBegin, itemsEnd, Compare( getColumn() ) );
120 std::reverse( itemsBegin, itemsEnd );
124 std::vector<std::string> _header;
133 bool operator() (
const NCTableLine * first,
134 const NCTableLine * second )
const 136 const YTableItem *firstItem =
dynamic_cast<const YTableItem*
> (first->origItem() );
137 const YTableItem *secondItem =
dynamic_cast<const YTableItem*
> (second->origItem() );
141 return firstTag->getDataPointer()->installSize() <
142 secondTag->getDataPointer()->installSize();
150 CompareName(
int uiCol)
154 bool operator() (
const NCTableLine * first,
155 const NCTableLine * second )
const 157 std::wstring w1 = first->GetCol( _uiCol )->Label().getText().begin()->str();
158 std::wstring w2 = second->GetCol( _uiCol )->Label().getText().begin()->str();
165 int result = wcscasecmp( w1.data(), w2.data() );
182 bool operator() (
const NCTableLine * first,
183 const NCTableLine * second )
const 185 std::wstring w1 = first->GetCol( _uiCol )->Label().getText().begin()->str();
186 std::wstring w2 = second->GetCol( _uiCol )->Label().getText().begin()->str();
188 int result = wcscoll ( w1.data(), w2.data() );
222 enum NCPkgTableListAction
232 enum NCPkgTableListType
239 enum NCPkgTableInfoType
259 NCPkgTableType tableType;
260 bool haveInstalledVersion;
265 NCPkgTableInfoType visibleInfo;
267 std::vector<std::string> header;
275 NCPkgTable( YWidget * parent, YTableHeader * tableHeader );
288 virtual void addLine( ZyppStatus status,
289 const std::vector<std::string> & elements,
296 void drawList() { myPad()->setOrder(1);
return DrawPad(); }
310 virtual void cellChanged(
int index,
int colnum,
const std::string & newtext );
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 );
472 #endif // NCPkgTable_h virtual NCursesEvent wHandleInput(wint_t key)
Handles the events concerning the package table (e.g.
bool showInformation()
Show the corresponding information (e.g.
bool createPatchEntry(ZyppPatch pkgPtr, ZyppSel slbPtr)
Creates a line in the YOU patch table.
virtual void cellChanged(int index, int colnum, const std::string &newtext)
Changes the contents of a certain cell in table.
virtual void addLine(ZyppStatus status, const std::vector< std::string > &elements, ZyppObj objPtr, ZyppSel slbPtr)
This method is called to add a line to the package list.
ZyppObj getDataPointer(int index)
Gets the data pointer of a certain package.
void fillHeader()
Fills the header of the table.
bool createListEntry(ZyppPkg pkgPtr, ZyppSel slbPtr)
Creates a line in the package table.
This class is used for the first column of the package table which contains the status information of...
bool createInfoEntry(std::string text)
Creates a line in the table shwing an info text.
ZyppStatus getStatus(int index)
Gets the currently displayed package status.
ZyppSel getSelPointer(int index)
Gets the selectable pointer of a certain package.
bool updateTable()
Set the status information if status has changed.
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)
virtual void itemsCleared()
Clears the package list.
bool confirmRetracted(ZyppObj pkg, ZyppSel sel)
Ask the user for confirmation of installing a retracted package.
NClabel getCellContents(int index, int colnum)
Returns the contents of a certain cell in table.
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.
bool changeStatus(ZyppStatus newstat, const ZyppSel &slbPtr, ZyppObj objPtr, bool singleChange)
Informs the package manager about the status change of the currently selected package and updates the...