]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/pkg/YQPackageSelectorBase.h
don't create QObjects in ycp thread - make timeouts work
[duncan/yast2-qt4.git] / src / pkg / YQPackageSelectorBase.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPackageSelectorBase.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQPackageSelectorBase_h
21 #define YQPackageSelectorBase_h
22
23 #include <QEvent>
24 #include <QFrame>
25 #include "YPackageSelector.h"
26 #include "YQZypp.h"
27
28
29 class QY2ComboTabWidget;
30 class QAction;
31
32 class YQPkgConflictDialog;
33 class YQPkgDiskUsageList;
34
35
36 /**
37  * Abstract base class for package selectors.
38  **/
39 class YQPackageSelectorBase : public QFrame, public YPackageSelector
40 {
41     Q_OBJECT
42
43 protected:
44
45     /**
46      * Constructor
47      *
48      * Will initialize package and selection managers and create conflict
49      * dialogs.
50      **/
51     YQPackageSelectorBase( YWidget * parent, long modeFlags = 0 );
52
53     /**
54      * Destructor
55      **/
56     virtual ~YQPackageSelectorBase();
57
58
59 public:
60     /**
61      * Set enabled/disabled state.
62      *
63      * Reimplemented from YWidget.
64      **/
65     virtual void setEnabling( bool enabled );
66
67     /**
68      * Preferred width of the widget.
69      *
70      * Reimplemented from YWidget.
71      **/
72     virtual int preferredWidth();
73
74     /**
75      * Preferred height of the widget.
76      *
77      * Reimplemented from YWidget.
78      **/
79     virtual int preferredHeight();
80
81     /**
82      * Set the new size of the widget.
83      *
84      * Reimplemented from YWidget.
85      **/
86     virtual void setSize( int newWidth, int newHeight );
87
88     /**
89      * Accept the keyboard focus.
90      *
91      * Reimplemented from YWidget.
92      **/
93     virtual bool setKeyboardFocus();
94
95     /**
96      * Event filter to handle WM_CLOSE like "Cancel"
97      *
98      * Reimplemented from QObject.
99      **/
100     virtual bool eventFilter( QObject * obj, QEvent * event );
101
102     
103 public slots:
104
105     /**
106      * Resolve dependencies (unconditionally) for all resolvables.
107      *
108      * Returns QDialog::Accepted or QDialog::Rejected.
109      **/
110     int resolveDependencies();
111
112     /**
113      * Verifies dependencies of the currently installed system.
114      *
115      * Returns QDialog::Accepted or QDialog::Rejected.
116      **/
117     int verifySystem();
118
119     /**
120      * Check for disk overflow and post a warning dialog if necessary.
121      * The user can choose to override this warning.
122      *
123      * Returns QDialog::Accepted if no warning is necessary or if the user
124      * wishes to override the warning, QDialog::Rejected otherwise.
125      **/
126     int checkDiskUsage();
127
128     /**
129      * Display a list of automatically selected packages
130      * (excluding packages contained in any selections that are to be installed)
131      **/
132     void showAutoPkgList();
133
134     /**
135      * Close processing and abandon changes
136      **/
137     void reject();
138
139     /**
140      * Close processing and accept changes
141      **/
142     void accept();
143
144     /**
145      * Inform user about a feature that is not implemented yet.
146      * This should NEVER show up in the final version.
147      **/
148     void notImplemented();
149
150
151 signals:
152
153     /**
154      * Emitted when package resolving is started.
155      * This can be used for some kind of "busy display".
156      **/
157     void resolvingStarted();
158
159     /**
160      * Emitted when package resolving is finished.
161      **/
162     void resolvingFinished();
163
164
165 protected slots:
166
167     /**
168      * Reset all previously ignored dependency problems.
169      **/
170     void resetIgnoredDependencyProblems();
171
172
173 protected:
174
175     /**
176      * Show all license agreements the user has not confirmed yet
177      * (for all packages that will be installed, and in YOU mode also for
178      * patches).
179      *
180      * Returns 'true' if all licenses were confirmed, 'false' if one or more
181      * licenses were not confirmed (in which case some packages might be set to
182      * S_TABOO, which might require another resolver run).
183      **/
184     bool showPendingLicenseAgreements();
185
186     /**
187      * Show all license agreements in a resolvable range. To be used with
188      * zyppPkgBegin() and zyppPkgEnd() or with zyppPatchesBegin() and
189      * zyppPatchesEnd().
190      **/
191     bool showPendingLicenseAgreements( ZyppPoolIterator begin,
192                                        ZyppPoolIterator end );
193
194     /**
195      * Event handler for keyboard input - for debugging and testing.
196      *
197      * Reimplemented from QWidget.
198      **/
199     virtual void keyPressEvent( QKeyEvent * ev );
200
201
202     // Data members
203
204     bool                        _showChangesDialog;
205     YQPkgConflictDialog *       _pkgConflictDialog;
206     YQPkgDiskUsageList *        _diskUsageList;
207     QAction *                   _actionResetIgnoredDependencyProblems;
208 };
209
210
211
212 #endif // YQPackageSelectorBase_h