1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQPkgRepoList_h
21 #define YQPkgRepoList_h
24 #include "QY2ListView.h"
25 #include <zypp/Repository.h>
26 #include <zypp/Product.h>
29 class YQPkgRepoListItem;
31 typedef zypp::Repository ZyppRepo;
35 * @short Display a list of zypp::Selection objects.
37 class YQPkgRepoList : public QY2ListView
46 YQPkgRepoList( QWidget * parent );
51 virtual ~YQPkgRepoList();
54 * Returns the number of enabled repositories.
56 static int countEnabledRepositories();
62 * Filter according to the view's rules and current selection.
63 * Emits those signals:
65 * filterMatch() for each pkg that matches the filter
71 * Same as filter(), but only if this widget is currently visible.
73 void filterIfVisible();
76 * Add a repository to the list.
78 void addRepo( ZyppRepo repo );
85 int nameCol() const { return _nameCol; }
86 int urlCol() const { return _urlCol; }
90 * Returns the currently selected item or 0 if there is none.
92 YQPkgRepoListItem * selection() const;
98 * Emitted when the filtering starts. Use this to clear package lists
99 * etc. prior to adding new entries.
104 * Emitted during filtering for each pkg that matches the filter
105 * and the candidate package comes from the respective repository
107 void filterMatch( ZyppSel selectable,
111 * Emitted during filtering for each pkg that matches the filter
112 * and the candidate package does not come from the respective repository
114 void filterNearMatch( ZyppSel selectable,
118 * Emitted when filtering is finished.
120 void filterFinished();
144 class YQPkgRepoListItem: public QY2ListViewItem
151 YQPkgRepoListItem( YQPkgRepoList *parentList, ZyppRepo repo );
156 virtual ~YQPkgRepoListItem();
159 * Returns the ZYPP repository this item corresponds to
161 ZyppRepo zyppRepo() const { return _zyppRepo; }
164 * Returns the parent list
166 const YQPkgRepoList * repoList() const { return _repoList; }
169 * Returns the product on a source if it has one single product
170 * or 0 if there are no or multiple products.
172 static ZyppProduct singleProduct( ZyppRepo repo );
177 int nameCol() const { return _repoList->nameCol(); }
178 int urlCol() const { return _repoList->urlCol(); }
184 YQPkgRepoList * _repoList;
189 #endif // ifndef YQPkgRepoList_h