libyui-qt-pkg  2.47.5
YQPkgObjList.h
1 /**************************************************************************
2 Copyright (C) 2000 - 2010 Novell, Inc.
3 All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19 **************************************************************************/
20 
21 
22 /*---------------------------------------------------------------------\
23 | |
24 | __ __ ____ _____ ____ |
25 | \ \ / /_ _/ ___|_ _|___ \ |
26 | \ V / _` \___ \ | | __) | |
27 | | | (_| |___) || | / __/ |
28 | |_|\__,_|____/ |_| |_____| |
29 | |
30 | core system |
31 | (C) SuSE GmbH |
32 \----------------------------------------------------------------------/
33 
34  File: YQPkgObjList.h
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgObjList_h
42 #define YQPkgObjList_h
43 
44 #include <QPixmap>
45 #include <QRegExp>
46 #include <QMenu>
47 #include <QEvent>
48 #include <map>
49 #include <list>
50 #include <QY2ListView.h>
51 #include "YQZypp.h"
52 #include <zypp/Edition.h>
53 #include <FSize.h>
54 
55 class YQPkgObjListItem;
56 class QAction;
57 class QMenu;
58 using std::string;
59 using std::list;
60 
61 
62 /**
63  * @short Abstract base class to display a list of zypp::ResObjects.
64  * Handles most generic stuff like setting status etc.
65  **/
66 class YQPkgObjList : public QY2ListView
67 {
68  Q_OBJECT
69 
70 protected:
71  /**
72  * Constructor. Does not add any QListView columns!
73  **/
74  YQPkgObjList( QWidget * parent );
75 
76  /**
77  * Destructor
78  **/
79  virtual ~YQPkgObjList();
80 
81  // avoiding warning about virtuals
82  using QTreeWidget::currentItemChanged;
83 
84 public:
85 
86  // make it public
87  QTreeWidgetItem * itemFromIndex ( const QModelIndex & index ) const
88  { return QY2ListView::itemFromIndex(index); }
89 
90  // Column numbers
91 
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; }
101 
102  /**
103  * Return whether or not items in this list are generally editable,
104  * i.e. the user can change their status. Note that individual items can be
105  * set to non-editable even if the list is generally editable.
106  * Lists are editable by default.
107  **/
108  bool editable() const { return _editable; }
109 
110  /**
111  * Set the list's editable status.
112  **/
113  void setEditable( bool editable = true ) { _editable = editable; }
114 
115  /**
116  * Sets the currently selected item's status.
117  * Automatically selects the next item if 'selectNextItem' is 'true'.
118  **/
119  void setCurrentStatus( ZyppStatus newStatus,
120  bool selectNextItem = false,
121  bool ifNewerOnly = false );
122 
123 
124  /**
125  * Sets the status of all (toplevel) list items to 'newStatus', if possible.
126  * Only one single statusChanged() signal is emitted.
127  *
128  * 'force' overrides sensible defaults like setting only zypp::ResObjects to
129  * 'update' that really come with a newer version.
130  **/
131  void setAllItemStatus( ZyppStatus newStatus, bool force = false );
132 
133  /**
134  * Add a submenu "All in this list..." to 'menu'.
135  * Returns the newly created submenu.
136  **/
137  virtual QMenu * addAllInListSubMenu( QMenu * menu );
138 
139  /**
140  * Returns the suitable icon for a zypp::ResObject status - the regular
141  * icon if 'enabled' is 'true' or the insensitive icon if 'enabled' is
142  * 'false. 'bySelection' is relevant only for auto-states: This uses the
143  * icon for 'auto-by-selection" rather than the default auto-icon.
144  **/
145  virtual QPixmap statusIcon( ZyppStatus status,
146  bool enabled = true,
147  bool bySelection = false );
148 
149  /**
150  * Returns a short (one line) descriptive text for a zypp::ResObject status.
151  **/
152  virtual QString statusText( ZyppStatus status ) const;
153 
154 
155  class ExcludeRule;
156 
157  /**
158  * Add an exclude rule to this list.
159  **/
161 
162  /**
163  * Apply all exclude rules of this list to all items,
164  * including those that are currently excluded.
165  **/
166  void applyExcludeRules();
167 
168  /**
169  * Apply all exclude rules of this list to one item.
170  **/
171  void applyExcludeRules( QTreeWidgetItem * );
172 
173  /**
174  * Exclude or include an item, i.e. remove it from the visible items
175  * and add it to the internal exclude list or vice versa.
176  **/
177  void exclude( YQPkgObjListItem * item, bool exclude );
178 
179 
180 public slots:
181 
182  /**
183  * Add a zypp::ResObject to the list. Connect a filter's filterMatch()
184  * signal to this slot. Remember to connect filterStart() to clear()
185  * (inherited from QListView).
186  *
187  * 'zyppObj' has to be one of the objects of 'selectable'. If it is 0,
188  * selectable->theObject() will be used.
189  *
190  * Intentionally NOT named addItem() so the calling class cannot confuse
191  * this method with overlaid methods of the same name that were simply
192  * forgotten to implement!
193  **/
194  void addPkgObjItem( ZyppSel selectable,
195  ZyppObj zyppObj = 0 );
196 
197  /**
198  * Add a purely passive list item that has a name and optional summary and
199  * size.
200  **/
201  void addPassiveItem( const QString & name,
202  const QString & summary = QString(),
203  FSize size = -1 );
204 
205  /**
206  * Dispatcher slot for mouse click: cycle status depending on column.
207  **/
208  virtual void pkgObjClicked( int button,
209  QTreeWidgetItem * item,
210  int col,
211  const QPoint & pos );
212 
213  /**
214  * Reimplemented from QY2ListView:
215  * Emit currentItemChanged() signal after clearing the list.
216  **/
217  virtual void clear();
218 
219  /**
220  * Update the internal actions for the currently selected item ( if any ).
221  * This only calls updateActions( YQPkgObjListItem * ) with the currently
222  * selected item as argument, so there is normally no need to reimplement
223  * this method, too, if the other one is reimplemented.
224  **/
225  virtual void updateActions( YQPkgObjListItem * item = 0);
226 
227  /**
228  * Emit an updatePackages() signal.
229  **/
231 
232  /**
233  * Select the next item, i.e. move the selection one item further down the
234  * list.
235  **/
236  void selectNextItem();
237 
238  /**
239  * Emit a statusChanged() signal for the specified zypp::ResObject.
240  **/
241  void sendStatusChanged() { emit statusChanged(); }
242 
243  /**
244  * Display a one-line message in the list.
245  **/
246  virtual void message( const QString & text );
247 
248  /**
249  * Write statistics about excluded items to the log, if there are any.
250  **/
251  void logExcludeStatistics();
252 
253 
254  // Direct access to some states for menu actions
255 
256  void setCurrentInstall() { setCurrentStatus( S_Install ); }
257  void setCurrentDontInstall() { setCurrentStatus( S_NoInst ); }
258  void setCurrentKeepInstalled() { setCurrentStatus( S_KeepInstalled ); }
259  void setCurrentDelete() { setCurrentStatus( S_Del ); }
260  void setCurrentUpdate() { setCurrentStatus( S_Update, false, true ); }
261  void setCurrentUpdateForce() { setCurrentStatus( S_Update ); }
262  void setCurrentTaboo() { setCurrentStatus( S_Taboo ); }
263  void setCurrentProtected() { setCurrentStatus( S_Protected ); }
264 
265  void setListInstall() { setAllItemStatus( S_Install ); }
266  void setListDontInstall() { setAllItemStatus( S_NoInst ); }
267  void setListKeepInstalled() { setAllItemStatus( S_KeepInstalled ); }
268  void setListDelete() { setAllItemStatus( S_Del ); }
269  void setListUpdate() { setAllItemStatus( S_Update ); }
270  void setListUpdateForce() { setAllItemStatus( S_Update, true ); }
271  void setListTaboo() { setAllItemStatus( S_Taboo ); }
272  void setListProtected() { setAllItemStatus( S_Protected ); }
273 
274 
275 protected slots:
276 
277  /**
278  * Dispatcher slot for selection change - internal only.
279  **/
280  virtual void currentItemChangedInternal( QTreeWidgetItem * item );
281 
282  /**
283  * slot that shows context menu when requested
284  **/
285  void slotCustomContextMenu(const QPoint& pos);
286 
287 
288 signals:
289 
290 
291  /**
292  * Emitted when a zypp::ui::Selectable is selected.
293  * May be called with a null poiner if no zypp::ResObject is selected.
294  **/
295  void currentItemChanged( ZyppSel selectable );
296 
297  /**
298  * Emitted when the status of a zypp::ResObject is changed.
299  **/
300  void statusChanged();
301 
302  /**
303  * Emitted when it's time to update displayed package information,
304  * e.g., package states.
305  **/
306  void updatePackages();
307 
308 
309 protected:
310 
311  /**
312  * Event handler for keyboard input.
313  * Only very special keys are processed here.
314  *
315  * Reimplemented from QListView / QWidget.
316  **/
317  virtual void keyPressEvent( QKeyEvent * ev );
318 
319  /**
320  * Returns the context menu for items that are not installed.
321  * Creates the menu upon the first call.
322  **/
323  virtual QMenu * installedContextMenu();
324 
325  /**
326  * Returns the context menu for items that are installed.
327  * Creates the menu upon the first call.
328  **/
329  virtual QMenu * notInstalledContextMenu();
330 
331  /**
332  * Create the context menu for items that are not installed.
333  **/
334  virtual void createNotInstalledContextMenu();
335 
336  /**
337  * Create the context menu for installed items.
338  **/
339  virtual void createInstalledContextMenu();
340 
341  /**
342  * Create the actions for the context menus.
343  * Note: This is intentionally not virtual!
344  **/
345  void createActions();
346 
347  /**
348  * Create an action based on a zypp::ResObject status - automatically
349  * retrieve the corresponding status icons (both sensitive and insensitive)
350  * and text. 'key' is only a descriptive text, no true accelerator.
351  **/
352  QAction * createAction( ZyppStatus status,
353  const QString & key = QString(),
354  bool enabled = false );
355 
356  /**
357  * Low-level: Create an action.
358  * 'key' is only a descriptive text, no true accelerator.
359  **/
360  QAction * createAction( const QString & text,
361  const QPixmap & icon = QPixmap(),
362  const QPixmap & insensitiveIcon = QPixmap(),
363  const QString & key = QString(),
364  bool enabled = false );
365 
366  // Data members
367 
368  int _iconCol;
369  int _statusCol;
370  int _nameCol;
371  int _summaryCol;
372  int _sizeCol;
373  int _versionCol;
374  int _instVersionCol;
375  int _brokenIconCol;
376  int _satisfiedIconCol;
377  bool _editable;
378  bool _debug;
379  int _excludedItemsCount;
380 
381  typedef list<ExcludeRule *> ExcludeRuleList;
382 
383  ExcludeRuleList _excludeRules;
384 
385  QMenu * _installedContextMenu;
386  QMenu * _notInstalledContextMenu;
387 
388 
389 public:
390 
391  QAction * actionSetCurrentInstall;
392  QAction * actionSetCurrentDontInstall;
393  QAction * actionSetCurrentKeepInstalled;
394  QAction * actionSetCurrentDelete;
395  QAction * actionSetCurrentUpdate;
396  QAction * actionSetCurrentUpdateForce;
397  QAction * actionSetCurrentTaboo;
398  QAction * actionSetCurrentProtected;
399 
400  QAction * actionSetListInstall;
401  QAction * actionSetListDontInstall;
402  QAction * actionSetListKeepInstalled;
403  QAction * actionSetListDelete;
404  QAction * actionSetListUpdate;
405  QAction * actionSetListUpdateForce;
406  QAction * actionSetListTaboo;
407  QAction * actionSetListProtected;
408 };
409 
410 
411 
412 class YQPkgObjListItem: public QY2ListViewItem
413 {
414 public:
415 
416  /**
417  * Constructor for root items: Creates a YQPkgObjList item that corresponds
418  * to the ZYPP selectable that 'selectable' refers to. 'zyppObj' has to be
419  * one object of 'selectable'. If it is 0, selectable->theObject() will be
420  * used.
421  **/
422  YQPkgObjListItem( YQPkgObjList * pkgObjList,
423  ZyppSel selectable,
424  ZyppObj zyppObj = 0 );
425 
426  /**
427  * Constructor for root items: Creates a YQPkgObjList item that does not
428  * correspond to a ZYPP selectable. You need to overload _AND RUN_ init
429  * yourself then.
430  **/
431  YQPkgObjListItem( YQPkgObjList * pkgObjList );
432 
433 protected:
434  /**
435  * Constructor for non-root items.
436  **/
437  YQPkgObjListItem( YQPkgObjList * pkgObjList,
438  QY2ListViewItem * parent,
439  ZyppSel selectable,
440  ZyppObj zyppObj = 0 );
441 
442 public:
443 
444  /**
445  * Destructor
446  **/
447  virtual ~YQPkgObjListItem();
448 
449  /**
450  * Returns the original selectable within the package manager backend.
451  **/
452  ZyppSel selectable() const { return _selectable; }
453 
454  /**
455  * Returns the original object within the package manager backend.
456  **/
457  ZyppObj zyppObj() const { return _zyppObj; }
458 
459  /**
460  * Return whether or not this items is editable, i.e. the user can change
461  * its status. This requires the corresponding list to be editable, too.
462  * Items are editable by default.
463  **/
464  bool editable() const { return _editable; }
465 
466  /**
467  * Set this item's editable status.
468  **/
469  void setEditable( bool editable = true ) { _editable = editable; }
470 
471  /**
472  * Returns the (binary RPM) package status
473  **/
474  virtual ZyppStatus status() const;
475 
476  /**
477  * Returns 'true' if this selectable's status is set by a selection
478  * (rather than by the user or by the dependency solver).
479  **/
480  virtual bool bySelection() const;
481 
482  /**
483  * Set the (binary RPM) package status.
484  *
485  * If 'sendSignals' is 'true' (default), the parent list will be requested
486  * to send update signals. List operations might want to use this for
487  * optimizations to send the signals only once after all changes are done.
488  **/
489  virtual void setStatus( ZyppStatus newStatus, bool sendSignals = true );
490 
491 
492  /**
493  * Set a status icon according to the package's status.
494  **/
495  virtual void setStatusIcon();
496 
497  /**
498  * Update this item's status.
499  * Triggered by QY2ListView::updateAllItemStates().
500  * Overwritten from QY2ListViewItem.
501  **/
502  virtual void updateStatus();
503 
504  /**
505  * Cycle the package status to the next valid value.
506  **/
507  virtual void cycleStatus();
508 
509  /**
510  * Check if the candidate is newer than the installed version.
511  **/
512  bool candidateIsNewer() const { return _candidateIsNewer; }
513 
514  /**
515  * Check if the installed version is newer than the candidate.
516  **/
517  bool installedIsNewer() const { return _installedIsNewer; }
518 
519  /**
520  * Check if this item is satisfied, even though it is not installed.
521  * This is useful for package collections, e.g., patterns and patches:
522  * 'true' is returned if all requirements are fulfilled, but the object
523  * itself is not installed.
524  **/
525  bool isSatisfied() const;
526 
527  /**
528  * Check if this item is "broken": If it is installed, but any of its
529  * dependencies are no longer satisfied.
530  * This is useful for package collections, e.g., patterns and patches.
531  **/
532  bool isBroken() const;
533 
534  /**
535  * Display this item's notify text (if there is any) that corresponds to
536  * the specified status (S_Install, S_Del) in a pop-up window.
537  **/
538  void showNotifyTexts( ZyppStatus status );
539 
540  /**
541  * Display a selectable's license agreement (if there is any) that
542  * corresponds to its current status (S_Install, S_Update) in a pop-up
543  * window.
544  *
545  * Returns 'true' if the user agreed to that license , 'false' otherwise.
546  * The item's status may have changed to S_Taboo, S_Proteced or S_Del if
547  * the user disagreed with the license.
548  **/
549  static bool showLicenseAgreement( ZyppSel sel );
550 
551  /**
552  * Display this item's license agreement (if there is any) that corresponds
553  * to its current status (S_Install, S_Update) in a pop-up window.
554  **/
555  bool showLicenseAgreement();
556 
557  /**
558  * sorting function
559  */
560  virtual bool operator< ( const QTreeWidgetItem & other ) const;
561 
562  /**
563  * Calculate a numerical value to compare versions, based on version
564  * relations:
565  *
566  * - Installed newer than candidate (red)
567  * - Candidate newer than installed (blue) - worthwhile updating
568  * - Installed
569  * - Not installed, but candidate available
570  **/
571  int versionPoints() const;
572 
573  /**
574  * Update this item's data completely.
575  * Triggered by QY2ListView::updateAllItemData().
576  *
577  * Reimplemented from QY2ListViewItem.
578  **/
579  virtual void updateData();
580 
581  /**
582  * Returns a tool tip text for a specific column of this item.
583  * 'column' is -1 if the mouse pointer is in the tree indentation area.
584  *
585  * Reimplemented from QY2ListViewItem.
586  **/
587  virtual QString toolTip( int column );
588 
589  /**
590  * Returns 'true' if this item is excluded.
591  **/
592  bool isExcluded() const { return _excluded; }
593 
594  /**
595  * Set this item's exclude flag.
596  * Note that this is just a marker. It is the caller's responsibility
597  * to add or remove it from exclude lists etc.
598  **/
599  void setExcluded( bool exclude = true );
600 
601 
602  // Handle Debug isBroken and isSatisfied flags
603 
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; }
610 
611 
612  // Columns
613 
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(); }
622 
623 
624 protected:
625 
626  /**
627  * Initialize internal data and set fields accordingly. Only works for items
628  * presenting selectables - see YQPkgObjListItem
629  **/
630  void init();
631 
632  /**
633  * Apply changes hook. This is called each time the user changes the status
634  * of a list item manually (if the old status is different from the new
635  * one). Insert code to propagate changes to other objects here, for
636  * example to trigger a "small" solver run (Resolver::transactObjKind()
637  * etc.).
638  *
639  * This default implementation does nothing.
640  **/
641  virtual void applyChanges() {}
642 
643  /**
644  * Do a "small" solver run for all "resolvable collections", i.e., for
645  * selections, patterns, languages, patches.
646  **/
648 
649  /**
650  * Set a column text via STL string.
651  * ( QListViewItem::setText() expects a QString! )
652  **/
653  void setText( int column, const string text );
654 
655  public:
656  /**
657  * Re-declare ordinary setText() method so the compiler doesn't get
658  * confused which one to use.
659  **/
660  void setText( int column, const QString & text )
661  { QTreeWidgetItem::setText( column, text ); }
662  protected:
663  /**
664  * Set a column text via Edition.
665  **/
666  void setText( int column, const zypp::Edition & edition );
667 
668 
669  //
670  // Data members
671  //
672 
673  YQPkgObjList * _pkgObjList;
674  ZyppSel _selectable;
675  ZyppObj _zyppObj;
676  bool _editable:1;
677  bool _candidateIsNewer:1;
678  bool _installedIsNewer:1;
679 
680  bool _debugIsBroken:1;
681  bool _debugIsSatisfied:1;
682  bool _excluded:1;
683 };
684 
685 
686 
688 {
689 public:
690 
691  /**
692  * Constructor: Creates a new exclude rule with a regular expression
693  * to check against the text of the specified column of each list
694  * entry.
695  *
696  * The parent YQPkgObjList will assume ownership of this exclude rule
697  * and destroy it when the parent is destroyed.
698  **/
700  const QRegExp & regexp,
701  int column = 0 );
702 
703 
704  // Intentionally omitting virtual destructor:
705  // No allocated objects, no other virtual methods,
706  // no need to have a vtable for each instance of this class.
707  //
708  // virtual ~ExcludeRule();
709 
710  /**
711  * Enable or disable this exclude rule.
712  * New exclude rules are enabled by default.
713  **/
714  void enable( bool enable = true );
715 
716  /**
717  * Returns 'true' if this exclude rule is enabled,
718  * 'false' otherwise.
719  **/
720  bool isEnabled() const { return _enabled; }
721 
722  /**
723  * Change the regular expression after creation.
724  **/
725  void setRegexp( const QRegExp & regexp );
726 
727  /**
728  * Returns the regexp.
729  **/
730  QRegExp regexp() const { return _regexp; };
731 
732  /**
733  * Change the column number to check against after creation.
734  **/
735  void setColumn( int column = 0 );
736 
737  /**
738  * Returns the column number.
739  **/
740  int column() const { return _column; }
741 
742  /**
743  * Returns this exclude rule's parent YQPkgObjList.
744  **/
745  YQPkgObjList * parent() const { return _parent; }
746 
747  /**
748  * Check a list item against this exclude rule.
749  * Returns 'true' if the item matches this exclude rule,
750  * i.e. if it should be excluded.
751  **/
752  bool match( QTreeWidgetItem * item );
753 
754 private:
755 
756  YQPkgObjList * _parent;
757  QRegExp _regexp;
758  int _column;
759  bool _enabled;
760 };
761 
762 
763 #endif // ifndef YQPkgObjList_h
bool installedIsNewer() const
Check if the installed version is newer than the candidate.
Definition: YQPkgObjList.h:517
bool candidateIsNewer() const
Check if the candidate is newer than the installed version.
Definition: YQPkgObjList.h:512
bool isExcluded() const
Returns &#39;true&#39; if this item is excluded.
Definition: YQPkgObjList.h:592
Abstract base class to display a list of zypp::ResObjects.
Definition: YQPkgObjList.h:66
void statusChanged()
Emitted when the status of a zypp::ResObject is changed.
void setText(int column, const string text)
Set a column text via STL string.
void setExcluded(bool exclude=true)
Set this item&#39;s exclude flag.
int column() const
Returns the column number.
Definition: YQPkgObjList.h:740
virtual QPixmap statusIcon(ZyppStatus status, bool enabled=true, bool bySelection=false)
Returns the suitable icon for a zypp::ResObject status - the regular icon if &#39;enabled&#39; is &#39;true&#39; or t...
void addPkgObjItem(ZyppSel selectable, ZyppObj zyppObj=0)
Add a zypp::ResObject to the list.
YQPkgObjListItem(YQPkgObjList *pkgObjList, ZyppSel selectable, ZyppObj zyppObj=0)
Constructor for root items: Creates a YQPkgObjList item that corresponds to the ZYPP selectable that ...
void setEditable(bool editable=true)
Set this item&#39;s editable status.
Definition: YQPkgObjList.h:469
virtual bool operator<(const QTreeWidgetItem &other) const
sorting function
void addExcludeRule(YQPkgObjList::ExcludeRule *rule)
Add an exclude rule to this list.
virtual void createInstalledContextMenu()
Create the context menu for installed items.
virtual QString statusText(ZyppStatus status) const
Returns a short (one line) descriptive text for a zypp::ResObject status.
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.
void setAllItemStatus(ZyppStatus newStatus, bool force=false)
Sets the status of all (toplevel) list items to &#39;newStatus&#39;, if possible.
YQPkgObjList * parent() const
Returns this exclude rule&#39;s parent YQPkgObjList.
Definition: YQPkgObjList.h:745
virtual QMenu * notInstalledContextMenu()
Returns the context menu for items that are installed.
bool showLicenseAgreement()
Display this item&#39;s license agreement (if there is any) that corresponds to its current status (S_Ins...
virtual void updateData()
Update this item&#39;s data completely.
virtual void clear()
Reimplemented from QY2ListView: Emit currentItemChanged() signal after clearing the list...
void setColumn(int column=0)
Change the column number to check against after creation.
virtual void message(const QString &text)
Display a one-line message in the list.
virtual void updateStatus()
Update this item&#39;s status.
ExcludeRule(YQPkgObjList *parent, const QRegExp &regexp, int column=0)
Constructor: Creates a new exclude rule with a regular expression to check against the text of the sp...
void createActions()
Create the actions for the context menus.
virtual void setStatus(ZyppStatus newStatus, bool sendSignals=true)
Set the (binary RPM) package status.
QRegExp regexp() const
Returns the regexp.
Definition: YQPkgObjList.h:730
virtual void pkgObjClicked(int button, QTreeWidgetItem *item, int col, const QPoint &pos)
Dispatcher slot for mouse click: cycle status depending on column.
void enable(bool enable=true)
Enable or disable this exclude rule.
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.
bool isBroken() const
Check if this item is "broken": If it is installed, but any of its dependencies are no longer satisfi...
bool editable() const
Return whether or not this items is editable, i.e.
Definition: YQPkgObjList.h:464
virtual void updateActions(YQPkgObjListItem *item=0)
Update the internal actions for the currently selected item ( if any ).
void sendStatusChanged()
Emit a statusChanged() signal for the specified zypp::ResObject.
Definition: YQPkgObjList.h:241
void exclude(YQPkgObjListItem *item, bool exclude)
Exclude or include an item, i.e.
void selectNextItem()
Select the next item, i.e.
void updatePackages()
Emitted when it&#39;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&#39;t get confused which one to use...
Definition: YQPkgObjList.h:660
void setEditable(bool editable=true)
Set the list&#39;s editable status.
Definition: YQPkgObjList.h:113
virtual ZyppStatus status() const
Returns the (binary RPM) package status.
bool match(QTreeWidgetItem *item)
Check a list item against this exclude rule.
bool editable() const
Return whether or not items in this list are generally editable, i.e.
Definition: YQPkgObjList.h:108
virtual void applyChanges()
Apply changes hook.
Definition: YQPkgObjList.h:641
void applyExcludeRules()
Apply all exclude rules of this list to all items, including those that are currently excluded...
void setRegexp(const QRegExp &regexp)
Change the regular expression after creation.
virtual QMenu * addAllInListSubMenu(QMenu *menu)
Add a submenu "All in this list..." to &#39;menu&#39;.
ZyppSel selectable() const
Returns the original selectable within the package manager backend.
Definition: YQPkgObjList.h:452
bool isSatisfied() const
Check if this item is satisfied, even though it is not installed.
void currentItemChanged(ZyppSel selectable)
Emitted when a zypp::ui::Selectable is selected.
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 ...
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&#39;s status.
void sendUpdatePackages()
Emit an updatePackages() signal.
Definition: YQPkgObjList.h:230
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.
virtual bool bySelection() const
Returns &#39;true&#39; if this selectable&#39;s status is set by a selection (rather than by the user or by the d...
bool isEnabled() const
Returns &#39;true&#39; if this exclude rule is enabled, &#39;false&#39; otherwise.
Definition: YQPkgObjList.h:720
virtual QString toolTip(int column)
Returns a tool tip text for a specific column of this item.
void solveResolvableCollections()
Do a "small" solver run for all "resolvable collections", i.e., for selections, patterns, languages, patches.
virtual ~YQPkgObjList()
Destructor.
void showNotifyTexts(ZyppStatus status)
Display this item&#39;s notify text (if there is any) that corresponds to the specified status (S_Install...
virtual void keyPressEvent(QKeyEvent *ev)
Event handler for keyboard input.
YQPkgObjList(QWidget *parent)
Constructor.
Definition: YQPkgObjList.cc:71
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&#39;s status.
ZyppObj zyppObj() const
Returns the original object within the package manager backend.
Definition: YQPkgObjList.h:457
virtual void cycleStatus()
Cycle the package status to the next valid value.
void init()
Initialize internal data and set fields accordingly.