libyui-qt-pkg
YQPkgServiceList.h
1 /**************************************************************************
2 Copyright (C) 2018 SUSE LLC
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 #ifndef YQPkgServiceList_h
23 #define YQPkgServiceList_h
24 
25 #include <string>
26 #include <zypp/Product.h>
27 #include <yui/qt/QY2ListView.h>
28 #include "YQZypp.h"
29 
30 
32 namespace zypp {
33  class RepoManager;
34 }
35 
36 // just a service name
37 typedef std::string ZyppService;
38 
39 
43 class YQPkgServiceList : public QY2ListView
44 {
45  Q_OBJECT
46 
47 public:
48 
52  YQPkgServiceList( QWidget * parent );
53 
57  virtual ~YQPkgServiceList();
58 
59 
60 public slots:
61 
69  void filter();
70 
74  void filterIfVisible();
75 
79  void addService( ZyppService service, const zypp::RepoManager &mgr );
80 
81 
82 public:
83 
84  // Column numbers
85  int nameCol() const { return _nameCol; }
86 
91 
92 
93 signals:
94 
99  void filterStart();
100 
105  void filterMatch( ZyppSel selectable,
106  ZyppPkg pkg );
107 
112  void filterNearMatch( ZyppSel selectable,
113  ZyppPkg pkg );
114 
118  void filterFinished();
119 
120 
121 protected slots:
122 
126  void fillList();
127 
128 
129 private:
130 
131  //
132  // Data members
133  //
134 
135  int _nameCol;
136 };
137 
138 
139 
140 class YQPkgServiceListItem: public QY2ListViewItem
141 {
142 public:
143 
147  YQPkgServiceListItem( YQPkgServiceList *parentList, ZyppService service, const zypp::RepoManager &mgr );
148 
152  virtual ~YQPkgServiceListItem();
153 
157  ZyppService zyppService() const { return _zyppService; }
158 
162  std::string zyppServiceName() const { return _zyppServiceName; }
163 
167  const YQPkgServiceList * serviceList() const { return _serviceList; }
168 
173  static ZyppProduct singleProduct( ZyppService service );
174 
175 
176  // Columns
177 
178  int nameCol() const { return _serviceList->nameCol(); }
179 
180  virtual bool operator< ( const QTreeWidgetItem & other ) const;
181 protected:
182 
183  // Data members
184 
185  YQPkgServiceList * _serviceList;
186  // the zypp service
187  ZyppService _zyppService;
188  std::string _zyppServiceName;
189 };
190 
191 
192 #endif // ifndef YQPkgServiceList_h
void filter()
Definition: YQPkgServiceList.cc:123
ZyppService zyppService() const
Definition: YQPkgServiceList.h:157
virtual ~YQPkgServiceList()
Definition: YQPkgServiceList.cc:82
std::string zyppServiceName() const
Definition: YQPkgServiceList.h:162
const YQPkgServiceList * serviceList() const
Definition: YQPkgServiceList.h:167
virtual ~YQPkgServiceListItem()
Definition: YQPkgServiceList.cc:226
void filterIfVisible()
Definition: YQPkgServiceList.cc:116
void filterNearMatch(ZyppSel selectable, ZyppPkg pkg)
YQPkgServiceList(QWidget *parent)
Definition: YQPkgServiceList.cc:55
A widget to display a list of libzypp services.
Definition: YQPkgServiceList.h:43
static ZyppProduct singleProduct(ZyppService service)
Definition: YQPkgServiceList.cc:232
void fillList()
Definition: YQPkgServiceList.cc:88
void addService(ZyppService service, const zypp::RepoManager &mgr)
Definition: YQPkgServiceList.cc:171
Definition: YQPkgServiceList.h:140
YQPkgServiceListItem * selection() const
Definition: YQPkgServiceList.cc:178
Definition: YQPkgServiceList.h:32
YQPkgServiceListItem(YQPkgServiceList *parentList, ZyppService service, const zypp::RepoManager &mgr)
Definition: YQPkgServiceList.cc:184
void filterMatch(ZyppSel selectable, ZyppPkg pkg)