42 #include <QMessageBox> 45 #define YUILogComponent "qt-pkg" 49 #include <QVBoxLayout> 50 #include <QHBoxLayout> 51 #include "QY2LayoutUtils.h" 53 #include "YQPackageSelectorBase.h" 54 #include "YQPkgChangesDialog.h" 55 #include "YQPkgConflictDialog.h" 56 #include "YQPkgDiskUsageList.h" 57 #include "YQPkgDiskUsageWarningDialog.h" 58 #include "YQPkgTextDialog.h" 59 #include "YQPkgObjList.h" 63 #include "YQApplication.h" 67 #include "QY2Styler.h" 76 : QFrame( (QWidget *) parent->widgetRep() )
77 , YPackageSelector( parent, modeFlags )
82 _showChangesDialog =
false;
83 _pkgConflictDialog = 0;
85 _pkgConflictDialog = 0;
87 YQUI::setTextdomain(
"qt-pkg" );
88 setFont( YQUI::yqApp()->currentFont() );
91 Q_CHECK_PTR( _pkgConflictDialog );
93 QString label = _(
"Reset &Ignored Dependency Conflicts" );
94 _actionResetIgnoredDependencyProblems =
new QAction( label,
this);
95 _actionResetIgnoredDependencyProblems->setShortcut((QKeySequence) 0);
97 Q_CHECK_PTR( _actionResetIgnoredDependencyProblems );
99 connect( _actionResetIgnoredDependencyProblems, &QAction::triggered,
102 zyppPool().saveState<zypp::Package >();
103 zyppPool().saveState<zypp::Pattern >();
104 zyppPool().saveState<zypp::Patch >();
108 QY2Styler::styler()->registerWidget(
this );
110 yuiMilestone() <<
"PackageSelectorBase init done" << std::endl;
116 yuiMilestone() <<
"Destroying PackageSelector" << std::endl;
118 QY2Styler::styler()->unregisterWidget(
this );
120 if ( _wmCloseHandler )
121 delete _wmCloseHandler;
128 if ( ! _pkgConflictDialog )
130 yuiError() <<
"No package conflict dialog existing" << std::endl;
131 return QDialog::Accepted;
135 YQUI::ui()->busyCursor();
141 YQUI::ui()->normalCursor();
150 if ( ! _pkgConflictDialog )
152 yuiError() <<
"No package conflict dialog existing" << std::endl;
153 return QDialog::Accepted;
157 YQUI::ui()->busyCursor();
159 YQUI::ui()->normalCursor();
161 if ( result == QDialog::Accepted )
163 QMessageBox::information(
this,
"",
164 _(
"System dependencies verify OK." ),
175 if ( ! _diskUsageList )
177 return QDialog::Accepted;
181 return QDialog::Accepted;
185 "<p><b>" + _(
"Error: Out of disk space!" ) +
"</b></p>" 187 "You can choose to install anyway if you know what you are doing, " 188 "but you risk getting a corrupted system that requires manual repairs. " 189 "If you are not absolutely sure how to handle such a case, " 190 "press <b>Cancel</b> now and deselect some packages." 194 100, _(
"C&ontinue Anyway" ), _(
"&Cancel" ) );
208 + _(
"The following items will be changed:" 216 YQPkgChangesDialog::FilterAutomatic,
217 YQPkgChangesDialog::OptionNone );
226 zyppPool().diffState<zypp::Package >() ||
227 zyppPool().diffState<zypp::Pattern >() ||
228 zyppPool().diffState<zypp::Patch >();
232 if ( zyppPool().diffState<zypp::Package>() )
233 yuiMilestone() <<
"diffState() reports changed packages" << std::endl;
235 if ( zyppPool().diffState<zypp::Pattern>() )
236 yuiMilestone() <<
"diffState() reports changed patterns" << std::endl;
238 if ( zyppPool().diffState<zypp::Patch>() )
239 yuiMilestone() <<
"diffState() reports changed patches" << std::endl;
242 bool confirm =
false;
247 QMessageBox::warning(
this,
"",
248 _(
"Do you want to Abandon all changes and exit?" ),
249 _(
"&Yes" ), _(
"&No" ),
"",
253 confirm = ( result == 0 );
256 if ( ! changes || confirm )
258 zyppPool().restoreState<zypp::Package >();
259 zyppPool().restoreState<zypp::Pattern >();
260 zyppPool().restoreState<zypp::Patch >();
262 yuiMilestone() <<
"Closing PackageSelector with \"Cancel\"" << std::endl;
263 YQUI::ui()->sendEvent(
new YCancelEvent() );
269 yuiMilestone() <<
"Returning to package selector" << std::endl;
279 bool confirmedAllLicenses;
289 }
while ( ! confirmedAllLicenses );
291 if ( _showChangesDialog )
297 + _(
"Automatic Changes" )
301 + _(
"In addition to your manual selections, the following packages" 302 " have been changed to resolve dependencies:" )
306 == QDialog::Rejected )
310 if ( confirmUnsupported() )
312 yuiMilestone() <<
"Confirm unsupported packages enabled." << std::endl;
318 + _(
"Unsupported Packages" )
322 + _(
"Please realize that the following selected software is either unsupported or" 323 " requires an additional customer contract for support." )
327 == QDialog::Rejected )
336 yuiMilestone() <<
"Closing PackageSelector with \"Accept\"" << std::endl;
337 YQUI::ui()->sendEvent(
new YMenuEvent(
"accept" ) );
343 yuiMilestone() <<
"Closing PackageSelector with \"RepoManager\"" << std::endl;
344 YQUI::ui()->sendEvent(
new YMenuEvent(
"repo_mgr" ) );
350 yuiMilestone() <<
"Closing PackageSelector with \"OnlineUpdateConfiguration\"" << std::endl;
351 YQUI::ui()->sendEvent(
new YMenuEvent(
"online_update_configuration" ) );
357 yuiMilestone() <<
"Showing all pending license agreements" << std::endl;
359 bool allConfirmed =
true;
361 if ( onlineUpdateMode() )
373 bool allConfirmed =
true;
375 for ( ZyppPoolIterator it = begin; it != end; ++it )
379 switch ( sel->status() )
386 if ( sel->candidateObj() )
388 string licenseText = sel->candidateObj()->licenseToConfirm();
390 if ( ! licenseText.empty() )
392 yuiMilestone() <<
"Resolvable " << sel->name() <<
" has a license agreement" << std::endl;
394 if( ! sel->hasLicenceConfirmed() )
396 yuiDebug() <<
"Showing license agreement for resolvable " << sel->name() << std::endl;
401 yuiMilestone() <<
"Resolvable " << sel->name()
402 <<
"'s license is already confirmed" << std::endl;
420 QMessageBox::information(
this,
"",
421 _(
"Not implemented yet. Sorry." ),
438 Qt::KeyboardModifiers special_combo = ( Qt::ControlModifier | Qt::ShiftModifier | Qt::AltModifier );
440 if ( ( event->modifiers() & special_combo ) == special_combo )
442 if ( event->key() == Qt::Key_A )
451 QWidget::keyPressEvent( event );
457 return max( 640, sizeHint().width() );
463 return max( 480, sizeHint().height() );
470 resize( newWidth, newHeight );
477 QWidget::setEnabled( enabled );
493 if ( event && event->eventType() == YEvent::CancelEvent
497 yuiMilestone() <<
"Caught WM_CLOSE from package selector dialog" << std::endl;
499 YUI::app()->normalCursor();
500 YUI_CHECK_WIDGET( _pkgSel );
503 bool reallyReject = _pkgSel->
reject();
506 if ( ! reallyReject )
509 yuiMilestone() <<
"User changed his mind - discarding CancelEvent" << std::endl;
int verifySystem()
Verifies dependencies of the currently installed system.
void onlineUpdateConfiguration()
Close processing and request start of the online update configuration.
YQPkgWarningRangeNotifier overflowWarning
Warning range notifier about disk space overflow warning.
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.
bool showLicenseAgreement()
Display this item's license agreement (if there is any) that corresponds to its current status (S_Ins...
virtual bool setKeyboardFocus()
Accept the keyboard focus.
bool inRange() const
Check if the value is in range, i.e.
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.
int verifySystem()
Run the package dependency solver for the currently installed system plus the packages that are marke...
virtual ~YQPackageSelectorBase()
Destructor.
static bool diskUsageWarning(const QString &message, int thresholdPercent, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null)
Static convenience method: Post a disk usage warning with text 'message', a list of partitions that a...
Helper class: Event filter for the WM_CLOSE event.
static bool showChangesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null, Filters f=FilterAutomatic, Options o=OptionAutoAcceptIfEmpty)
Static convenience method: Post a changes dialog with text 'message', a list of changed packages and ...
static void resetIgnoredDependencyProblems()
Reset all previously ignored dependency problems.
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.
static bool showUnsupportedPackagesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null, Filters f=FilterAutomatic, Options o=OptionAutoAcceptIfEmpty)
Static convenience method: Post a changes dialog with text 'message', a list of changed packages and ...
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.
int solveAndShowConflicts()
Run the package dependency solver for the current package set and open the conflict dialog if there a...