43 #define CHECK_DEPENDENCIES_ON_STARTUP 1
44 #define DEPENDENCY_FEEDBACK_IF_OK 1
45 #define AUTO_CHECK_DEPENDENCIES_DEFAULT true
46 #define ALWAYS_SHOW_PATCHES_VIEW_IF_PATCHES_AVAILABLE 0
47 #define GLOBAL_UPDATE_CONFIRMATION_THRESHOLD 20
48 #define ENABLE_SOURCE_RPMS 0
49 #define BRAINDEAD_LIB_NAMING_SCHEME 1
50 #define MARGIN 6 // around the widget
51 #define SPACING_BELOW_MENU_BAR 4
52 #define SPLITTER_HALF_SPACING 4
56 #include <boost/bind.hpp>
58 #include <QHBoxLayout>
59 #include <QVBoxLayout>
62 #include <QApplication>
65 #include <QFileDialog>
69 #include <QMessageBox>
70 #include <QPushButton>
77 #define YUILogComponent "qt-pkg"
80 #include "QY2LayoutUtils.h"
83 #include "YQPackageSelector.h"
84 #include "YQPkgChangeLogView.h"
85 #include "YQPkgChangesDialog.h"
86 #include "YQPkgConflictDialog.h"
87 #include "YQPkgConflictList.h"
88 #include "YQPkgDependenciesView.h"
89 #include "YQPkgDescriptionView.h"
90 #include "YQPkgDiskUsageList.h"
91 #include "YQPkgDiskUsageWarningDialog.h"
92 #include "YQPkgFileListView.h"
93 #include "YQPkgFilterTab.h"
94 #include "YQPkgHistoryDialog.h"
95 #include "YQPkgLangList.h"
96 #include "YQPkgList.h"
97 #include "YQPkgPackageKitGroupsFilterView.h"
98 #include "YQPkgPatchFilterView.h"
99 #include "YQPkgPatchList.h"
100 #include "YQPkgPatternList.h"
101 #include "YQPkgProductDialog.h"
102 #include "YQPkgRepoFilterView.h"
103 #include "YQPkgRepoList.h"
104 #include "YQPkgRpmGroupTagsFilterView.h"
105 #include "YQPkgSearchFilterView.h"
106 #include "YQPkgStatusFilterView.h"
107 #include "YQPkgTechnicalDetailsView.h"
108 #include "YQPkgTextDialog.h"
109 #include "YQPkgUpdateProblemFilterView.h"
110 #include "YQPkgVersionsView.h"
112 #include "zypp/SysContent.h"
113 #include "zypp/base/String.h"
115 #include "QY2ComboTabWidget.h"
116 #include "YQDialog.h"
117 #include "YQApplication.h"
130 #define DEFAULT_EXPORT_FILE_NAME "user-packages.xml"
131 #define FAST_SOLVER 1
133 #define SETTINGS_DIR "YaST2"
138 YQPackageSelector::YQPackageSelector( YWidget * parent,
142 _showChangesDialog =
true;
143 _autoDependenciesAction = 0;
147 _packageKitGroupsFilterView = 0;
148 _patchFilterView = 0;
151 _pkgChangeLogView = 0;
152 _pkgDependenciesView = 0;
153 _pkgDescriptionView = 0;
154 _pkgFileListView = 0;
156 _pkgTechnicalDetailsView = 0;
157 _pkgVersionsView = 0;
159 _rpmGroupTagsFilterView = 0;
160 _searchFilterView = 0;
161 _statusFilterView = 0;
162 _updateProblemFilterView = 0;
163 _excludeDevelPkgs = 0;
164 _excludeDebugInfoPkgs = 0;
166 yuiMilestone() <<
"This is libyui-qt-pkg " << VERSION << std::endl;
168 if ( onlineUpdateMode() ) yuiMilestone() <<
"Online update mode" << std::endl;
169 if ( updateMode() ) yuiMilestone() <<
"Update mode" << std::endl;
177 _filters->loadSettings();
178 bool pagesRestored = _filters->tabCount() > 0;
183 if ( ! pagesRestored )
185 yuiDebug() <<
"No page configuration saved, using fallbacks" << std::endl;
191 if ( _searchFilterView ) _filters->showPage( _searchFilterView );
193 if ( ! searchMode() && ! summaryMode()
194 && _patternList ) _filters->showPage( _patternList );
195 else if ( _rpmGroupTagsFilterView ) _filters->showPage( _rpmGroupTagsFilterView );
197 if ( _statusFilterView ) _filters->showPage( _statusFilterView );
205 if ( _patchFilterView && onlineUpdateMode() )
207 if ( _patchFilterView && _patchList )
209 _filters->showPage( _patchFilterView );
210 _patchList->filter();
213 else if ( _repoFilterView && repoMode() )
217 _filters->showPage( _repoFilterView );
218 _repoFilterView->filter();
221 else if ( _updateProblemFilterView )
223 _filters->showPage( _updateProblemFilterView );
224 _updateProblemFilterView->filter();
226 else if ( searchMode() && _searchFilterView )
228 _filters->showPage( _searchFilterView );
229 _searchFilterView->filter();
230 QTimer::singleShot( 0, _searchFilterView, SLOT( setFocus() ) );
232 else if ( summaryMode() && _statusFilterView )
234 _filters->showPage( _statusFilterView );
235 _statusFilterView->filter();
236 _pkgList->selectNextItem();
238 else if ( _patternList )
240 _filters->showPage( _patternList );
241 _patternList->filter();
245 if ( _filters->diskUsageList() )
246 _filters->diskUsageList()->updateDiskUsage();
248 yuiMilestone() <<
"PackageSelector init done" << std::endl;
251 #if CHECK_DEPENDENCIES_ON_STARTUP
257 QTimer::singleShot( 0,
this, SLOT( resolveDependencies() ) );
269 #define PREFIX "/usr/"
270 return zypp::str::form(
"%s/share/icons/hicolor/%dx%d/apps/%s.png",
271 PREFIX, size, size, name.c_str() );
276 YQPackageSelector::basicLayout()
278 QVBoxLayout *layout =
new QVBoxLayout();
280 layout->setContentsMargins( MARGIN,
284 layout->setSpacing( SPACING_BELOW_MENU_BAR );
285 layoutMenuBar(
this );
287 QString settingsName =
"YQPackageSelector";
289 if ( onlineUpdateMode() ) settingsName =
"YQOnlineUpdate";
290 if ( updateMode() ) settingsName =
"YQSystemUpdate";
293 YUI_CHECK_NEW( _filters );
295 layout->addWidget( _filters );
296 layoutFilters(
this );
297 layoutRightPane( _filters->
rightPane() );
302 YQPackageSelector::layoutFilters( QWidget *parent )
314 YUI_CHECK_NEW( _updateProblemFilterView );
315 _filters->
addPage( _(
"&Update Problems" ), _updateProblemFilterView,
"update_problems" );
324 if ( onlineUpdateMode()
325 #
if ALWAYS_SHOW_PATCHES_VIEW_IF_PATCHES_AVAILABLE
326 || ! zyppPool().empty<zypp::Patch>()
338 if ( ! zyppPool().empty<zypp::Pattern>() || testMode() )
341 YUI_CHECK_NEW( _patternList );
342 _filters->
addPage( _(
"Patter&ns" ), _patternList,
"patterns" );
344 connect( _patternList, SIGNAL( statusChanged() ),
347 connect(
this, SIGNAL(
refresh() ),
348 _patternList, SLOT ( updateItemStates() ) );
350 if ( _pkgConflictDialog )
352 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
353 _patternList, SLOT ( updateItemStates() ) );
363 YUI_CHECK_NEW( _packageKitGroupsFilterView );
364 _filters->
addPage( _(
"Package &Groups" ), _packageKitGroupsFilterView,
"package_groups" );
366 connect(
this, SIGNAL(
loadData() ),
367 _packageKitGroupsFilterView, SLOT ( filter() ) );
375 YUI_CHECK_NEW( _rpmGroupTagsFilterView );
376 _filters->
addPage( _(
"&RPM Groups" ), _rpmGroupTagsFilterView,
"rpm_groups" );
378 connect(
this, SIGNAL(
loadData() ),
379 _rpmGroupTagsFilterView, SLOT ( filter() ) );
387 YUI_CHECK_NEW( _langList );
389 _filters->
addPage( _(
"&Languages" ), _langList,
"languages" );
390 _langList->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ) );
392 connect( _langList, SIGNAL( statusChanged() ),
395 connect(
this, SIGNAL(
refresh() ),
396 _langList, SLOT ( updateItemStates() ) );
404 YUI_CHECK_NEW( _repoFilterView );
405 _filters->
addPage( _(
"&Repositories" ), _repoFilterView,
"repos" );
418 YUI_CHECK_NEW( _searchFilterView );
419 _filters->
addPage( _(
"S&earch" ), _searchFilterView,
"search" );
426 _filters->
addPage( _(
"&Keywords" ),
new QLabel(
"Keywords\nfilter\n\nfor future use",
this ),
"keywords" );
434 YUI_CHECK_NEW( _statusFilterView );
435 _filters->
addPage( _(
"&Installation Summary" ), _statusFilterView,
"inst_summary" );
439 YQPackageSelector::~YQPackageSelector()
445 YQPackageSelector::layoutRightPane( QWidget *parent )
447 QVBoxLayout *layout =
new QVBoxLayout( parent );
448 YUI_CHECK_NEW( layout );
449 layout->setContentsMargins( SPLITTER_HALF_SPACING,
454 QSplitter * splitter =
new QSplitter( Qt::Vertical, parent );
455 YUI_CHECK_NEW( splitter );
456 layout->addWidget(splitter);
458 layoutPkgList( splitter );
459 layoutDetailsViews( splitter );
460 layoutButtons( parent );
467 YQPackageSelector::layoutPkgList( QWidget *parent )
471 QWidget *_notificationsContainer =
new QWidget(parent);
472 QVBoxLayout *layout =
new QVBoxLayout(_notificationsContainer);
474 _repoUpgradingLabel =
new QLabel(_notificationsContainer);
475 _repoUpgradingLabel->setTextFormat(Qt::RichText);
476 _repoUpgradingLabel->setWordWrap(
true);
477 _repoUpgradingLabel->setVisible(
false);
479 _repoUpgradeLabel =
new QLabel(_notificationsContainer);
480 _repoUpgradeLabel->setTextFormat(Qt::RichText);
481 _repoUpgradeLabel->setWordWrap(
true);
482 _repoUpgradeLabel->setVisible(
false);
483 _repoUpgradeLabel->setObjectName(
"RepoUpgradeLabel");
485 layout->addWidget(_repoUpgradingLabel);
486 layout->addWidget(_repoUpgradeLabel);
498 YUI_CHECK_NEW( _pkgList );
500 connect( _pkgList, SIGNAL( statusChanged() ),
505 YQPackageSelector::layoutDetailsViews( QWidget *parent )
510 _detailsViews =
new QTabWidget( parent );
511 YUI_CHECK_NEW( _detailsViews );
518 YUI_CHECK_NEW( _pkgDescriptionView );
520 _detailsViews->addTab( _pkgDescriptionView, _(
"D&escription" ) );
521 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
523 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
524 _pkgDescriptionView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
531 YUI_CHECK_NEW( _pkgTechnicalDetailsView );
533 _detailsViews->addTab( _pkgTechnicalDetailsView, _(
"&Technical Data" ) );
535 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
536 _pkgTechnicalDetailsView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
544 YUI_CHECK_NEW( _pkgDependenciesView );
546 _detailsViews->addTab( _pkgDependenciesView, _(
"Dependencies" ) );
547 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
549 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
550 _pkgDependenciesView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
560 YUI_CHECK_NEW( _pkgVersionsView );
562 _detailsViews->addTab( _pkgVersionsView, _(
"&Versions" ) );
564 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
565 _pkgVersionsView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
567 connect( _pkgList, SIGNAL( statusChanged() ),
568 _pkgVersionsView, SLOT ( slotRefreshDetails() ) );
575 if ( haveInstalledPkgs )
578 YUI_CHECK_NEW( _pkgFileListView );
580 _detailsViews->addTab( _pkgFileListView, _(
"File List" ) );
581 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
583 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
584 _pkgFileListView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
592 if ( haveInstalledPkgs )
595 YUI_CHECK_NEW( _pkgChangeLogView );
597 _detailsViews->addTab( _pkgChangeLogView, _(
"Change Log" ) );
598 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
600 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
601 _pkgChangeLogView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
607 YQPackageSelector::layoutButtons( QWidget *parent )
609 QWidget * button_box =
new QWidget( parent );
610 YUI_CHECK_NEW( button_box );
611 parent->layout()->addWidget( button_box );
613 QHBoxLayout * layout =
new QHBoxLayout( button_box );
614 YUI_CHECK_NEW( layout );
616 button_box->setLayout( layout );
617 layout->setContentsMargins( 2,
622 layout->addStretch();
624 QPushButton * cancel_button =
new QPushButton( _(
"&Cancel" ), button_box );
625 YUI_CHECK_NEW( cancel_button );
626 layout->addWidget(cancel_button);
628 cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
630 connect( cancel_button, SIGNAL( clicked() ),
631 this, SLOT (
reject() ) );
634 QPushButton * accept_button =
new QPushButton( _(
"&Accept" ), button_box );
635 YUI_CHECK_NEW( accept_button );
636 layout->addWidget(accept_button);
637 accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
639 connect( accept_button, SIGNAL( clicked() ),
640 this, SLOT (
accept() ) );
642 button_box->setFixedHeight( button_box->sizeHint().height() );
647 YQPackageSelector::layoutMenuBar( QWidget *parent )
649 _menuBar =
new QMenuBar( parent );
650 YUI_CHECK_NEW( _menuBar );
651 parent->layout()->addWidget(_menuBar);
674 _fileMenu =
new QMenu( _menuBar );
675 YUI_CHECK_NEW( _fileMenu );
676 QAction * action = _menuBar->addMenu( _fileMenu );
677 action->setText( _(
"&File" ));
679 _fileMenu->addAction( _(
"&Import..." ),
this, SLOT(
pkgImport() ) );
680 _fileMenu->addAction( _(
"&Export..." ),
this, SLOT(
pkgExport() ) );
682 _fileMenu->addSeparator();
684 _fileMenu->addAction( _(
"E&xit -- Discard Changes" ),
this, SLOT(
reject() ) );
685 _fileMenu->addAction( _(
"&Quit -- Save Changes" ),
this, SLOT(
accept() ) );
694 _pkgMenu =
new QMenu( _menuBar );
695 YUI_CHECK_NEW( _pkgMenu );
696 action = _menuBar->addMenu( _pkgMenu );
697 action->setText(_(
"&Package" ));
699 _pkgMenu->addAction(_pkgList->actionSetCurrentInstall);
700 _pkgMenu->addAction(_pkgList->actionSetCurrentDontInstall);
701 _pkgMenu->addAction(_pkgList->actionSetCurrentKeepInstalled);
702 _pkgMenu->addAction(_pkgList->actionSetCurrentDelete);
703 _pkgMenu->addAction(_pkgList->actionSetCurrentUpdate);
704 _pkgMenu->addAction(_pkgList->actionSetCurrentUpdateForce);
705 _pkgMenu->addAction(_pkgList->actionSetCurrentTaboo);
706 _pkgMenu->addAction(_pkgList->actionShowCurrentSolverInfo);
708 #if ENABLE_SOURCE_RPMS
709 _pkgMenu->addSeparator();
711 _pkgMenu->addAction(_pkgList->actionInstallSourceRpm);
712 _pkgMenu->addAction(_pkgList->actionDontInstallSourceRpm);
715 _pkgMenu->addSeparator();
717 YUI_CHECK_NEW( submenu );
719 #if ENABLE_SOURCE_RPMS
720 submenu->addSeparator();
722 _pkgMenu->addAction(_pkgList->actionInstallListSourceRpms);
723 _pkgMenu->addAction(_pkgList->actionDontInstallListSourceRpms);
730 submenu =
new QMenu( _pkgMenu );
731 YUI_CHECK_NEW( submenu );
736 action = _pkgMenu->addMenu( submenu );
737 action->setText(_(
"All Packages" ));
739 submenu->addAction( _(
"Update if newer version available" ),
742 submenu->addAction( _(
"Update unconditionally" ),
753 _patchMenu =
new QMenu( _menuBar );
754 YUI_CHECK_NEW( _patchMenu );
755 action = _menuBar->addMenu( _patchMenu );
756 action->setText(_(
"&Patch" ));
758 _patchMenu->addAction(_patchList->actionSetCurrentInstall);
759 _patchMenu->addAction(_patchList->actionSetCurrentDontInstall);
760 _patchMenu->addAction(_patchList->actionSetCurrentKeepInstalled);
762 #if ENABLE_DELETING_PATCHES
763 _patchMenu->addAction(_patchList->actionSetCurrentDelete);
765 _patchMenu->addAction(_patchList->actionSetCurrentUpdate);
766 _patchMenu->addAction(_patchList->actionSetCurrentUpdateForce);
767 _patchMenu->addAction(_patchList->actionSetCurrentTaboo);
769 _patchMenu->addSeparator();
778 if ( repoMgrEnabled() )
780 _configMenu =
new QMenu( _menuBar );
781 YUI_CHECK_NEW( _configMenu );
782 action = _menuBar->addMenu( _configMenu );
783 action->setText(_(
"Confi&guration" ));
784 _configMenu->addAction( _(
"&Repositories..." ),
this, SLOT(
repoManager() ), Qt::CTRL + Qt::Key_R );
792 _dependencyMenu =
new QMenu( _menuBar );
793 YUI_CHECK_NEW( _dependencyMenu );
794 action = _menuBar->addMenu( _dependencyMenu );
795 action->setText(_(
"&Dependencies" ));
798 _autoDependenciesAction =
new QAction( _(
"&Autocheck" ),
this );
799 _autoDependenciesAction->setCheckable(
true );
800 _dependencyMenu->addAction( _autoDependenciesAction );
807 _optionsMenu =
new QMenu( _menuBar );
808 YUI_CHECK_NEW( _optionsMenu );
809 action = _menuBar->addMenu( _optionsMenu );
811 action->setText(_(
"&Options" ));
814 _showDevelAction = _optionsMenu->addAction( _(
"Show -de&vel Packages" ),
815 this, SLOT( pkgExcludeDevelChanged(
bool ) ), Qt::Key_F7 );
816 _showDevelAction->setCheckable(
true);
818 _excludeDevelPkgs =
new YQPkgObjList::ExcludeRule( _pkgList, QRegExp(
".*(\\d+bit)?-devel(-\\d+bit)?$" ), _pkgList->nameCol() );
819 YUI_CHECK_NEW( _excludeDevelPkgs );
820 _excludeDevelPkgs->
enable(
false );
823 _showDebugAction = _optionsMenu->addAction( _(
"Show -&debuginfo/-debugsource Packages" ),
825 _showDebugAction->setCheckable(
true);
826 _excludeDebugInfoPkgs =
new YQPkgObjList::ExcludeRule( _pkgList, QRegExp(
".*(-\\d+bit)?-(debuginfo|debugsource)(-32bit)?$" ), _pkgList->nameCol() );
827 YUI_CHECK_NEW( _excludeDebugInfoPkgs );
828 _excludeDebugInfoPkgs->
enable(
false );
831 _verifySystemModeAction = _optionsMenu->addAction( _(
"&System Verification Mode" ),
832 this, SLOT( pkgVerifySytemModeChanged(
bool ) ) );
833 _verifySystemModeAction->setCheckable(
true);
836 _ignoreAlreadyRecommendAction = _optionsMenu->addAction( _(
"&Ignore Recommended Packages for Already Installed Packages" ),
837 this, SLOT( pkgIgnoreAlreadyRecommendedChanged(
bool ) ) );
838 _ignoreAlreadyRecommendAction->setCheckable(
true);
842 _cleanDepsOnRemoveAction = _optionsMenu->addAction( _(
"&Cleanup when deleting packages" ),
843 this, SLOT( pkgCleanDepsOnRemoveChanged(
bool ) ) );
844 _cleanDepsOnRemoveAction->setCheckable(
true);
846 _allowVendorChangeAction = _optionsMenu->addAction( _(
"&Allow vendor change" ),
847 this, SLOT( pkgAllowVendorChangeChanged(
bool ) ) );
848 _allowVendorChangeAction->setCheckable(
true);
856 _extrasMenu =
new QMenu( _menuBar );
857 YUI_CHECK_NEW( _extrasMenu );
858 action = _menuBar->addMenu( _extrasMenu );
859 action->setText(_(
"E&xtras" ));
861 _extrasMenu->addAction( _(
"Show &Products" ),
this, SLOT(
showProducts() ) );
862 _extrasMenu->addAction( _(
"Show P&ackage Changes" ),
this, SLOT(
showAutoPkgList() ), Qt::CTRL + Qt::Key_A );
863 _extrasMenu->addAction( _(
"Show &History" ),
this, SLOT(
showHistory() ) );
865 _extrasMenu->addSeparator();
867 #if BRAINDEAD_LIB_NAMING_SCHEME
871 _extrasMenu->addAction( _(
"Install All Matching -&devel Packages" ),
this, SLOT(
installDevelPkgs() ) );
875 _extrasMenu->addAction( _(
"Install All Matching -de&buginfo Packages" ),
this, SLOT(
installDebugInfoPkgs() ) );
878 _extrasMenu->addAction( _(
"Install All Matching -debug&source Packages" ),
this, SLOT(
installDebugSourcePkgs() ) );
880 _extrasMenu->addSeparator();
882 if ( _pkgConflictDialog )
883 _extrasMenu->addAction( _(
"Generate Dependency Resolver &Test Case" ),
884 _pkgConflictDialog, SLOT( askCreateSolverTestCase() ) );
886 if ( _actionResetIgnoredDependencyProblems )
887 _extrasMenu->addAction(_actionResetIgnoredDependencyProblems);
891 _extrasMenu->addAction(_patchList->actionShowRawPatchInfo);
899 _helpMenu =
new QMenu( _menuBar );
900 YUI_CHECK_NEW( _helpMenu );
901 _menuBar->addSeparator();
902 action = _menuBar->addMenu( _helpMenu );
903 action->setText(_(
"&Help" ));
909 _helpMenu->addAction( _(
"&Overview" ),
this, SLOT(
help() ), Qt::Key_F1 );
912 _helpMenu->addAction( _(
"&Symbols" ),
this, SLOT(
symbolHelp() ), Qt::SHIFT + Qt::Key_F1 );
915 _helpMenu->addAction( _(
"&Keys" ),
this, SLOT(
keyboardHelp() ) );
922 bool hasUpdateSignal )
924 if ( ! filter )
return;
925 if ( ! pkgList )
return;
929 connect( _filters, SIGNAL( currentChanged(QWidget *) ),
930 filter, SLOT ( filterIfVisible() ) );
933 connect(
this, SIGNAL(
refresh() ),
934 filter, SLOT ( filterIfVisible() ) );
936 connect( filter, SIGNAL( filterStart() ),
937 pkgList, SLOT ( clear() ) );
939 connect( filter, SIGNAL( filterMatch( ZyppSel, ZyppPkg ) ),
940 pkgList, SLOT ( addPkgItem ( ZyppSel, ZyppPkg ) ) );
942 connect( filter, SIGNAL( filterFinished() ),
943 pkgList, SLOT ( resort() ) );
945 connect( filter, SIGNAL( filterFinished() ),
946 pkgList, SLOT ( selectSomething() ) );
948 connect( filter, SIGNAL( filterFinished() ),
949 pkgList, SLOT ( logExcludeStatistics() ) );
951 connect( filter, SIGNAL( filterFinished() ),
952 pkgList, SLOT ( setFocus() ) );
957 connect( filter, SIGNAL( updatePackages() ),
958 pkgList, SLOT ( updateItemStates() ) );
962 connect( filter, SIGNAL( updatePackages() ),
976 connectFilter( _packageKitGroupsFilterView, _pkgList,
false );
984 if ( _searchFilterView && _pkgList )
986 connect( _searchFilterView, SIGNAL( message(
const QString & ) ),
987 _pkgList, SLOT ( message(
const QString & ) ) );
990 if ( _repoFilterView && _pkgList )
992 connect( _repoFilterView, SIGNAL( filterNearMatch ( ZyppSel, ZyppPkg ) ),
993 _pkgList, SLOT ( addPkgItemDimmed ( ZyppSel, ZyppPkg ) ) );
999 connect( _pkgList, SIGNAL( statusChanged() ),
1011 if ( _pkgConflictDialog )
1015 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1016 _pkgList, SLOT ( updateItemStates() ) );
1021 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1022 _patternList, SLOT ( updateItemStates() ) );
1028 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1038 if ( _pkgVersionsView && _pkgList )
1040 connect( _pkgVersionsView, SIGNAL( candidateChanged( ZyppObj ) ),
1041 _pkgList, SLOT ( updateItemData() ) );
1043 connect( _pkgVersionsView, SIGNAL( multiversionSelectionChanged( ) ),
1044 _pkgList, SLOT ( updateItemData() ) );
1053 YUI_CHECK_NEW( accel );
1059 if ( _pkgMenu && _pkgList )
1061 connect( _pkgMenu, SIGNAL( aboutToShow() ),
1062 _pkgList, SLOT ( updateActions() ) );
1065 if ( _patchMenu && _patchList )
1067 connect( _patchMenu, SIGNAL( aboutToShow() ),
1068 _patchList, SLOT ( updateActions() ) );
1076 if ( _autoDependenciesAction && ! _autoDependenciesAction->isChecked() )
1086 if ( ! _pkgConflictDialog )
1088 yuiError() <<
"No package conflict dialog existing" << std::endl;
1089 return QDialog::Accepted;
1092 YQUI::ui()->busyCursor();
1094 YQUI::ui()->normalCursor();
1096 #if DEPENDENCY_FEEDBACK_IF_OK
1098 if ( result == QDialog::Accepted )
1100 QMessageBox::information(
this,
"",
1101 _(
"All package dependencies are OK." ),
1113 if ( ! _patchFilterView )
1116 YUI_CHECK_NEW( _patchFilterView );
1117 _filters->
addPage( _(
"P&atches" ), _patchFilterView,
"patches" );
1119 _patchList = _patchFilterView->
patchList();
1120 YUI_CHECK_PTR( _patchList );
1130 if ( ! _patchFilterView )
1132 yuiMilestone() <<
"Activating patches filter view" << std::endl;
1137 _filters->
showPage( _patchFilterView );
1143 _filters->
showPage( _patchFilterView );
1151 if ( _pkgList && _patchList )
1155 connect( _patchList, SIGNAL( filterMatch (
const QString &,
const QString &, FSize ) ),
1156 _pkgList, SLOT ( addPassiveItem(
const QString &,
const QString &, FSize ) ) );
1158 connect( _patchList, SIGNAL( statusChanged() ),
1161 if ( _pkgConflictDialog )
1163 connect( _pkgConflictDialog,SIGNAL( updatePackages() ),
1164 _patchList, SLOT ( updateItemStates() ) );
1167 connect(
this, SIGNAL(
refresh() ),
1168 _patchList, SLOT ( updateItemStates() ) );
1177 QString filename = YQApplication::askForSaveFileName( QString( DEFAULT_EXPORT_FILE_NAME ),
1178 QString(
"*.xml;;*" ),
1179 _(
"Save Package List" ) );
1181 if ( ! filename.isEmpty() )
1183 zypp::syscontent::Writer writer;
1184 const zypp::ResPool & pool = zypp::getZYpp()->pool();
1188 for_each( pool.begin(), pool.end(),
1189 boost::bind( &zypp::syscontent::Writer::addIf,
1190 boost::ref( writer ),
1202 std::ofstream exportFile( toUTF8( filename ).c_str() );
1203 exportFile.exceptions( std::ios_base::badbit | std::ios_base::failbit );
1204 exportFile << writer;
1206 yuiMilestone() <<
"Package list exported to " << filename << std::endl;
1208 catch ( std::exception & exception )
1210 yuiWarning() <<
"Error exporting package list to " << filename << std::endl;
1214 QFile::remove(filename);
1217 QMessageBox::warning(
this,
1219 _(
"Error exporting package list to %1" ).arg( filename ),
1220 QMessageBox::Ok | QMessageBox::Default,
1231 QString filename = QFileDialog::getOpenFileName(
this, _(
"Load Package List" ), DEFAULT_EXPORT_FILE_NAME,
1235 if ( ! filename.isEmpty() )
1237 yuiMilestone() <<
"Importing package list from " << filename << std::endl;
1241 std::ifstream importFile( toUTF8( filename ).c_str() );
1242 zypp::syscontent::Reader reader( importFile );
1248 typedef zypp::syscontent::Reader::Entry ZyppReaderEntry;
1249 typedef std::pair<string, ZyppReaderEntry> ImportMapPair;
1251 map<string, ZyppReaderEntry> importPkg;
1252 map<string, ZyppReaderEntry> importPatterns;
1254 for ( zypp::syscontent::Reader::const_iterator it = reader.begin();
1258 string kind = it->kind();
1260 if ( kind ==
"package" ) importPkg.insert ( ImportMapPair( it->name(), *it ) );
1261 else if ( kind ==
"pattern" ) importPatterns.insert( ImportMapPair( it->name(), *it ) );
1264 yuiDebug() <<
"Found " << importPkg.size()
1265 <<
" packages and " << importPatterns.size()
1266 <<
" patterns in " << filename
1274 for ( ZyppPoolIterator it = zyppPatternsBegin();
1275 it != zyppPatternsEnd();
1278 ZyppSel selectable = *it;
1279 importSelectable( *it, importPatterns.find( selectable->name() ) != importPatterns.end(),
"pattern" );
1282 for ( ZyppPoolIterator it = zyppPkgBegin();
1286 ZyppSel selectable = *it;
1287 importSelectable( *it, importPkg.find( selectable->name() ) != importPkg.end(),
"package" );
1297 if ( _statusFilterView )
1301 _filters->
showPage( _statusFilterView );
1302 _statusFilterView->
filter();
1306 catch (
const zypp::Exception & exception )
1308 yuiWarning() <<
"Error reading package list from " << filename << std::endl;
1311 QMessageBox::warning(
this,
1313 _(
"Error loading package list from %1" ).arg( filename ),
1314 QMessageBox::Ok | QMessageBox::Default,
1315 QMessageBox::NoButton,
1316 QMessageBox::NoButton );
1327 ZyppStatus oldStatus = selectable->status();
1328 ZyppStatus newStatus = oldStatus;
1336 switch ( oldStatus )
1340 case S_KeepInstalled:
1344 newStatus = oldStatus;
1349 newStatus = S_KeepInstalled;
1350 yuiDebug() <<
"Keeping " << kind <<
" " << selectable->name() << std::endl;
1356 if ( selectable->hasCandidateObj() )
1358 newStatus = S_Install;
1359 yuiDebug() <<
"Adding " << kind <<
" " << selectable->name() << std::endl;
1363 yuiDebug() <<
"Can't add " << kind <<
" " << selectable->name()
1364 <<
": No candidate" << std::endl;
1375 switch ( oldStatus )
1379 case S_KeepInstalled:
1384 yuiDebug() <<
"Deleting " << kind <<
" " << selectable->name() << std::endl;
1391 newStatus = oldStatus;
1396 if ( oldStatus != newStatus )
1397 selectable->setStatus( newStatus );
1409 yuiMilestone() << count <<
" pkgs found for update" << std::endl;
1411 if ( count >= GLOBAL_UPDATE_CONFIRMATION_THRESHOLD )
1413 if ( QMessageBox::question(
this,
"",
1415 _(
"%1 packages will be updated" ).arg( count ),
1416 _(
"&Continue" ), _(
"C&ancel" ),
1428 if ( _statusFilterView )
1430 _filters->
showPage( _statusFilterView );
1431 _statusFilterView->
clear();
1433 _statusFilterView->
filter();
1440 zypp::ResPool::repository_iterator it;
1441 _repoUpgradeLabel->setText(
"");
1442 _repoUpgradingLabel->setText(
"");
1446 for ( it = zypp::getZYpp()->pool().knownRepositoriesBegin();
1447 it != zypp::getZYpp()->pool().knownRepositoriesEnd();
1450 zypp::Repository repo(*it);
1453 if ( zypp::getZYpp()->resolver()->upgradingRepo(repo) )
1455 _repoUpgradingLabel->setText(_repoUpgradingLabel->text() + _(
"<p><small><a href=\"repoupgraderemove:///%1\">Cancel switching</a> system packages to versions in repository %2</small></p>")
1456 .arg(fromUTF8(repo.alias().c_str()))
1457 .arg(fromUTF8(repo.name().c_str()))
1462 for ( it = zypp::getZYpp()->pool().knownRepositoriesBegin();
1463 it != zypp::getZYpp()->pool().knownRepositoriesEnd();
1466 zypp::Repository repo(*it);
1470 if ( ! zypp::getZYpp()->resolver()->upgradingRepo(repo) &&
1471 ! repo.isSystemRepo() &&
1474 _repoUpgradeLabel->setText(_repoUpgradeLabel->text() + _(
"<p><a href=\"repoupgradeadd:///%1\">Switch system packages</a> to the versions in this repository (%2)</p>")
1475 .arg(fromUTF8(repo.alias().c_str()))
1476 .arg(fromUTF8(repo.name().c_str()))
1480 _repoUpgradeLabel->setVisible(!_repoUpgradeLabel->text().isEmpty() &&
1481 _repoFilterView->isVisible() );
1482 _repoUpgradingLabel->setVisible(!_repoUpgradingLabel->text().isEmpty());
1488 yuiDebug() <<
"link " << link <<
" clicked on label" << std::endl;
1491 if (url.scheme() ==
"repoupgradeadd")
1493 yuiDebug() <<
"looking for repo " << url.path() << std::endl;
1494 std::string alias(url.path().remove(0,1).toStdString());
1495 zypp::Repository repo(zypp::getZYpp()->pool().reposFind(alias));
1496 yuiDebug() << repo << std::endl;
1498 if ( repo != zypp::Repository::noRepository )
1499 zypp::getZYpp()->resolver()->addUpgradeRepo(repo);
1501 else if (url.scheme() ==
"repoupgraderemove")
1503 std::string alias(url.path().remove(0,1).toStdString());
1504 zypp::Repository repo(zypp::getZYpp()->pool().reposFind(alias));
1506 if ( repo != zypp::Repository::noRepository )
1507 zypp::getZYpp()->resolver()->removeUpgradeRepo(repo);
1510 yuiDebug() <<
"unknown link operation " << url.scheme() << std::endl;
1553 if ( _optionsMenu && _pkgList )
1555 if ( _excludeDebugInfoPkgs )
1556 _excludeDebugInfoPkgs->
enable( ! on );
1564 YQPackageSelector::pkgExcludeDevelChanged(
bool on )
1566 if ( _optionsMenu && _pkgList )
1568 if ( _excludeDevelPkgs )
1569 _excludeDevelPkgs->
enable( ! on );
1577 YQPackageSelector::pkgVerifySytemModeChanged(
bool on )
1579 zypp::getZYpp()->resolver()->setSystemVerification( on );
1583 YQPackageSelector::pkgIgnoreAlreadyRecommendedChanged(
bool on )
1585 zypp::getZYpp()->resolver()->setIgnoreAlreadyRecommended( on );
1590 YQPackageSelector::pkgCleanDepsOnRemoveChanged(
bool on )
1592 zypp::getZYpp()->resolver()->setCleandepsOnRemove( on );
1598 YQPackageSelector::pkgAllowVendorChangeChanged(
bool on )
1600 zypp::getZYpp()->resolver()->setAllowVendorChange( on );
1611 QMap<QString, ZyppSel> subPkgs;
1613 for ( ZyppPoolIterator it = zyppPkgBegin();
1617 QString name = (*it)->name().c_str();
1619 if ( name.endsWith( suffix ) || name.endsWith( suffix +
"-32bit" ) )
1621 subPkgs[ name ] = *it;
1623 yuiDebug() <<
"Found subpackage: " << name << std::endl;
1630 for ( ZyppPoolIterator it = zyppPkgBegin();
1634 QString name = (*it)->name().c_str();
1636 if ( subPkgs.contains( name + suffix ) )
1638 QString subPkgName( name + suffix );
1639 ZyppSel subPkg = subPkgs[ subPkgName ];
1641 switch ( (*it)->status() )
1649 yuiMilestone() <<
"Ignoring unwanted subpackage " << subPkgName << std::endl;
1654 case S_KeepInstalled:
1658 if ( ! subPkg->installedObj() )
1660 subPkg->setStatus( S_Install );
1661 yuiMilestone() <<
"Installing subpackage " << subPkgName << std::endl;
1671 if ( ! subPkg->installedObj() )
1673 subPkg->setStatus( S_Install );
1674 yuiMilestone() <<
"Installing subpackage " << subPkgName << std::endl;
1678 subPkg->setStatus( S_Update );
1679 yuiMilestone() <<
"Updating subpackage " << subPkgName << std::endl;
1690 if ( _filters && _statusFilterView )
1692 _filters->
showPage( _statusFilterView );
1693 _statusFilterView->
filter();
1697 _(
"Added Subpackages:" ),
1698 QRegExp(
".*" + suffix +
"$" ),
1701 YQPkgChangesDialog::FilterAutomatic,
1702 YQPkgChangesDialog::OptionNone );
1708 QString settingsName =
"YQPackageSelector";
1709 if ( onlineUpdateMode() ) settingsName =
"YQOnlineUpdate";
1710 if ( updateMode() ) settingsName =
"YQSystemUpdate";
1712 QSettings settings( QSettings::UserScope, SETTINGS_DIR, settingsName );
1714 _autoDependenciesAction->setChecked( settings.value(
"Options/AutocheckDependencies",
1715 AUTO_CHECK_DEPENDENCIES_DEFAULT ).toBool() ) ;
1717 _showDevelAction->setChecked(settings.value(
"Options/showDevelPackages",
true).toBool());
1718 pkgExcludeDevelChanged(_showDevelAction->isChecked());
1720 _showDebugAction->setChecked(settings.value(
"Options/showDebugPackages",
true).toBool());
1723 _verifySystemModeAction->setChecked( settings.value(
"Options/systemVerificationMode",
1724 zypp::getZYpp()->resolver()->systemVerification() ).toBool() );
1725 pkgVerifySytemModeChanged ( _verifySystemModeAction->isChecked() );
1727 _ignoreAlreadyRecommendAction->setChecked(
1728 settings.value(
"Options/IgnoreRecommendedPackagesForAlreadyInstalledPackages",
1729 zypp::getZYpp()->resolver()->ignoreAlreadyRecommended() ).toBool() );
1730 pkgIgnoreAlreadyRecommendedChanged(_ignoreAlreadyRecommendAction->isChecked());
1733 _cleanDepsOnRemoveAction->setChecked( settings.value(
"Options/CleanupWhenDeletingPackages",
1734 zypp::getZYpp()->resolver()->cleandepsOnRemove()).toBool() );
1735 pkgCleanDepsOnRemoveChanged(_cleanDepsOnRemoveAction->isChecked());
1737 _allowVendorChangeAction->setChecked( settings.value(
"Options/AllowVendorChange",
1738 zypp::getZYpp()->resolver()->allowVendorChange() ).toBool() );
1739 pkgAllowVendorChangeChanged(_allowVendorChangeAction->isChecked());
1748 QString settingsName =
"YQPackageSelector";
1749 if ( onlineUpdateMode() ) settingsName =
"YQOnlineUpdate";
1750 if ( updateMode() ) settingsName =
"YQSystemUpdate";
1752 QSettings settings( QSettings::UserScope, SETTINGS_DIR, settingsName );
1754 settings.setValue(
"Options/AutocheckDependencies", _autoDependenciesAction->isChecked() );
1755 settings.setValue(
"Options/showDevelPackages", _showDevelAction->isChecked() );
1756 settings.setValue(
"Options/showDebugPackages", _showDebugAction->isChecked() );
1757 settings.setValue(
"Options/systemVerificationMode", _verifySystemModeAction->isChecked() );
1758 settings.setValue(
"Options/IgnoreRecommendedPackagesForAlreadyInstalledPackages", _ignoreAlreadyRecommendAction->isChecked() );
1759 settings.setValue(
"Options/CleanupWhenDeletingPackages", _cleanDepsOnRemoveAction->isChecked() );
1760 settings.setValue(
"Options/AllowVendorChange", _allowVendorChangeAction->isChecked() );
1764 #include "YQPackageSelector.moc"
Display the description of a ZyppObj derived object along with its name and summary.
void onlineUpdateConfiguration()
Close processing and request start of the online update configuration.
void addPatchFilterView()
Add the "Patches" filter view, if it is not already there.
void showPage(QWidget *page)
Show a page.
QWidget * rightPane() const
Return the right pane.
int globalSetPkgStatus(ZyppStatus newStatus, bool force, bool countOnly)
Set the status of all packages in the pool to a new value.
void loadData()
Emitted once (!) when the dialog is about to be shown, when all widgets are created and all signal/sl...
void globalUpdatePkg()
Set the status of all installed packages (all in the pool, not only those currently displayed in the ...
void connectFilter(QWidget *filter, QWidget *pkgList, bool hasUpdateSignal=true)
Connect a filter view that provides the usual signals with a package list.
void addPage(const QString &pageLabel, QWidget *pageContent, const QString &internalName)
Add a page with a user-visible "pageLabel", a widget with the page content and an internal name (or I...
Filter view for PackageKit groups.
static int countEnabledRepositories()
Returns the number of enabled repositories.
YQPkgDiskUsageList * diskUsageList() const
Return the disk usage list widget or 0 if there is none.
void showProducts()
Show all products in a popup dialog.
Filter view for packages that made problems during update.
void filter()
Filter according to the view's rules and current selection.
Widget for "tabbed browsing" in packages:
static bool haveInstalledPkgs()
Returns 'true' if there are any installed packages.
void importSelectable(ZyppSel selectable, bool isWanted, const char *kind)
Import one selectable: Set its status according to 'isWanted' based on its old status.
void updateRepositoryUpgradeLabel()
hides or shows the repository upgrade message
void currentChanged(QWidget *newPageContent)
Emitted when the current page changes.
void saveSettings()
saves settings of the checkboxes in the option menu
int manualResolvePackageDependencies()
Resolve package dependencies manually.
void keyboardHelp()
Display online help about magic keys.
void enable(bool enable=true)
Enable or disable this exclude rule.
void accept()
Close processing and accept changes.
Display a list of zypp::Patch objects and ( below ) details about the currently selected patch...
void slotRepoUpgradeLabelLinkClicked(const QString &link)
a link in the repo upgrade label was clicked
void repoManager()
Close processing and request start of the repository manager.
Display a pkg's file list.
static std::string iconPath(const std::string &name, int size)
returns the full path for an icon of a given size
Display a list of zypp::Package objects.
Display a list of zypp::Pattern objects.
Filter view for searching within packages.
void symbolHelp()
Display online help about symbols (package status icons).
void installDebugInfoPkgs()
Install available -debuginfo packages for packages that are installed or marked for installation...
void connectPatchList()
Connect the patch list.
Display technical details (very much like 'rpm -qi') for a ZYPP object - the installed instance...
void clear()
Clears the tree-widgets content, resets the optimal column width values.
void pkgExport()
Export all current selection/package states.
void applyExcludeRules()
Apply all exclude rules of this list to all items, including those that are currently excluded...
Filter view for packages that made problems during update.
void help()
Display (generic) online help.
Package version selector: Display a list of available versions from all the different installation so...
void autoResolveDependencies()
Automatically resolve package dependencies if desired (if the "auto check" checkbox is on)...
static bool haveProblematicPackages()
Check if there are any problematic packages at all, i.e.
void addMenus()
Add pulldown menus to the menu bar.
Display a list of zypp::Selection objects.
void clear()
Reset all check boxes (set them all to "off")
void installDevelPkgs()
Install any -devel package for packages that are installed or marked for installation.
void loadSettings()
loads settings for the checkboxes in the option menu
static void showHistoryDialog(QWidget *parent=0)
Static convenience method: Post a History dialog for pkg 'pkgName'.
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 ...
void showTransactions()
Set up the check boxes so all pending transactions are displayed.
void refresh()
Emitted when the internal data base might have changed and a refresh of all displayed data might be n...
virtual QMenu * addAllInListSubMenu(QMenu *menu)
Add a submenu "All in this list..." to 'menu'.
void installDebugSourcePkgs()
Install available -debugsource packages for packages that are installed or marked for installation...
virtual QMenu * addAllInListSubMenu(QMenu *menu)
Add a submenu "All in this list..." to 'menu'.
YQPkgPatchList * patchList() const
Returns this view's selections list.
Abstract base class for package selectors.
static void showProductDialog(QWidget *parent=0)
Static convenience method: Post a dialog with all products.
void filter()
Filter according to the view's rules and current selection.
void hotkeyInsertPatchFilterView()
Add the "Patches" filter view upon hotkey (F2).
void installSubPkgs(const QString &suffix)
Install any subpackage that ends with 'suffix' for packages that are installed or marked for installa...
void makeConnections()
Establish Qt signal / slot connections.
Display technical details ( very much like 'rpm -qi' ) for a zypp::Package object - the installed ins...
void showHistory()
Show dialog for pkgmgr history.
void showAutoPkgList()
Display a list of automatically selected packages (excluding packages contained in any selections tha...
void pkgImport()
Import selection/package states.
bool reject()
Close processing and abandon changes.
int resolveDependencies()
Resolve dependencies (unconditionally) for all resolvables.
void pkgExcludeDebugChanged(bool on)
Enable or disable the package exclude rules (show or suppress -debuginfo or -devel packages) accordin...
int solveAndShowConflicts()
Run the package dependency solver for the current package set and open the conflict dialog if there a...
void globalUpdatePkgForce()
Set the status of all installed packages (all in the pool, not only those currently displayed in the ...
Display a pkg's file list.
zypp::Repository selectedRepo() const
Current selected repository, or if nothing is selected.