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, SIGNAL( activated() ),
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 _(
"Abandon all changes?" ),
249 _(
"&Abandon" ), _(
"&Cancel" ),
"",
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;
517 #include "YQPackageSelectorBase.moc"
void onlineUpdateConfiguration()
YQPkgWarningRangeNotifier overflowWarning
void resetIgnoredDependencyProblems()
bool showPendingLicenseAgreements()
virtual void setEnabling(bool enabled)
bool showLicenseAgreement()
virtual bool setKeyboardFocus()
virtual YEvent * filter(YEvent *event)
virtual ~YQPackageSelectorBase()
static bool diskUsageWarning(const QString &message, int thresholdPercent, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null)
static bool showChangesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null, Filters f=FilterAutomatic, Options o=OptionAutoAcceptIfEmpty)
static void resetIgnoredDependencyProblems()
virtual void setSize(int newWidth, int newHeight)
virtual void keyPressEvent(QKeyEvent *ev)
virtual int preferredWidth()
YQPackageSelectorBase(YWidget *parent, long modeFlags=0)
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)
virtual int preferredHeight()
int resolveDependencies()
int solveAndShowConflicts()