libyui-qt-pkg  2.42.5
 All Classes Functions Variables Enumerations
YQPackageSelectorBase.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 | \ \ / /_ _/ ___|_ _|___ \ |
27 | \ V / _` \___ \ | | __) | |
28 | | | (_| |___) || | / __/ |
29 | |_|\__,_|____/ |_| |_____| |
30 | |
31 | core system |
32 | (C) SuSE GmbH |
33 \----------------------------------------------------------------------/
34 
35  File: YQPackageSelectorBase.h
36 
37  Author: Stefan Hundhammer <sh@suse.de>
38 
39 /-*/
40 
41 
42 #ifndef YQPackageSelectorBase_h
43 #define YQPackageSelectorBase_h
44 
45 #include <QEvent>
46 #include <QFrame>
47 #include <YEventFilter.h>
48 
49 #include "YPackageSelector.h"
50 #include "YQZypp.h"
51 
52 
53 class QY2ComboTabWidget;
54 class QAction;
55 
57 class YQPkgDiskUsageList;
59 
60 
61 /**
62  * Abstract base class for package selectors.
63  **/
64 class YQPackageSelectorBase : public QFrame, public YPackageSelector
65 {
66  Q_OBJECT
67 
68 protected:
69 
70  /**
71  * Constructor
72  *
73  * Will initialize package and selection managers and create conflict
74  * dialogs.
75  **/
76  YQPackageSelectorBase( YWidget * parent, long modeFlags = 0 );
77 
78  /**
79  * Destructor
80  **/
81  virtual ~YQPackageSelectorBase();
82 
83 
84 public:
85  /**
86  * Set enabled/disabled state.
87  *
88  * Reimplemented from YWidget.
89  **/
90  virtual void setEnabling( bool enabled );
91 
92  /**
93  * Preferred width of the widget.
94  *
95  * Reimplemented from YWidget.
96  **/
97  virtual int preferredWidth();
98 
99  /**
100  * Preferred height of the widget.
101  *
102  * Reimplemented from YWidget.
103  **/
104  virtual int preferredHeight();
105 
106  /**
107  * Set the new size of the widget.
108  *
109  * Reimplemented from YWidget.
110  **/
111  virtual void setSize( int newWidth, int newHeight );
112 
113  /**
114  * Accept the keyboard focus.
115  *
116  * Reimplemented from YWidget.
117  **/
118  virtual bool setKeyboardFocus();
119 
120 
121 public slots:
122 
123  /**
124  * Resolve dependencies (unconditionally) for all resolvables.
125  *
126  * Returns QDialog::Accepted or QDialog::Rejected.
127  **/
128  int resolveDependencies();
129 
130  /**
131  * Verifies dependencies of the currently installed system.
132  *
133  * Returns QDialog::Accepted or QDialog::Rejected.
134  **/
135  int verifySystem();
136 
137  /**
138  * Check for disk overflow and post a warning dialog if necessary.
139  * The user can choose to override this warning.
140  *
141  * Returns QDialog::Accepted if no warning is necessary or if the user
142  * wishes to override the warning, QDialog::Rejected otherwise.
143  **/
144  int checkDiskUsage();
145 
146  /**
147  * Display a list of automatically selected packages
148  * (excluding packages contained in any selections that are to be installed)
149  **/
150  void showAutoPkgList();
151 
152  /**
153  * Close processing and abandon changes.
154  * If there were changes, this will post an "Abandon all changes?" pop-up.
155  *
156  * Return 'true' if the user really wants to reject (or if there were no
157  * changes anyway), 'false' if not.
158  **/
159  bool reject();
160 
161  /**
162  * Close processing and accept changes
163  **/
164  void accept();
165 
166  /**
167  * Close processing and request start of the repository manager
168  **/
169  void repoManager();
170 
171  /**
172  * Close processing and request start of the online update configuration
173  **/
175 
176  void webpinSearch();
177 
178  /**
179  * Inform user about a feature that is not implemented yet.
180  * This should NEVER show up in the final version.
181  **/
182  void notImplemented();
183 
184 
185 signals:
186 
187  /**
188  * Emitted when package resolving is started.
189  * This can be used for some kind of "busy display".
190  **/
191  void resolvingStarted();
192 
193  /**
194  * Emitted when package resolving is finished.
195  **/
196  void resolvingFinished();
197 
198 
199 protected slots:
200 
201  /**
202  * Reset all previously ignored dependency problems.
203  **/
205 
206 
207 protected:
208 
209  /**
210  * Show all license agreements the user has not confirmed yet
211  * (for all packages that will be installed, and in YOU mode also for
212  * patches).
213  *
214  * Returns 'true' if all licenses were confirmed, 'false' if one or more
215  * licenses were not confirmed (in which case some packages might be set to
216  * S_TABOO, which might require another resolver run).
217  **/
219 
220  /**
221  * Show all license agreements in a resolvable range. To be used with
222  * zyppPkgBegin() and zyppPkgEnd() or with zyppPatchesBegin() and
223  * zyppPatchesEnd().
224  **/
225  bool showPendingLicenseAgreements( ZyppPoolIterator begin,
226  ZyppPoolIterator end );
227 
228  /**
229  * Event handler for keyboard input - for debugging and testing.
230  *
231  * Reimplemented from QWidget.
232  **/
233  virtual void keyPressEvent( QKeyEvent * ev );
234 
235 
236  // Data members
237 
238  YQPkgSelWmCloseHandler * _wmCloseHandler;
239 
240  bool _showChangesDialog;
241  YQPkgConflictDialog * _pkgConflictDialog;
242  YQPkgDiskUsageList * _diskUsageList;
243  QAction * _actionResetIgnoredDependencyProblems;
244 };
245 
246 
247 
248 /**
249  * Helper class: Event filter for the WM_CLOSE event
250  **/
251 class YQPkgSelWmCloseHandler: public YEventFilter
252 {
253 public:
255  : YEventFilter()
256  , _pkgSel( pkgSel )
257  , _inReject( false )
258  {}
259 
260  virtual ~YQPkgSelWmCloseHandler() {};
261 
262  /**
263  * The filter method: This is what this class is all about.
264  * Check for Cancel events (WM_CLOSE).
265  **/
266  virtual YEvent * filter( YEvent * event );
267 
268  YQPackageSelectorBase * pkgSel() const { return _pkgSel; }
269 
270 private:
271 
272  YQPackageSelectorBase * _pkgSel;
273  bool _inReject;
274 };
275 
276 
277 #endif // YQPackageSelectorBase_h