41 #ifndef YQPkgObjList_h 42 #define YQPkgObjList_h 50 #include <QY2ListView.h> 52 #include <zypp/Edition.h> 55 #include "YQZyppSolverDialogPluginStub.h" 84 using QTreeWidget::currentItemChanged;
89 QTreeWidgetItem * itemFromIndex (
const QModelIndex & index )
const 90 {
return QY2ListView::itemFromIndex(index); }
94 int iconCol()
const {
return _iconCol; }
95 int statusCol()
const {
return _statusCol; }
96 int nameCol()
const {
return _nameCol; }
97 int summaryCol()
const {
return _summaryCol; }
98 int sizeCol()
const {
return _sizeCol; }
99 int versionCol()
const {
return _versionCol; }
100 int instVersionCol()
const {
return _instVersionCol; }
101 int brokenIconCol()
const {
return _brokenIconCol; }
102 int satisfiedIconCol()
const {
return _satisfiedIconCol; }
123 bool ifNewerOnly =
false );
152 virtual QPixmap
statusIcon( ZyppStatus status,
154 bool bySelection =
false );
159 virtual QString
statusText( ZyppStatus status )
const;
202 ZyppObj zyppObj = 0 );
209 const QString & summary = QString::null,
216 QTreeWidgetItem * item,
218 const QPoint & pos );
224 virtual void clear();
253 virtual void message(
const QString & text );
362 const QString & key = QString::null,
363 bool enabled =
false );
370 const QPixmap & icon = QPixmap(),
371 const QPixmap & insensitiveIcon = QPixmap(),
372 const QString & key = QString::null,
373 bool enabled =
false );
387 int _satisfiedIconCol;
391 typedef list<ExcludeRule *> ExcludeRuleList;
393 ExcludeRuleList _excludeRules;
396 QMenu * _installedContextMenu;
397 QMenu * _notInstalledContextMenu;
402 QAction * actionSetCurrentInstall;
403 QAction * actionSetCurrentDontInstall;
404 QAction * actionSetCurrentKeepInstalled;
405 QAction * actionSetCurrentDelete;
406 QAction * actionSetCurrentUpdate;
407 QAction * actionSetCurrentUpdateForce;
408 QAction * actionSetCurrentTaboo;
409 QAction * actionSetCurrentProtected;
410 QAction * actionShowCurrentSolverInfo;
412 QAction * actionSetListInstall;
413 QAction * actionSetListDontInstall;
414 QAction * actionSetListKeepInstalled;
415 QAction * actionSetListDelete;
416 QAction * actionSetListUpdate;
417 QAction * actionSetListUpdateForce;
418 QAction * actionSetListTaboo;
419 QAction * actionSetListProtected;
438 ZyppObj zyppObj = 0 );
452 QY2ListViewItem * parent,
454 ZyppObj zyppObj = 0 );
488 virtual ZyppStatus status()
const;
494 virtual bool bySelection()
const;
503 virtual void setStatus( ZyppStatus newStatus,
bool sendSignals =
true );
509 virtual void setStatusIcon();
516 virtual void updateStatus();
521 virtual void cycleStatus();
539 bool isSatisfied()
const;
546 bool isBroken()
const;
552 void showNotifyTexts( ZyppStatus status );
563 static bool showLicenseAgreement( ZyppSel sel );
569 bool showLicenseAgreement();
574 virtual bool operator< (
const QTreeWidgetItem & other )
const;
585 int versionPoints()
const;
593 virtual void updateData();
601 virtual QString toolTip(
int column );
613 void setExcluded(
bool exclude =
true );
618 bool debugIsBroken()
const {
return _debugIsBroken; }
619 bool debugIsSatisfied()
const {
return _debugIsSatisfied; }
620 void setDebugIsBroken (
bool val =
true ) { _debugIsBroken = val; }
621 void setDebugIsSatisfied(
bool val =
true ) { _debugIsSatisfied = val; }
622 void toggleDebugIsBroken() { _debugIsBroken = ! _debugIsBroken; }
623 void toggleDebugIsSatisfied() { _debugIsSatisfied = ! _debugIsSatisfied; }
628 int statusCol()
const {
return _pkgObjList->statusCol(); }
629 int nameCol()
const {
return _pkgObjList->nameCol(); }
630 int summaryCol()
const {
return _pkgObjList->summaryCol(); }
631 int sizeCol()
const {
return _pkgObjList->sizeCol(); }
632 int versionCol()
const {
return _pkgObjList->versionCol(); }
633 int instVersionCol()
const {
return _pkgObjList->instVersionCol(); }
634 int brokenIconCol()
const {
return _pkgObjList->brokenIconCol(); }
635 int satisfiedIconCol()
const {
return _pkgObjList->satisfiedIconCol(); }
661 void solveResolvableCollections();
667 void setText(
int column,
const string text );
674 void setText(
int column,
const QString & text )
675 { QTreeWidgetItem::setText( column, text ); }
680 void setText(
int column,
const zypp::Edition & edition );
691 bool _candidateIsNewer:1;
692 bool _installedIsNewer:1;
694 bool _debugIsBroken:1;
695 bool _debugIsSatisfied:1;
714 const QRegExp & regexp,
728 void enable(
bool enable =
true );
739 void setRegexp(
const QRegExp & regexp );
744 QRegExp
regexp()
const {
return _regexp; };
749 void setColumn(
int column = 0 );
766 bool match( QTreeWidgetItem * item );
781 typedef std::map <QTreeWidgetItem *, QTreeWidgetItem *> ItemMap;
782 typedef std::pair<QTreeWidgetItem *, QTreeWidgetItem *> ItemPair;
783 typedef ItemMap::iterator iterator;
802 void add( QTreeWidgetItem * item, QTreeWidgetItem * oldParent );
808 void remove( QTreeWidgetItem * item );
818 bool contains( QTreeWidgetItem * item );
824 QTreeWidgetItem * oldParentItem( QTreeWidgetItem * item );
829 int size()
const {
return (
int) _excludeMap.size(); }
834 iterator
begin() {
return _excludeMap.begin(); }
839 iterator
end() {
return _excludeMap.end(); }
849 #endif // ifndef YQPkgObjList_h ZyppSel selectable() const
Returns the original selectable within the package manager backend.
int size() const
Returns the number of items.
ZyppObj zyppObj() const
Returns the original object within the package manager backend.
Abstract base class to display a list of zypp::ResObjects.
void statusChanged()
Emitted when the status of a zypp::ResObject is changed.
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...
void addPkgObjItem(ZyppSel selectable, ZyppObj zyppObj=0)
Add a zypp::ResObject to the list.
void setEditable(bool editable=true)
Set this item's editable status.
void addExcludeRule(YQPkgObjList::ExcludeRule *rule)
Add an exclude rule to this list.
virtual void createInstalledContextMenu()
Create the context menu for installed items.
void setAllItemStatus(ZyppStatus newStatus, bool force=false)
Sets the status of all (toplevel) list items to 'newStatus', if possible.
bool candidateIsNewer() const
Check if the candidate is newer than the installed version.
virtual QMenu * notInstalledContextMenu()
Returns the context menu for items that are installed.
iterator begin()
Returns an iterator that points to the first excluded item.
virtual void clear()
Reimplemented from QY2ListView: Emit currentItemChanged() signal after clearing the list...
virtual void message(const QString &text)
Display a one-line message in the list.
void addPassiveItem(const QString &name, const QString &summary=QString::null, FSize size=-1)
Add a purely passive list item that has a name and optional summary and size.
void createActions()
Create the actions for the context menus.
QAction * createAction(ZyppStatus status, const QString &key=QString::null, bool enabled=false)
Create an action based on a zypp::ResObject status - automatically retrieve the corresponding status ...
virtual void pkgObjClicked(int button, QTreeWidgetItem *item, int col, const QPoint &pos)
Dispatcher slot for mouse click: cycle status depending on column.
void logExcludeStatistics()
Write statistics about excluded items to the log, if there are any.
virtual void currentItemChangedInternal(QTreeWidgetItem *item)
Dispatcher slot for selection change - internal only.
virtual void updateActions(YQPkgObjListItem *item=0)
Update the internal actions for the currently selected item ( if any ).
void showSolverInfo()
Show solver information about the current selected item.
void sendStatusChanged()
Emit a statusChanged() signal for the specified zypp::ResObject.
void exclude(YQPkgObjListItem *item, bool exclude)
Exclude or include an item, i.e.
bool editable() const
Return whether or not items in this list are generally editable, i.e.
void selectNextItem()
Select the next item, i.e.
bool isExcluded() const
Returns 'true' if this item is excluded.
void updatePackages()
Emitted when it's time to update displayed package information, e.g., package states.
void setText(int column, const QString &text)
Re-declare ordinary setText() method so the compiler doesn't get confused which one to use...
void setEditable(bool editable=true)
Set the list's editable status.
iterator end()
Returns an iterator that points after the last excluded item.
virtual void applyChanges()
Apply changes hook.
QRegExp regexp() const
Returns the regexp.
void applyExcludeRules()
Apply all exclude rules of this list to all items, including those that are currently excluded...
virtual QMenu * addAllInListSubMenu(QMenu *menu)
Add a submenu "All in this list..." to 'menu'.
virtual QString statusText(ZyppStatus status) const
Returns a short (one line) descriptive text for a zypp::ResObject status.
void currentItemChanged(ZyppSel selectable)
Emitted when a zypp::ui::Selectable is selected.
void slotCustomContextMenu(const QPoint &pos)
slot that shows context menu when requested
void setCurrentStatus(ZyppStatus newStatus, bool selectNextItem=false, bool ifNewerOnly=false)
Sets the currently selected item's status.
void sendUpdatePackages()
Emit an updatePackages() signal.
YQPkgObjList * parent() const
Returns this exclude rule's parent YQPkgObjList.
virtual void createNotInstalledContextMenu()
Create the context menu for items that are not installed.
virtual QMenu * installedContextMenu()
Returns the context menu for items that are not installed.
bool installedIsNewer() const
Check if the installed version is newer than the candidate.
int column() const
Returns the column number.
virtual ~YQPkgObjList()
Destructor.
virtual void keyPressEvent(QKeyEvent *ev)
Event handler for keyboard input.
YQPkgObjList(QWidget *parent)
Constructor.
bool isEnabled() const
Returns 'true' if this exclude rule is enabled, 'false' otherwise.
bool editable() const
Return whether or not this items is editable, i.e.