libyui-ncurses-pkg  2.46.1
 All Classes Functions
NCPkgFilterRepo.h
1 /****************************************************************************
2 |
3 | Copyright (c) [2002-2011] Novell, Inc.
4 | All Rights Reserved.
5 |
6 | This program is free software; you can redistribute it and/or
7 | modify it under the terms of version 2 of the GNU General Public License as
8 | published by the Free Software Foundation.
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
16 | along with this program; if not, contact Novell, Inc.
17 |
18 | To contact Novell about this file by physical or electronic mail,
19 | you may find current contact information at www.novell.com
20 |
21 |***************************************************************************/
22 
23 
24 /*---------------------------------------------------------------------\
25 | |
26 | __ __ ____ _____ ____ |
27 | \ \ / /_ _/ ___|_ _|___ \ |
28 | \ V / _` \___ \ | | __) | |
29 | | | (_| |___) || | / __/ |
30 | |_|\__,_|____/ |_| |_____| |
31 | |
32 | core system |
33 | (C) SuSE GmbH |
34 \----------------------------------------------------------------------/
35 
36  File: NCPkgFilterRepo.h
37 
38  Author: Bubli <kmachalkova@suse.cz>
39 
40 /-*/
41 
42 #ifndef NCPkgFilterRepo_h
43 #define NCPkgFilterRepo_h
44 
45 #include <iosfwd>
46 
47 #include <vector>
48 #include <string>
49 #include <algorithm>
50 
51 #include "NCPadWidget.h"
52 #include "NCPopup.h"
53 #include "NCPushButton.h"
54 #include "NCTable.h"
55 #include "NCTablePad.h"
56 #include "NCZypp.h"
57 
58 class NCTable;
59 class NCPushButton;
60 class NCPackageSelector;
61 
62 class NCPkgRepoTag : public YTableCell
63 {
64 
65 private:
66 
67  ZyppRepo repo;
68 
69 public:
70  /**
71  * A helper class to hold a reference to zypp::Repository
72  * for each repository table line
73  * (actually it's a dummy column of the table)
74  * @param repo zypp::Repository reference
75  */
76 
77  NCPkgRepoTag ( ZyppRepo repo);
78 
79  //Nikdy, ale opravdu nikdy nenechavej v odvozene tride virtualni
80  //destruktor, kdyz ani v puvodni neni, Bublino!
81  ~NCPkgRepoTag() { };
82 
83  /*
84  * Get repository reference from the line tag
85  * @return ZyppRepo
86  */
87 
88  ZyppRepo getRepo() const { return repo; }
89 
90 };
91 
92 class NCPkgRepoTable : public NCTable
93 {
94 private:
95 
96  NCPkgRepoTable & operator=( const NCPkgRepoTable & );
97  NCPkgRepoTable ( const NCPkgRepoTable & );
98 
99  NCPackageSelector *packager;
100 public:
101 
102  /**
103  * A helper class to hold repository data in a neat table
104  * widget
105  * @param parent A parent widget
106  * @param opt Widget options
107  */
108 
109  NCPkgRepoTable ( YWidget *parent, YTableHeader *tableHeader, NCPackageSelector *pkg);
110 
111  virtual ~NCPkgRepoTable() {};
112 
113  /**
114  * Add one line (with tag) to the repositories table
115  * @param ZyppRepo Reference to zypp::Repository
116  * @param cols String std::vector with repository data (name + URL)
117  */
118  virtual void addLine( ZyppRepo r, const std::vector<std::string> & cols );
119 
120  /*
121  * Fill header of repositories table (name + URL)
122  */
123  void fillHeader();
124 
125  /**
126  * Get tag of repository table line on current index,
127  * ( contains repository reference)
128  * @param index Index of selected table line
129  * @return NCPkgRepoTag* Tag of selected line
130  */
131  NCPkgRepoTag * getTag ( const int & index );
132 
133  /**
134  * Get repository reference from selected line's tag
135  * @param index Index of selected table line
136  * @return ZyppRepo Associated zypp::Repository reference
137  */
138  ZyppRepo getRepo( int index );
139 
140  std::string showDescription (ZyppRepo r);
141 
142  virtual NCursesEvent wHandleInput ( wint_t ch );
143 
144  /**
145  * Find single zypp::Product for this repository
146  * (null product if multiple products found)
147  * @param repo zypp::Repository
148  * @return ZyppProduct
149  */
150 
151  ZyppProduct findProductForRepo (ZyppRepo repo);
152 
153  /**
154  * Add items to the repository list (assoc.
155  * product name, if any, and URL)
156  * @return bool (always true ;-) )
157  */
158  bool fillRepoList( );
159 
160  bool showRepoPackages( );
161 
162 };
163 #endif
ZyppProduct findProductForRepo(ZyppRepo repo)
Find single zypp::Product for this repository (null product if multiple products found) ...
ZyppRepo getRepo(int index)
Get repository reference from selected line's tag.
NCPkgRepoTag * getTag(const int &index)
Get tag of repository table line on current index, ( contains repository reference) ...
NCPkgRepoTag(ZyppRepo repo)
A helper class to hold a reference to zypp::Repository for each repository table line (actually it's ...
bool fillRepoList()
Add items to the repository list (assoc.
virtual void addLine(ZyppRepo r, const std::vector< std::string > &cols)
Add one line (with tag) to the repositories table.