1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQPkgSelList_h
21 #define YQPkgSelList_h
23 #include <YQPkgObjList.h>
26 class YQPkgSelListItem;
30 * @short Display a list of zypp::Selection objects.
32 class YQPkgSelList : public YQPkgObjList
41 * Set 'autoFill' to 'false' if you don't want the list to be filled in the
42 * constructor. In that case, use fillList() (e.g., when connections are
45 * Set 'autoFilter' to 'false' if there is no need to do (expensive)
46 * filtering because the 'filterMatch' signal is not connected anyway.
48 YQPkgSelList( QWidget * parent, bool autoFill = true, bool autoFilter = true );
53 virtual ~YQPkgSelList();
59 * Filter according to the view's rules and current selection.
60 * Emits those signals:
62 * filterMatch() for each pkg that matches the filter
68 * Same as filter(), but only if this widget is currently visible.
70 void filterIfVisible();
74 * Add a selection to the list. Connect a filter's filterMatch() signal to
75 * this slot. Remember to connect filterStart() to clear() (inherited from
78 void addPkgSelItem( ZyppSel selectable,
79 ZyppSelection selection );
82 * Fill the selection list.
89 * Returns the currently selected item or 0 if there is none.
91 YQPkgSelListItem * selection() const;
97 * Emitted when the filtering starts. Use this to clear package lists
98 * etc. prior to adding new entries.
103 * Emitted during filtering for each pkg that matches the filter.
105 void filterMatch( ZyppSel selectable,
109 * Emitted when filtering is finished.
111 void filterFinished();
116 class YQPkgSelListItem: public YQPkgObjListItem
123 YQPkgSelListItem( YQPkgSelList * pkgSelList,
125 ZyppSelection zyppSelection );
130 virtual ~YQPkgSelListItem();
133 * Returns the original object within the package manager backend.
135 ZyppSelection zyppSelection() const { return _zyppSelection; }
138 * Comparison function used for sorting the list.
144 * Reimplemented from QListViewItem:
145 * Sort by zypp::Selection::order() only.
147 virtual int compare( QTreeWidgetItem * other,
149 bool ascending ) const;
153 int statusCol() const { return _pkgSelList->statusCol(); }
154 int summaryCol() const { return _pkgSelList->summaryCol(); }
160 * Propagate status changes in this list to other lists:
161 * Have the solver transact all selections.
163 * Reimplemented from YQPkgObjListItem.
165 virtual void applyChanges();
170 YQPkgSelList * _pkgSelList;
171 ZyppSelection _zyppSelection;
175 #endif // ifndef YQPkgSelList_h