libyui-qt-pkg  2.47.5
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  /**
177  * Close processing and request start of the online search
178  **/
179  void onlineSearch();
180 
181  /**
182  * Inform user about a feature that is not implemented yet.
183  * This should NEVER show up in the final version.
184  **/
185  void notImplemented();
186 
187 
188 signals:
189 
190  /**
191  * Emitted when package resolving is started.
192  * This can be used for some kind of "busy display".
193  **/
194  void resolvingStarted();
195 
196  /**
197  * Emitted when package resolving is finished.
198  **/
199  void resolvingFinished();
200 
201 
202 protected slots:
203 
204  /**
205  * Reset all previously ignored dependency problems.
206  **/
208 
209 
210 protected:
211 
212  /**
213  * Show all license agreements the user has not confirmed yet
214  * (for all packages that will be installed, and in YOU mode also for
215  * patches).
216  *
217  * Returns 'true' if all licenses were confirmed, 'false' if one or more
218  * licenses were not confirmed (in which case some packages might be set to
219  * S_TABOO, which might require another resolver run).
220  **/
222 
223  /**
224  * Show all license agreements in a resolvable range. To be used with
225  * zyppPkgBegin() and zyppPkgEnd() or with zyppPatchesBegin() and
226  * zyppPatchesEnd().
227  **/
228  bool showPendingLicenseAgreements( ZyppPoolIterator begin,
229  ZyppPoolIterator end );
230 
231  /**
232  * Event handler for keyboard input - for debugging and testing.
233  *
234  * Reimplemented from QWidget.
235  **/
236  virtual void keyPressEvent( QKeyEvent * ev );
237 
238 
239  // Data members
240 
241  YQPkgSelWmCloseHandler * _wmCloseHandler;
242 
243  bool _showChangesDialog;
244  YQPkgConflictDialog * _pkgConflictDialog;
245  YQPkgDiskUsageList * _diskUsageList;
246  QAction * _actionResetIgnoredDependencyProblems;
247 };
248 
249 
250 
251 /**
252  * Helper class: Event filter for the WM_CLOSE event
253  **/
254 class YQPkgSelWmCloseHandler: public YEventFilter
255 {
256 public:
258  : YEventFilter()
259  , _pkgSel( pkgSel )
260  , _inReject( false )
261  {}
262 
263  virtual ~YQPkgSelWmCloseHandler() {};
264 
265  /**
266  * The filter method: This is what this class is all about.
267  * Check for Cancel events (WM_CLOSE).
268  **/
269  virtual YEvent * filter( YEvent * event );
270 
271  YQPackageSelectorBase * pkgSel() const { return _pkgSel; }
272 
273 private:
274 
275  YQPackageSelectorBase * _pkgSel;
276  bool _inReject;
277 };
278 
279 
280 #endif // YQPackageSelectorBase_h
int verifySystem()
Verifies dependencies of the currently installed system.
void onlineUpdateConfiguration()
Close processing and request start of the online update configuration.
void resetIgnoredDependencyProblems()
Reset all previously ignored dependency problems.
bool showPendingLicenseAgreements()
Show all license agreements the user has not confirmed yet (for all packages that will be installed...
virtual void setEnabling(bool enabled)
Set enabled/disabled state.
int checkDiskUsage()
Check for disk overflow and post a warning dialog if necessary.
virtual bool setKeyboardFocus()
Accept the keyboard focus.
void accept()
Close processing and accept changes.
void repoManager()
Close processing and request start of the repository manager.
void notImplemented()
Inform user about a feature that is not implemented yet.
void onlineSearch()
Close processing and request start of the online search.
void resolvingStarted()
Emitted when package resolving is started.
void resolvingFinished()
Emitted when package resolving is finished.
virtual YEvent * filter(YEvent *event)
The filter method: This is what this class is all about.
virtual ~YQPackageSelectorBase()
Destructor.
Helper class: Event filter for the WM_CLOSE event.
Abstract base class for package selectors.
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
virtual void keyPressEvent(QKeyEvent *ev)
Event handler for keyboard input - for debugging and testing.
virtual int preferredWidth()
Preferred width of the widget.
YQPackageSelectorBase(YWidget *parent, long modeFlags=0)
Constructor.
Dialog that takes care of dependency checking and resolving conflicts.
void showAutoPkgList()
Display a list of automatically selected packages (excluding packages contained in any selections tha...
virtual int preferredHeight()
Preferred height of the widget.
bool reject()
Close processing and abandon changes.
int resolveDependencies()
Resolve dependencies (unconditionally) for all resolvables.
List of disk usage of all attached partitions.