libyui-qt-pkg
YQPkgRepoList.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: YQPkgRepoList.h
35 
36  Author: Stefan Hundhammer <shundhammer.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgRepoList_h
42 #define YQPkgRepoList_h
43 
44 #include <zypp/Repository.h>
45 #include <zypp/Product.h>
46 #include <yui/qt/QY2ListView.h>
47 
48 #include "YQZypp.h"
49 
50 
51 class YQPkgRepoListItem;
52 
53 typedef zypp::Repository ZyppRepo;
54 
55 
59 class YQPkgRepoList : public QY2ListView
60 {
61  Q_OBJECT
62 
63 public:
64 
68  YQPkgRepoList( QWidget * parent );
69 
73  virtual ~YQPkgRepoList();
74 
78  static int countEnabledRepositories();
79 
80 
81 public slots:
82 
90  void filter();
91 
95  void filterIfVisible();
96 
100  void addRepo( ZyppRepo repo );
101 
102 
103 public:
104 
105  // Column numbers
106 
107  int nameCol() const { return _nameCol; }
108  int urlCol() const { return _urlCol; }
109 
110 
114  YQPkgRepoListItem * selection() const;
115 
116 
117 signals:
118 
123  void filterStart();
124 
129  void filterMatch( ZyppSel selectable,
130  ZyppPkg pkg );
131 
136  void filterNearMatch( ZyppSel selectable,
137  ZyppPkg pkg );
138 
142  void filterFinished();
143 
144 
145 protected slots:
146 
150  void fillList();
151 
152 
153 private:
154 
155  //
156  // Data members
157  //
158 
159  int _nameCol;
160  int _urlCol;
161 
162 };
163 
164 
165 
166 class YQPkgRepoListItem: public QY2ListViewItem
167 {
168 public:
169 
173  YQPkgRepoListItem( YQPkgRepoList *parentList, ZyppRepo repo );
174 
178  virtual ~YQPkgRepoListItem();
179 
183  ZyppRepo zyppRepo() const { return _zyppRepo; }
184 
188  const YQPkgRepoList * repoList() const { return _repoList; }
189 
194  static ZyppProduct singleProduct( ZyppRepo repo );
195 
196 
197  // Columns
198 
199  int nameCol() const { return _repoList->nameCol(); }
200  int urlCol() const { return _repoList->urlCol(); }
201 
202  virtual bool operator< ( const QTreeWidgetItem & other ) const;
203 protected:
204 
205  // Data members
206 
207  YQPkgRepoList * _repoList;
208  ZyppRepo _zyppRepo;
209 };
210 
211 
212 #endif // ifndef YQPkgRepoList_h
const YQPkgRepoList * repoList() const
Definition: YQPkgRepoList.h:188
void fillList()
Definition: YQPkgRepoList.cc:110
void filter()
Definition: YQPkgRepoList.cc:142
static int countEnabledRepositories()
Definition: YQPkgRepoList.cc:127
YQPkgRepoListItem * selection() const
Definition: YQPkgRepoList.cc:197
ZyppRepo zyppRepo() const
Definition: YQPkgRepoList.h:183
YQPkgRepoList(QWidget *parent)
Definition: YQPkgRepoList.cc:69
void filterNearMatch(ZyppSel selectable, ZyppPkg pkg)
void filterStart()
virtual ~YQPkgRepoList()
Definition: YQPkgRepoList.cc:103
YQPkgRepoListItem(YQPkgRepoList *parentList, ZyppRepo repo)
Definition: YQPkgRepoList.cc:208
Definition: YQPkgRepoList.h:166
void filterFinished()
void filterMatch(ZyppSel selectable, ZyppPkg pkg)
virtual ~YQPkgRepoListItem()
Definition: YQPkgRepoList.cc:277
static ZyppProduct singleProduct(ZyppRepo repo)
Definition: YQPkgRepoList.cc:284
Display a list of libzypp repositories.
Definition: YQPkgRepoList.h:59
void addRepo(ZyppRepo repo)
Definition: YQPkgRepoList.cc:190
void filterIfVisible()
Definition: YQPkgRepoList.cc:134