libyui-ncurses-pkg
NCPkgFilterService.h
1 /****************************************************************************
2 |
3 | Copyright (c) [2002-2011] Novell, Inc.
4 | Copyright (c) [2018] SUSE LLC
5 | All Rights Reserved.
6 |
7 | This program is free software; you can redistribute it and/or
8 | modify it under the terms of version 2 of the GNU General Public License as
9 | published by the Free Software Foundation.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program; if not, contact SUSE.
18 |
19 | To contact SUSE about this file by physical or electronic mail,
20 | you may find current contact information at www.suse.com
21 |
22 |***************************************************************************/
23 
24 #ifndef NCPkgFilterService_h
25 #define NCPkgFilterService_h
26 
27 #include <iosfwd>
28 #include <string>
29 #include <vector>
30 #include <algorithm>
31 
32 #include <zypp/RepoManager.h>
33 
34 #include <yui/ncurses/NCPadWidget.h>
35 #include <yui/ncurses/NCPopup.h>
36 #include <yui/ncurses/NCPushButton.h>
37 #include <yui/ncurses/NCTable.h>
38 #include <yui/ncurses/NCTablePad.h>
39 
40 #include "NCZypp.h"
41 
42 
43 class NCTable;
44 class NCPushButton;
45 class NCPackageSelector;
46 
47 // represent a service by its name
48 typedef std::string ZyppService;
49 
50 class NCPkgServiceTag : public YTableCell
51 {
52 
53 private:
54 
55  ZyppService service;
56 
57 public:
65  NCPkgServiceTag( ZyppService service );
66 
67  ~NCPkgServiceTag() {};
68 
69  /*
70  * Get service reference from the line tag
71  * @return ZyppService
72  */
73 
74  ZyppService getService() const { return service; }
75 
76 };
77 
78 class NCPkgServiceTable : public NCTable
79 {
80 private:
81 
82  NCPkgServiceTable & operator=( const NCPkgServiceTable & );
84 
85  NCPackageSelector *packager;
86  zypp::shared_ptr<zypp::RepoManager> repo_manager;
87 
88 public:
89 
98  NCPkgServiceTable ( YWidget *parent, YTableHeader *tableHeader, NCPackageSelector *pkg);
99 
100  virtual ~NCPkgServiceTable() {};
101 
105  static bool any_service();
106 
112  virtual void addLine( ZyppService r, const std::vector<std::string> & cols );
113 
114  /*
115  * Fill header of services table (name + URL)
116  */
117  void fillHeader();
118 
125  NCPkgServiceTag * getTag ( int index );
126 
132  ZyppService getService( int index );
133 
137  std::string getDescription (ZyppService r);
138 
139  virtual NCursesEvent wHandleInput ( wint_t ch );
140 
146  bool fillServiceList();
147 
152  void showServicePackages();
153 
154 };
155 #endif
Definition: NCPkgFilterService.h:78
NCPkgServiceTag(ZyppService service)
Definition: NCPkgFilterService.cc:55
NCPkgServiceTag * getTag(int index)
Definition: NCPkgFilterService.cc:147
virtual void addLine(ZyppService r, const std::vector< std::string > &cols)
Definition: NCPkgFilterService.cc:120
std::string getDescription(ZyppService r)
Definition: NCPkgFilterService.cc:188
static bool any_service()
Definition: NCPkgFilterService.cc:80
bool fillServiceList()
Definition: NCPkgFilterService.cc:207
ZyppService getService(int index)
Definition: NCPkgFilterService.cc:173
Definition: NCPackageSelector.h:109
void showServicePackages()
Definition: NCPkgFilterService.cc:232
Definition: NCPkgFilterService.h:50