41 #ifndef YQPkgObjList_h
42 #define YQPkgObjList_h
50 #include <QY2ListView.h>
52 #include <zypp/Edition.h>
82 using QTreeWidget::currentItemChanged;
87 QTreeWidgetItem * itemFromIndex (
const QModelIndex & index )
const
88 {
return QY2ListView::itemFromIndex(index); }
92 int iconCol()
const {
return _iconCol; }
93 int statusCol()
const {
return _statusCol; }
94 int nameCol()
const {
return _nameCol; }
95 int summaryCol()
const {
return _summaryCol; }
96 int sizeCol()
const {
return _sizeCol; }
97 int versionCol()
const {
return _versionCol; }
98 int instVersionCol()
const {
return _instVersionCol; }
99 int brokenIconCol()
const {
return _brokenIconCol; }
100 int satisfiedIconCol()
const {
return _satisfiedIconCol; }
108 bool editable()
const {
return _editable; }
121 bool ifNewerOnly =
false );
145 virtual QPixmap
statusIcon( ZyppStatus status,
147 bool bySelection =
false );
152 virtual QString
statusText( ZyppStatus status )
const;
195 ZyppObj zyppObj = 0 );
202 const QString & summary = QString(),
209 QTreeWidgetItem * item,
211 const QPoint & pos );
217 virtual void clear();
246 virtual void message(
const QString & text );
353 const QString & key = QString(),
354 bool enabled =
false );
361 const QPixmap & icon = QPixmap(),
362 const QPixmap & insensitiveIcon = QPixmap(),
363 const QString & key = QString(),
364 bool enabled =
false );
376 int _satisfiedIconCol;
379 int _excludedItemsCount;
381 typedef list<ExcludeRule *> ExcludeRuleList;
383 ExcludeRuleList _excludeRules;
385 QMenu * _installedContextMenu;
386 QMenu * _notInstalledContextMenu;
391 QAction * actionSetCurrentInstall;
392 QAction * actionSetCurrentDontInstall;
393 QAction * actionSetCurrentKeepInstalled;
394 QAction * actionSetCurrentDelete;
395 QAction * actionSetCurrentUpdate;
396 QAction * actionSetCurrentUpdateForce;
397 QAction * actionSetCurrentTaboo;
398 QAction * actionSetCurrentProtected;
400 QAction * actionSetListInstall;
401 QAction * actionSetListDontInstall;
402 QAction * actionSetListKeepInstalled;
403 QAction * actionSetListDelete;
404 QAction * actionSetListUpdate;
405 QAction * actionSetListUpdateForce;
406 QAction * actionSetListTaboo;
407 QAction * actionSetListProtected;
438 QY2ListViewItem * parent,
452 ZyppSel
selectable()
const {
return _selectable; }
457 ZyppObj
zyppObj()
const {
return _zyppObj; }
464 bool editable()
const {
return _editable; }
474 virtual ZyppStatus
status()
const;
489 virtual void setStatus( ZyppStatus newStatus,
bool sendSignals =
true );
560 virtual bool operator< (
const QTreeWidgetItem & other )
const;
587 virtual QString
toolTip(
int column );
604 bool debugIsBroken()
const {
return _debugIsBroken; }
605 bool debugIsSatisfied()
const {
return _debugIsSatisfied; }
606 void setDebugIsBroken (
bool val =
true ) { _debugIsBroken = val; }
607 void setDebugIsSatisfied(
bool val =
true ) { _debugIsSatisfied = val; }
608 void toggleDebugIsBroken() { _debugIsBroken = ! _debugIsBroken; }
609 void toggleDebugIsSatisfied() { _debugIsSatisfied = ! _debugIsSatisfied; }
614 int statusCol()
const {
return _pkgObjList->statusCol(); }
615 int nameCol()
const {
return _pkgObjList->nameCol(); }
616 int summaryCol()
const {
return _pkgObjList->summaryCol(); }
617 int sizeCol()
const {
return _pkgObjList->sizeCol(); }
618 int versionCol()
const {
return _pkgObjList->versionCol(); }
619 int instVersionCol()
const {
return _pkgObjList->instVersionCol(); }
620 int brokenIconCol()
const {
return _pkgObjList->brokenIconCol(); }
621 int satisfiedIconCol()
const {
return _pkgObjList->satisfiedIconCol(); }
653 void setText(
int column,
const string text );
660 void setText(
int column,
const QString & text )
661 { QTreeWidgetItem::setText( column, text ); }
666 void setText(
int column,
const zypp::Edition & edition );
677 bool _candidateIsNewer:1;
678 bool _installedIsNewer:1;
680 bool _debugIsBroken:1;
681 bool _debugIsSatisfied:1;
720 bool isEnabled()
const {
return _enabled; }
730 QRegExp
regexp()
const {
return _regexp; };
740 int column()
const {
return _column; }
752 bool match( QTreeWidgetItem * item );
763 #endif // ifndef YQPkgObjList_h
bool isSatisfied() const
Check if this item is satisfied, even though it is not installed.
bool isBroken() const
Check if this item is "broken": If it is installed, but any of its dependencies are no longer satisfi...
YQPkgObjList(QWidget *parent)
Constructor.
bool editable() const
Return whether or not items in this list are generally editable, i.e.
void enable(bool enable=true)
Enable or disable this exclude rule.
virtual QString statusText(ZyppStatus status) const
Returns a short (one line) descriptive text for a zypp::ResObject status.
void applyExcludeRules()
Apply all exclude rules of this list to all items, including those that are currently excluded.
int versionPoints() const
Calculate a numerical value to compare versions, based on version relations:
virtual ~YQPkgObjListItem()
Destructor.
virtual void setStatusIcon()
Set a status icon according to the package's status.
virtual ZyppStatus status() const
Returns the (binary RPM) package status.
virtual void cycleStatus()
Cycle the package status to the next valid value.
virtual bool bySelection() const
Returns 'true' if this selectable's status is set by a selection (rather than by the user or by the d...
QAction * createAction(ZyppStatus status, const QString &key=QString(), bool enabled=false)
Create an action based on a zypp::ResObject status - automatically retrieve the corresponding status ...
virtual void updateStatus()
Update this item's status.
virtual QMenu * addAllInListSubMenu(QMenu *menu)
Add a submenu "All in this list..." to 'menu'.
void solveResolvableCollections()
Do a "small" solver run for all "resolvable collections", i.e., for selections, patterns,...
void exclude(YQPkgObjListItem *item, bool exclude)
Exclude or include an item, i.e.
YQPkgObjList * parent() const
Returns this exclude rule's parent YQPkgObjList.
void sendUpdatePackages()
Emit an updatePackages() signal.
void setEditable(bool editable=true)
Set the list's editable status.
void addPkgObjItem(ZyppSel selectable, ZyppObj zyppObj=0)
Add a zypp::ResObject to the list.
virtual bool operator<(const QTreeWidgetItem &other) const
sorting function
virtual void keyPressEvent(QKeyEvent *ev)
Event handler for keyboard input.
void setCurrentStatus(ZyppStatus newStatus, bool selectNextItem=false, bool ifNewerOnly=false)
Sets the currently selected item's status.
virtual QPixmap statusIcon(ZyppStatus status, bool enabled=true, bool bySelection=false)
Returns the suitable icon for a zypp::ResObject status - the regular icon if 'enabled' is 'true' or t...
virtual ~YQPkgObjList()
Destructor.
int column() const
Returns the column number.
ZyppSel selectable() const
Returns the original selectable within the package manager backend.
virtual void applyChanges()
Apply changes hook.
QRegExp regexp() const
Returns the regexp.
virtual QMenu * notInstalledContextMenu()
Returns the context menu for items that are installed.
void setAllItemStatus(ZyppStatus newStatus, bool force=false)
Sets the status of all (toplevel) list items to 'newStatus', if possible.
void setEditable(bool editable=true)
Set this item's editable status.
void setRegexp(const QRegExp ®exp)
Change the regular expression after creation.
void showNotifyTexts(ZyppStatus status)
Display this item's notify text (if there is any) that corresponds to the specified status (S_Install...
virtual void setStatus(ZyppStatus newStatus, bool sendSignals=true)
Set the (binary RPM) package status.
virtual void message(const QString &text)
Display a one-line message in the list.
void setText(int column, const string text)
Set a column text via STL string.
void slotCustomContextMenu(const QPoint &pos)
slot that shows context menu when requested
virtual void updateData()
Update this item's data completely.
void statusChanged()
Emitted when the status of a zypp::ResObject is changed.
bool match(QTreeWidgetItem *item)
Check a list item against this exclude rule.
bool editable() const
Return whether or not this items is editable, i.e.
bool installedIsNewer() const
Check if the installed version is newer than the candidate.
ExcludeRule(YQPkgObjList *parent, const QRegExp ®exp, int column=0)
Constructor: Creates a new exclude rule with a regular expression to check against the text of the sp...
YQPkgObjListItem(YQPkgObjList *pkgObjList, ZyppSel selectable, ZyppObj zyppObj=0)
Constructor for root items: Creates a YQPkgObjList item that corresponds to the ZYPP selectable that ...
virtual QMenu * installedContextMenu()
Returns the context menu for items that are not installed.
virtual void updateActions(YQPkgObjListItem *item=0)
Update the internal actions for the currently selected item ( if any ).
bool isEnabled() const
Returns 'true' if this exclude rule is enabled, 'false' otherwise.
virtual void createNotInstalledContextMenu()
Create the context menu for items that are not installed.
void addPassiveItem(const QString &name, const QString &summary=QString(), FSize size=-1)
Add a purely passive list item that has a name and optional summary and size.
virtual QString toolTip(int column)
Returns a tool tip text for a specific column of this item.
bool candidateIsNewer() const
Check if the candidate is newer than the installed version.
virtual void createInstalledContextMenu()
Create the context menu for installed items.
void setColumn(int column=0)
Change the column number to check against after creation.
void init()
Initialize internal data and set fields accordingly.
void addExcludeRule(YQPkgObjList::ExcludeRule *rule)
Add an exclude rule to this list.
virtual void clear()
Reimplemented from QY2ListView: Emit currentItemChanged() signal after clearing the list.
ZyppObj zyppObj() const
Returns the original object within the package manager backend.
bool showLicenseAgreement()
Display this item's license agreement (if there is any) that corresponds to its current status (S_Ins...
void setExcluded(bool exclude=true)
Set this item's exclude flag.
virtual void pkgObjClicked(int button, QTreeWidgetItem *item, int col, const QPoint &pos)
Dispatcher slot for mouse click: cycle status depending on column.
void selectNextItem()
Select the next item, i.e.
void logExcludeStatistics()
Write statistics about excluded items to the log, if there are any.
bool isExcluded() const
Returns 'true' if this item is excluded.
void currentItemChanged(ZyppSel selectable)
Emitted when a zypp::ui::Selectable is selected.
virtual void currentItemChangedInternal(QTreeWidgetItem *item)
Dispatcher slot for selection change - internal only.
void createActions()
Create the actions for the context menus.
void sendStatusChanged()
Emit a statusChanged() signal for the specified zypp::ResObject.
Abstract base class to display a list of zypp::ResObjects.
void updatePackages()
Emitted when it's time to update displayed package information, e.g., package states.