libyui-qt-pkg  2.45.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  /**
177  * Inform user about a feature that is not implemented yet.
178  * This should NEVER show up in the final version.
179  **/
180  void notImplemented();
181 
182 
183 signals:
184 
185  /**
186  * Emitted when package resolving is started.
187  * This can be used for some kind of "busy display".
188  **/
189  void resolvingStarted();
190 
191  /**
192  * Emitted when package resolving is finished.
193  **/
194  void resolvingFinished();
195 
196 
197 protected slots:
198 
199  /**
200  * Reset all previously ignored dependency problems.
201  **/
203 
204 
205 protected:
206 
207  /**
208  * Show all license agreements the user has not confirmed yet
209  * (for all packages that will be installed, and in YOU mode also for
210  * patches).
211  *
212  * Returns 'true' if all licenses were confirmed, 'false' if one or more
213  * licenses were not confirmed (in which case some packages might be set to
214  * S_TABOO, which might require another resolver run).
215  **/
217 
218  /**
219  * Show all license agreements in a resolvable range. To be used with
220  * zyppPkgBegin() and zyppPkgEnd() or with zyppPatchesBegin() and
221  * zyppPatchesEnd().
222  **/
223  bool showPendingLicenseAgreements( ZyppPoolIterator begin,
224  ZyppPoolIterator end );
225 
226  /**
227  * Event handler for keyboard input - for debugging and testing.
228  *
229  * Reimplemented from QWidget.
230  **/
231  virtual void keyPressEvent( QKeyEvent * ev );
232 
233 
234  // Data members
235 
236  YQPkgSelWmCloseHandler * _wmCloseHandler;
237 
238  bool _showChangesDialog;
239  YQPkgConflictDialog * _pkgConflictDialog;
240  YQPkgDiskUsageList * _diskUsageList;
241  QAction * _actionResetIgnoredDependencyProblems;
242 };
243 
244 
245 
246 /**
247  * Helper class: Event filter for the WM_CLOSE event
248  **/
249 class YQPkgSelWmCloseHandler: public YEventFilter
250 {
251 public:
253  : YEventFilter()
254  , _pkgSel( pkgSel )
255  , _inReject( false )
256  {}
257 
258  virtual ~YQPkgSelWmCloseHandler() {};
259 
260  /**
261  * The filter method: This is what this class is all about.
262  * Check for Cancel events (WM_CLOSE).
263  **/
264  virtual YEvent * filter( YEvent * event );
265 
266  YQPackageSelectorBase * pkgSel() const { return _pkgSel; }
267 
268 private:
269 
270  YQPackageSelectorBase * _pkgSel;
271  bool _inReject;
272 };
273 
274 
275 #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 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.