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
57 #include <boost/bind.hpp>
59 #include <QHBoxLayout>
60 #include <QVBoxLayout>
63 #include <QApplication>
66 #include <QFileDialog>
70 #include <QMessageBox>
71 #include <QPushButton>
78 #define YUILogComponent "qt-pkg"
81 #include "QY2LayoutUtils.h"
84 #include "YQPackageSelector.h"
85 #include "YQPkgChangeLogView.h"
86 #include "YQPkgChangesDialog.h"
87 #include "YQPkgConflictDialog.h"
88 #include "YQPkgConflictList.h"
89 #include "YQPkgDependenciesView.h"
90 #include "YQPkgDescriptionView.h"
91 #include "YQPkgDiskUsageList.h"
92 #include "YQPkgDiskUsageWarningDialog.h"
93 #include "YQPkgFileListView.h"
94 #include "YQPkgFilterTab.h"
95 #include "YQPkgHistoryDialog.h"
96 #include "YQPkgLangList.h"
97 #include "YQPkgList.h"
98 #include "YQPkgClassFilterView.h"
99 #include "YQPkgPatchFilterView.h"
100 #include "YQPkgPatchList.h"
101 #include "YQPkgPatternList.h"
102 #include "YQPkgProductDialog.h"
103 #include "YQPkgRepoFilterView.h"
104 #include "YQPkgRepoList.h"
105 #include "YQPkgSearchFilterView.h"
106 #include "YQPkgServiceFilterView.h"
107 #include "YQPkgStatusFilterView.h"
108 #include "YQPkgTechnicalDetailsView.h"
109 #include "YQPkgTextDialog.h"
110 #include "YQPkgUpdateProblemFilterView.h"
111 #include "YQPkgVersionsView.h"
113 #include "zypp/SysContent.h"
114 #include "zypp/base/String.h"
115 #include "zypp/base/Sysconfig.h"
117 #include "QY2ComboTabWidget.h"
118 #include "YQDialog.h"
119 #include "YQApplication.h"
133 #define DEFAULT_EXPORT_FILE_NAME "user-packages.xml"
134 #define FAST_SOLVER 1
136 #define SETTINGS_DIR "YaST2"
137 #define PATH_TO_YAST_SYSCONFIG "/etc/sysconfig/yast2"
138 #define OPTION_VERIFY "PKGMGR_VERIFY_SYSTEM"
139 #define OPTION_AUTO_CHECK "PKGMGR_AUTO_CHECK"
140 #define OPTION_RECOMMENDED "PKGMGR_RECOMMENDED"
142 YQPackageSelector::YQPackageSelector( YWidget * parent,
146 _showChangesDialog =
true;
147 _autoDependenciesAction = 0;
151 _pkgClassFilterView = 0;
152 _patchFilterView = 0;
155 _pkgChangeLogView = 0;
156 _pkgDependenciesView = 0;
157 _pkgDescriptionView = 0;
158 _pkgFileListView = 0;
160 _pkgTechnicalDetailsView = 0;
161 _pkgVersionsView = 0;
163 _serviceFilterView = 0;
164 _searchFilterView = 0;
165 _statusFilterView = 0;
166 _updateProblemFilterView = 0;
167 _excludeDevelPkgs = 0;
168 _excludeDebugInfoPkgs = 0;
170 yuiMilestone() <<
"This is libyui-qt-pkg " << VERSION << endl;
172 if ( onlineUpdateMode() ) yuiMilestone() <<
"Online update mode" << endl;
173 if ( updateMode() ) yuiMilestone() <<
"Update mode" << endl;
181 _filters->loadSettings();
182 bool pagesRestored = _filters->tabCount() > 0;
187 if ( ! pagesRestored )
189 yuiDebug() <<
"No page configuration saved, using fallbacks" << endl;
195 if ( _searchFilterView ) _filters->showPage( _searchFilterView );
197 if ( ! searchMode() && ! summaryMode()
198 && _patternList ) _filters->showPage( _patternList );
200 if ( _statusFilterView ) _filters->showPage( _statusFilterView );
208 if ( _patchFilterView && onlineUpdateMode() )
210 if ( _patchFilterView && _patchList )
212 _filters->showPage( _patchFilterView );
213 _patchList->filter();
216 else if ( _repoFilterView && repoMode() )
220 _filters->showPage( _repoFilterView );
221 _repoFilterView->filter();
224 else if ( _updateProblemFilterView )
226 _filters->showPage( _updateProblemFilterView );
227 _updateProblemFilterView->filter();
229 else if ( searchMode() && _searchFilterView )
231 if ( _pkgClassFilterView && anyRetractedPkgInstalled() )
237 yuiMilestone() <<
"Found installed retracted packages; switching to that view" << endl;
238 _filters->showPage( _pkgClassFilterView );
239 _pkgClassFilterView->showPkgClass( YQPkgClassRetractedInstalled );
256 _filters->showPage( _searchFilterView );
257 _searchFilterView->filter();
258 QTimer::singleShot( 0, _searchFilterView, SLOT( setFocus() ) );
261 else if ( summaryMode() && _statusFilterView )
263 _filters->showPage( _statusFilterView );
264 _statusFilterView->filter();
265 _pkgList->selectNextItem();
267 else if ( _patternList )
269 _filters->showPage( _patternList );
270 _patternList->filter();
274 if ( _filters->diskUsageList() )
275 _filters->diskUsageList()->updateDiskUsage();
277 yuiMilestone() <<
"PackageSelector init done" << endl;
280 #if CHECK_DEPENDENCIES_ON_STARTUP
286 QTimer::singleShot( 0,
this, SLOT( resolveDependencies() ) );
295 YQPackageSelector::basicLayout()
297 QVBoxLayout *layout =
new QVBoxLayout();
299 layout->setContentsMargins( MARGIN,
303 layout->setSpacing( SPACING_BELOW_MENU_BAR );
304 layoutMenuBar(
this );
306 QString settingsName =
"YQPackageSelector";
308 if ( onlineUpdateMode() ) settingsName =
"YQOnlineUpdate";
309 if ( updateMode() ) settingsName =
"YQSystemUpdate";
312 YUI_CHECK_NEW( _filters );
314 layout->addWidget( _filters );
315 layoutFilters(
this );
316 layoutRightPane( _filters->
rightPane() );
321 YQPackageSelector::layoutFilters( QWidget *parent )
333 YUI_CHECK_NEW( _updateProblemFilterView );
334 _filters->
addPage( _(
"&Update Problems" ), _updateProblemFilterView,
"update_problems" );
343 if ( onlineUpdateMode()
344 #
if ALWAYS_SHOW_PATCHES_VIEW_IF_PATCHES_AVAILABLE
345 || ! zyppPool().empty<zypp::Patch>()
357 if ( ! zyppPool().empty<zypp::Pattern>() || testMode() )
360 YUI_CHECK_NEW( _patternList );
361 _filters->
addPage( _(
"Patter&ns" ), _patternList,
"patterns" );
363 connect( _patternList, SIGNAL( statusChanged() ),
366 connect(
this, SIGNAL(
refresh() ),
367 _patternList, SLOT ( updateItemStates() ) );
369 if ( _pkgConflictDialog )
371 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
372 _patternList, SLOT ( updateItemStates() ) );
382 YUI_CHECK_NEW( _pkgClassFilterView );
383 _filters->
addPage( _(
"Package &Classification" ), _pkgClassFilterView,
"package_classification" );
385 connect(
this, SIGNAL(
loadData() ),
386 _pkgClassFilterView, SLOT ( filter() ) );
394 YUI_CHECK_NEW( _langList );
396 _filters->
addPage( _(
"&Languages" ), _langList,
"languages" );
397 _langList->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ) );
399 connect( _langList, SIGNAL( statusChanged() ),
402 connect(
this, SIGNAL(
refresh() ),
403 _langList, SLOT ( updateItemStates() ) );
411 YUI_CHECK_NEW( _repoFilterView );
412 _filters->
addPage( _(
"&Repositories" ), _repoFilterView,
"repos" );
424 YUI_CHECK_NEW( _serviceFilterView );
427 _filters->
addPage( _(
"&Services" ), _serviceFilterView,
"services" );
435 YUI_CHECK_NEW( _searchFilterView );
436 _filters->
addPage( _(
"S&earch" ), _searchFilterView,
"search" );
443 _filters->
addPage( _(
"&Keywords" ),
new QLabel(
"Keywords\nfilter\n\nfor future use",
this ),
"keywords" );
451 YUI_CHECK_NEW( _statusFilterView );
452 _filters->
addPage( _(
"&Installation Summary" ), _statusFilterView,
"inst_summary" );
456 YQPackageSelector::~YQPackageSelector()
463 YQPackageSelector::layoutRightPane( QWidget *parent )
465 QVBoxLayout *layout =
new QVBoxLayout( parent );
466 YUI_CHECK_NEW( layout );
467 layout->setContentsMargins( SPLITTER_HALF_SPACING,
472 QSplitter * splitter =
new QSplitter( Qt::Vertical, parent );
473 YUI_CHECK_NEW( splitter );
474 layout->addWidget(splitter);
476 layoutPkgList( splitter );
477 layoutDetailsViews( splitter );
478 layoutButtons( parent );
485 YQPackageSelector::layoutPkgList( QWidget *parent )
489 QWidget *_notificationsContainer =
new QWidget(parent);
490 QVBoxLayout *layout =
new QVBoxLayout(_notificationsContainer);
492 _repoUpgradingLabel =
new QLabel(_notificationsContainer);
493 _repoUpgradingLabel->setTextFormat(Qt::RichText);
494 _repoUpgradingLabel->setWordWrap(
true);
495 _repoUpgradingLabel->setVisible(
false);
497 _repoUpgradeLabel =
new QLabel(_notificationsContainer);
498 _repoUpgradeLabel->setTextFormat(Qt::RichText);
499 _repoUpgradeLabel->setWordWrap(
true);
500 _repoUpgradeLabel->setVisible(
false);
501 _repoUpgradeLabel->setObjectName(
"RepoUpgradeLabel");
503 layout->addWidget(_repoUpgradingLabel);
504 layout->addWidget(_repoUpgradeLabel);
510 connect( _repoUpgradeLabel, SIGNAL( linkActivated ( QString ) ),
513 connect(_repoUpgradingLabel, SIGNAL( linkActivated ( QString ) ),
519 YUI_CHECK_NEW( _pkgList );
521 connect( _pkgList, SIGNAL( statusChanged() ),
527 YQPackageSelector::layoutDetailsViews( QWidget *parent )
532 _detailsViews =
new QTabWidget( parent );
533 YUI_CHECK_NEW( _detailsViews );
540 YUI_CHECK_NEW( _pkgDescriptionView );
542 _detailsViews->addTab( _pkgDescriptionView, _(
"D&escription" ) );
543 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
545 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
546 _pkgDescriptionView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
553 YUI_CHECK_NEW( _pkgTechnicalDetailsView );
555 _detailsViews->addTab( _pkgTechnicalDetailsView, _(
"&Technical Data" ) );
557 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
558 _pkgTechnicalDetailsView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
566 YUI_CHECK_NEW( _pkgDependenciesView );
568 _detailsViews->addTab( _pkgDependenciesView, _(
"Dependencies" ) );
569 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
571 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
572 _pkgDependenciesView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
581 YUI_CHECK_NEW( _pkgVersionsView );
583 _detailsViews->addTab( _pkgVersionsView, _(
"&Versions" ) );
585 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
586 _pkgVersionsView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
588 connect( _pkgList, SIGNAL( statusChanged() ),
589 _pkgVersionsView, SIGNAL( statusChanged() ) );
596 if ( haveInstalledPkgs )
599 YUI_CHECK_NEW( _pkgFileListView );
601 _detailsViews->addTab( _pkgFileListView, _(
"File List" ) );
602 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
604 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
605 _pkgFileListView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
613 if ( haveInstalledPkgs )
616 YUI_CHECK_NEW( _pkgChangeLogView );
618 _detailsViews->addTab( _pkgChangeLogView, _(
"Change Log" ) );
619 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
621 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
622 _pkgChangeLogView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
628 YQPackageSelector::layoutButtons( QWidget *parent )
630 QWidget * button_box =
new QWidget( parent );
631 YUI_CHECK_NEW( button_box );
632 parent->layout()->addWidget( button_box );
634 QHBoxLayout * layout =
new QHBoxLayout( button_box );
635 YUI_CHECK_NEW( layout );
637 button_box->setLayout( layout );
638 layout->setContentsMargins( 2,
642 layout->addStretch();
644 QPushButton * cancel_button =
new QPushButton( _(
"&Cancel" ), button_box );
645 YUI_CHECK_NEW( cancel_button );
646 layout->addWidget(cancel_button);
648 cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
650 connect( cancel_button, SIGNAL( clicked() ),
651 this, SLOT (
reject() ) );
654 QPushButton * accept_button =
new QPushButton( _(
"&Accept" ), button_box );
655 YUI_CHECK_NEW( accept_button );
656 layout->addWidget(accept_button);
657 accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
659 connect( accept_button, SIGNAL( clicked() ),
660 this, SLOT (
accept() ) );
662 button_box->setFixedHeight( button_box->sizeHint().height() );
667 YQPackageSelector::layoutMenuBar( QWidget *parent )
669 _menuBar =
new QMenuBar( parent );
670 YUI_CHECK_NEW( _menuBar );
671 parent->layout()->addWidget(_menuBar);
692 _fileMenu =
new QMenu( _menuBar );
693 YUI_CHECK_NEW( _fileMenu );
694 QAction * action = _menuBar->addMenu( _fileMenu );
695 action->setText( _(
"&File" ));
697 _fileMenu->addAction( _(
"&Import..." ),
this, SLOT(
pkgImport() ) );
698 _fileMenu->addAction( _(
"&Export..." ),
this, SLOT(
pkgExport() ) );
700 _fileMenu->addSeparator();
702 _fileMenu->addAction( _(
"E&xit -- Discard Changes" ),
this, SLOT(
reject() ) );
703 _fileMenu->addAction( _(
"&Quit -- Save Changes" ),
this, SLOT(
accept() ) );
712 _pkgMenu =
new QMenu( _menuBar );
713 YUI_CHECK_NEW( _pkgMenu );
714 action = _menuBar->addMenu( _pkgMenu );
715 action->setText(_(
"&Package" ));
717 _pkgMenu->addAction(_pkgList->actionSetCurrentInstall);
718 _pkgMenu->addAction(_pkgList->actionSetCurrentDontInstall);
719 _pkgMenu->addAction(_pkgList->actionSetCurrentKeepInstalled);
720 _pkgMenu->addAction(_pkgList->actionSetCurrentDelete);
721 _pkgMenu->addAction(_pkgList->actionSetCurrentUpdate);
722 _pkgMenu->addAction(_pkgList->actionSetCurrentUpdateForce);
723 _pkgMenu->addAction(_pkgList->actionSetCurrentTaboo);
725 #if ENABLE_SOURCE_RPMS
726 _pkgMenu->addSeparator();
728 _pkgMenu->addAction(_pkgList->actionInstallSourceRpm);
729 _pkgMenu->addAction(_pkgList->actionDontInstallSourceRpm);
732 _pkgMenu->addSeparator();
734 YUI_CHECK_NEW( submenu );
736 #if ENABLE_SOURCE_RPMS
737 submenu->addSeparator();
739 _pkgMenu->addAction(_pkgList->actionInstallListSourceRpms);
740 _pkgMenu->addAction(_pkgList->actionDontInstallListSourceRpms);
747 submenu =
new QMenu( _pkgMenu );
748 YUI_CHECK_NEW( submenu );
753 action = _pkgMenu->addMenu( submenu );
754 action->setText(_(
"All Packages" ));
756 submenu->addAction( _(
"Update if newer version available" ),
759 submenu->addAction( _(
"Update unconditionally" ),
770 _patchMenu =
new QMenu( _menuBar );
771 YUI_CHECK_NEW( _patchMenu );
772 action = _menuBar->addMenu( _patchMenu );
773 action->setText(_(
"&Patch" ));
775 _patchMenu->addAction(_patchList->actionSetCurrentInstall);
776 _patchMenu->addAction(_patchList->actionSetCurrentDontInstall);
777 _patchMenu->addAction(_patchList->actionSetCurrentKeepInstalled);
779 #if ENABLE_DELETING_PATCHES
780 _patchMenu->addAction(_patchList->actionSetCurrentDelete);
782 _patchMenu->addAction(_patchList->actionSetCurrentUpdate);
783 _patchMenu->addAction(_patchList->actionSetCurrentUpdateForce);
784 _patchMenu->addAction(_patchList->actionSetCurrentTaboo);
786 _patchMenu->addSeparator();
795 if ( repoMgrEnabled() )
797 _configMenu =
new QMenu( _menuBar );
798 YUI_CHECK_NEW( _configMenu );
799 action = _menuBar->addMenu( _configMenu );
800 action->setText(_(
"Confi&guration" ));
801 _configMenu->addAction( _(
"&Repositories..." ),
this, SLOT(
repoManager() ), Qt::CTRL + Qt::Key_R );
810 _dependencyMenu =
new QMenu( _menuBar );
811 YUI_CHECK_NEW( _dependencyMenu );
812 action = _menuBar->addMenu( _dependencyMenu );
813 action->setText(_(
"&Dependencies" ));
817 _autoDependenciesAction =
new QAction( _(
"&Autocheck" ),
this );
818 _autoDependenciesAction->setCheckable(
true );
819 _dependencyMenu->addAction( _autoDependenciesAction );
821 _installRecommendedAction = _dependencyMenu->addAction(
822 _(
"Install &Recommended Packages"),
823 this, SLOT (pkgInstallRecommendedChanged(
bool)));
824 _installRecommendedAction->setCheckable(
true );
831 _optionsMenu =
new QMenu( _menuBar );
832 YUI_CHECK_NEW( _optionsMenu );
833 action = _menuBar->addMenu( _optionsMenu );
835 action->setText(_(
"&Options" ));
838 _showDevelAction = _optionsMenu->addAction( _(
"Show -de&vel Packages" ),
839 this, SLOT( pkgExcludeDevelChanged(
bool ) ), Qt::Key_F7 );
840 _showDevelAction->setCheckable(
true);
842 _excludeDevelPkgs =
new YQPkgObjList::ExcludeRule( _pkgList, QRegExp(
".*(\\d+bit)?-devel(-\\d+bit)?$" ), _pkgList->nameCol() );
843 YUI_CHECK_NEW( _excludeDevelPkgs );
844 _excludeDevelPkgs->
enable(
false );
847 _showDebugAction = _optionsMenu->addAction( _(
"Show -&debuginfo/-debugsource Packages" ),
849 _showDebugAction->setCheckable(
true);
850 _excludeDebugInfoPkgs =
new YQPkgObjList::ExcludeRule( _pkgList, QRegExp(
".*(-\\d+bit)?-(debuginfo|debugsource)(-32bit)?$" ), _pkgList->nameCol() );
851 YUI_CHECK_NEW( _excludeDebugInfoPkgs );
852 _excludeDebugInfoPkgs->
enable(
false );
855 _verifySystemModeAction = _optionsMenu->addAction( _(
"&System Verification Mode" ),
856 this, SLOT( pkgVerifySytemModeChanged(
bool ) ) );
857 _verifySystemModeAction->setCheckable(
true);
861 _optionsMenu->addSection( _(
"Options for this run only..." ) );
863 _cleanDepsOnRemoveAction = _optionsMenu->addAction( _(
"&Cleanup when deleting packages" ),
864 this, SLOT( pkgCleanDepsOnRemoveChanged(
bool ) ) );
865 _cleanDepsOnRemoveAction->setCheckable(
true);
867 _allowVendorChangeAction = _optionsMenu->addAction( _(
"&Allow vendor change" ),
868 this, SLOT( pkgAllowVendorChangeChanged(
bool ) ) );
869 _allowVendorChangeAction->setCheckable(
true);
876 _extrasMenu =
new QMenu( _menuBar );
877 YUI_CHECK_NEW( _extrasMenu );
878 action = _menuBar->addMenu( _extrasMenu );
879 action->setText(_(
"E&xtras" ));
881 _extrasMenu->addAction( _(
"Show &Products" ),
this, SLOT(
showProducts() ) );
882 _extrasMenu->addAction( _(
"Show P&ackage Changes" ),
this, SLOT(
showAutoPkgList() ), Qt::CTRL + Qt::Key_A );
883 _extrasMenu->addAction( _(
"Show &History" ),
this, SLOT(
showHistory() ) );
885 _extrasMenu->addSeparator();
887 #if BRAINDEAD_LIB_NAMING_SCHEME
891 _extrasMenu->addAction( _(
"Install All Matching -&devel Packages" ),
this, SLOT(
installDevelPkgs() ) );
895 _extrasMenu->addAction( _(
"Install All Matching -de&buginfo Packages" ),
this, SLOT(
installDebugInfoPkgs() ) );
898 _extrasMenu->addAction( _(
"Install All Matching -debug&source Packages" ),
this, SLOT(
installDebugSourcePkgs() ) );
900 _extrasMenu->addAction( _(
"Install All Matching &Recommended Packages" ),
903 _extrasMenu->addSeparator();
905 if ( _pkgConflictDialog )
906 _extrasMenu->addAction( _(
"Generate Dependency Resolver &Test Case" ),
907 _pkgConflictDialog, SLOT( askCreateSolverTestCase() ) );
909 if ( _actionResetIgnoredDependencyProblems )
910 _extrasMenu->addAction(_actionResetIgnoredDependencyProblems);
914 _extrasMenu->addAction(_patchList->actionShowRawPatchInfo);
917 if ( (onlineSearchEnabled()) ) {
918 _extrasMenu->addAction(_(
"Search &Online"),
this, SLOT(
onlineSearch() ) );
925 _helpMenu =
new QMenu( _menuBar );
926 YUI_CHECK_NEW( _helpMenu );
927 _menuBar->addSeparator();
928 action = _menuBar->addMenu( _helpMenu );
929 action->setText(_(
"&Help" ));
935 _helpMenu->addAction( _(
"&Overview" ),
this, SLOT(
help() ), Qt::Key_F1 );
938 _helpMenu->addAction( _(
"&Symbols" ),
this, SLOT(
symbolHelp() ), Qt::SHIFT + Qt::Key_F1 );
941 _helpMenu->addAction( _(
"&Keys" ),
this, SLOT(
keyboardHelp() ) );
948 bool hasUpdateSignal )
950 if ( ! filter )
return;
951 if ( ! pkgList )
return;
955 connect( _filters, SIGNAL( currentChanged(QWidget *) ),
956 filter, SLOT ( filterIfVisible() ) );
959 connect(
this, SIGNAL(
refresh() ),
960 filter, SLOT ( filterIfVisible() ) );
962 connect( filter, SIGNAL( filterStart() ),
963 pkgList, SLOT ( clear() ) );
965 connect( filter, SIGNAL( filterStart() ),
968 connect( filter, SIGNAL( filterMatch( ZyppSel, ZyppPkg ) ),
969 pkgList, SLOT ( addPkgItem ( ZyppSel, ZyppPkg ) ) );
971 connect( filter, SIGNAL( filterFinished() ),
972 pkgList, SLOT ( resort() ) );
974 connect( filter, SIGNAL( filterFinished() ),
975 pkgList, SLOT ( selectSomething() ) );
977 connect( filter, SIGNAL( filterFinished() ),
978 pkgList, SLOT ( logExcludeStatistics() ) );
980 connect( filter, SIGNAL( filterFinished() ),
981 pkgList, SLOT ( setFocus() ) );
983 connect( filter, SIGNAL( filterFinished() ),
989 connect( filter, SIGNAL( updatePackages() ),
990 pkgList, SLOT ( updateItemStates() ) );
994 connect( filter, SIGNAL( updatePackages() ),
1013 if ( _searchFilterView && _pkgList )
1015 connect( _searchFilterView, SIGNAL( message(
const QString & ) ),
1016 _pkgList, SLOT ( message(
const QString & ) ) );
1019 if ( _repoFilterView && _pkgList )
1021 connect( _repoFilterView, SIGNAL( filterNearMatch ( ZyppSel, ZyppPkg ) ),
1022 _pkgList, SLOT ( addPkgItemDimmed ( ZyppSel, ZyppPkg ) ) );
1025 if ( _serviceFilterView && _pkgList )
1027 connect( _serviceFilterView, SIGNAL( filterNearMatch ( ZyppSel, ZyppPkg ) ),
1028 _pkgList, SLOT ( addPkgItemDimmed ( ZyppSel, ZyppPkg ) ) );
1034 connect( _pkgList, SIGNAL( statusChanged() ),
1045 if ( _pkgConflictDialog )
1049 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1050 _pkgList, SLOT ( updateItemStates() ) );
1055 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1056 _patternList, SLOT ( updateItemStates() ) );
1062 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1072 if ( _pkgVersionsView && _pkgList )
1074 connect( _pkgVersionsView, SIGNAL( candidateChanged( ZyppObj ) ),
1075 _pkgList, SLOT ( updateItemData() ) );
1077 connect( _pkgVersionsView, SIGNAL( statusChanged() ),
1078 _pkgList, SLOT ( updateItemData() ) );
1087 YUI_CHECK_NEW( accel );
1094 if ( _pkgMenu && _pkgList )
1096 connect( _pkgMenu, SIGNAL( aboutToShow() ),
1097 _pkgList, SLOT ( updateActions() ) );
1100 if ( _patchMenu && _patchList )
1102 connect( _patchMenu, SIGNAL( aboutToShow() ),
1103 _patchList, SLOT ( updateActions() ) );
1111 if ( _autoDependenciesAction && ! _autoDependenciesAction->isChecked() )
1121 if ( ! _pkgConflictDialog )
1123 yuiError() <<
"No package conflict dialog existing" << endl;
1124 return QDialog::Accepted;
1131 #if DEPENDENCY_FEEDBACK_IF_OK
1133 if ( result == QDialog::Accepted )
1135 QMessageBox::information(
this,
"",
1136 _(
"All package dependencies are OK." ),
1148 if ( ! _patchFilterView )
1151 YUI_CHECK_NEW( _patchFilterView );
1152 _filters->
addPage( _(
"P&atches" ), _patchFilterView,
"patches" );
1154 _patchList = _patchFilterView->
patchList();
1155 YUI_CHECK_PTR( _patchList );
1165 if ( ! _patchFilterView )
1167 yuiMilestone() <<
"Activating patches filter view" << endl;
1172 _filters->
showPage( _patchFilterView );
1178 _filters->
showPage( _patchFilterView );
1186 if ( _pkgList && _patchList )
1190 connect( _patchList, SIGNAL( filterMatch (
const QString &,
const QString &, FSize ) ),
1191 _pkgList, SLOT ( addPassiveItem(
const QString &,
const QString &, FSize ) ) );
1193 connect( _patchList, SIGNAL( statusChanged() ),
1196 if ( _pkgConflictDialog )
1198 connect( _pkgConflictDialog,SIGNAL( updatePackages() ),
1199 _patchList, SLOT ( updateItemStates() ) );
1202 connect(
this, SIGNAL(
refresh() ),
1203 _patchList, SLOT ( updateItemStates() ) );
1212 QString filename = YQApplication::askForSaveFileName( QString( DEFAULT_EXPORT_FILE_NAME ),
1213 QString(
"*.xml;;*" ),
1214 _(
"Save Package List" ) );
1216 if ( ! filename.isEmpty() )
1218 zypp::syscontent::Writer writer;
1219 const zypp::ResPool & pool = zypp::getZYpp()->pool();
1223 for_each( pool.begin(), pool.end(),
1224 boost::bind( &zypp::syscontent::Writer::addIf,
1225 boost::ref( writer ),
1237 std::ofstream exportFile( toUTF8( filename ).c_str() );
1238 exportFile.exceptions( std::ios_base::badbit | std::ios_base::failbit );
1239 exportFile << writer;
1241 yuiMilestone() <<
"Package list exported to " << filename << endl;
1243 catch ( std::exception & exception )
1245 yuiWarning() <<
"Error exporting package list to " << filename << endl;
1249 QFile::remove(filename);
1252 QMessageBox::warning(
this,
1254 _(
"Error exporting package list to %1" ).arg( filename ),
1255 QMessageBox::Ok | QMessageBox::Default,
1266 QString filename = QFileDialog::getOpenFileName(
this, _(
"Load Package List" ), DEFAULT_EXPORT_FILE_NAME,
1270 if ( ! filename.isEmpty() )
1272 yuiMilestone() <<
"Importing package list from " << filename << endl;
1276 std::ifstream importFile( toUTF8( filename ).c_str() );
1277 zypp::syscontent::Reader reader( importFile );
1283 typedef zypp::syscontent::Reader::Entry ZyppReaderEntry;
1284 typedef std::pair<string, ZyppReaderEntry> ImportMapPair;
1286 map<string, ZyppReaderEntry> importPkg;
1287 map<string, ZyppReaderEntry> importPatterns;
1289 for ( zypp::syscontent::Reader::const_iterator it = reader.begin();
1293 string kind = it->kind();
1295 if ( kind ==
"package" ) importPkg.insert ( ImportMapPair( it->name(), *it ) );
1296 else if ( kind ==
"pattern" ) importPatterns.insert( ImportMapPair( it->name(), *it ) );
1299 yuiDebug() <<
"Found " << importPkg.size()
1300 <<
" packages and " << importPatterns.size()
1301 <<
" patterns in " << filename
1309 for ( ZyppPoolIterator it = zyppPatternsBegin();
1310 it != zyppPatternsEnd();
1313 ZyppSel selectable = *it;
1314 importSelectable( *it, importPatterns.find( selectable->name() ) != importPatterns.end(),
"pattern" );
1317 for ( ZyppPoolIterator it = zyppPkgBegin();
1321 ZyppSel selectable = *it;
1322 importSelectable( *it, importPkg.find( selectable->name() ) != importPkg.end(),
"package" );
1332 if ( _statusFilterView )
1336 _filters->
showPage( _statusFilterView );
1337 _statusFilterView->
filter();
1341 catch (
const zypp::Exception & exception )
1343 yuiWarning() <<
"Error reading package list from " << filename << endl;
1346 QMessageBox::warning(
this,
1348 _(
"Error loading package list from %1" ).arg( filename ),
1349 QMessageBox::Ok | QMessageBox::Default,
1350 QMessageBox::NoButton,
1351 QMessageBox::NoButton );
1362 ZyppStatus oldStatus = selectable->status();
1363 ZyppStatus newStatus = oldStatus;
1371 switch ( oldStatus )
1375 case S_KeepInstalled:
1379 newStatus = oldStatus;
1384 newStatus = S_KeepInstalled;
1385 yuiDebug() <<
"Keeping " << kind <<
" " << selectable->name() << endl;
1391 if ( selectable->hasCandidateObj() )
1393 newStatus = S_Install;
1394 yuiDebug() <<
"Adding " << kind <<
" " << selectable->name() << endl;
1398 yuiDebug() <<
"Can't add " << kind <<
" " << selectable->name()
1399 <<
": No candidate" << endl;
1410 switch ( oldStatus )
1414 case S_KeepInstalled:
1419 yuiDebug() <<
"Deleting " << kind <<
" " << selectable->name() << endl;
1426 newStatus = oldStatus;
1431 if ( oldStatus != newStatus )
1432 selectable->setStatus( newStatus );
1444 yuiMilestone() << count <<
" pkgs found for update" << endl;
1446 if ( count >= GLOBAL_UPDATE_CONFIRMATION_THRESHOLD )
1448 if ( QMessageBox::question(
this,
"",
1450 _(
"%1 packages will be updated" ).arg( count ),
1451 _(
"&Continue" ), _(
"C&ancel" ),
1463 if ( _statusFilterView )
1465 _filters->
showPage( _statusFilterView );
1466 _statusFilterView->
clear();
1468 _statusFilterView->
filter();
1476 zypp::ResPool::repository_iterator it;
1477 _repoUpgradeLabel->setText(
"");
1478 _repoUpgradingLabel->setText(
"");
1482 for ( it = zypp::getZYpp()->pool().knownRepositoriesBegin();
1483 it != zypp::getZYpp()->pool().knownRepositoriesEnd();
1486 zypp::Repository repo(*it);
1489 if ( zypp::getZYpp()->resolver()->upgradingRepo(repo) )
1491 _repoUpgradingLabel->setText(_repoUpgradingLabel->text() + _(
"<p><small><a href=\"repoupgraderemove:///%1\">Cancel switching</a> system packages to versions in repository %2</small></p>")
1492 .arg(fromUTF8(repo.alias().c_str()))
1493 .arg(fromUTF8(repo.name().c_str()))
1498 for ( it = zypp::getZYpp()->pool().knownRepositoriesBegin();
1499 it != zypp::getZYpp()->pool().knownRepositoriesEnd();
1502 zypp::Repository repo(*it);
1506 if ( ! zypp::getZYpp()->resolver()->upgradingRepo(repo) &&
1507 ! repo.isSystemRepo() &&
1510 _repoUpgradeLabel->setText(_repoUpgradeLabel->text() + _(
"<p><a href=\"repoupgradeadd:///%1\">Switch system packages</a> to the versions in this repository (%2)</p>")
1511 .arg(fromUTF8(repo.alias().c_str()))
1512 .arg(fromUTF8(repo.name().c_str()))
1516 _repoUpgradeLabel->setVisible(!_repoUpgradeLabel->text().isEmpty() &&
1517 _repoFilterView->isVisible() );
1518 _repoUpgradingLabel->setVisible(!_repoUpgradingLabel->text().isEmpty());
1524 yuiDebug() <<
"link " << link <<
" clicked on label" << endl;
1527 if (url.scheme() ==
"repoupgradeadd")
1529 yuiDebug() <<
"looking for repo " << url.path() << endl;
1530 std::string alias(url.path().remove(0,1).toStdString());
1531 zypp::Repository repo(zypp::getZYpp()->pool().reposFind(alias));
1532 yuiDebug() << repo << endl;
1534 if ( repo != zypp::Repository::noRepository )
1536 zypp::getZYpp()->resolver()->addUpgradeRepo(repo);
1538 zypp::getZYpp()->resolver()->dupSetAllowVendorChange(
true);
1541 else if (url.scheme() ==
"repoupgraderemove")
1543 std::string alias(url.path().remove(0,1).toStdString());
1544 zypp::Repository repo(zypp::getZYpp()->pool().reposFind(alias));
1546 if ( repo != zypp::Repository::noRepository )
1547 zypp::getZYpp()->resolver()->removeUpgradeRepo(repo);
1550 yuiDebug() <<
"unknown link operation " << url.scheme() << endl;
1595 zypp::getZYpp()->resolver()->setIgnoreAlreadyRecommended(
false );
1598 if ( _filters && _statusFilterView )
1600 _filters->
showPage( _statusFilterView );
1601 _statusFilterView->
filter();
1605 _(
"Added Subpackages:" ),
1608 YQPkgChangesDialog::FilterAutomatic,
1609 YQPkgChangesDialog::OptionNone );
1616 if ( _optionsMenu && _pkgList )
1618 if ( _excludeDebugInfoPkgs )
1619 _excludeDebugInfoPkgs->
enable( ! on );
1627 YQPackageSelector::pkgExcludeDevelChanged(
bool on )
1629 if ( _optionsMenu && _pkgList )
1631 if ( _excludeDevelPkgs )
1632 _excludeDevelPkgs->
enable( ! on );
1640 YQPackageSelector::pkgVerifySytemModeChanged(
bool on )
1642 zypp::getZYpp()->resolver()->setSystemVerification( on );
1647 YQPackageSelector::pkgInstallRecommendedChanged(
bool on )
1649 zypp::getZYpp()->resolver()->setOnlyRequires( !on );
1655 YQPackageSelector::pkgCleanDepsOnRemoveChanged(
bool on )
1657 zypp::getZYpp()->resolver()->setCleandepsOnRemove( on );
1663 YQPackageSelector::pkgAllowVendorChangeChanged(
bool on )
1665 zypp::getZYpp()->resolver()->setAllowVendorChange( on );
1676 QMap<QString, ZyppSel> subPkgs;
1678 for ( ZyppPoolIterator it = zyppPkgBegin();
1682 QString name = (*it)->name().c_str();
1684 if ( name.endsWith( suffix ) || name.endsWith( suffix +
"-32bit" ) )
1686 subPkgs[ name ] = *it;
1688 yuiDebug() <<
"Found subpackage: " << name << endl;
1695 for ( ZyppPoolIterator it = zyppPkgBegin();
1699 QString name = (*it)->name().c_str();
1701 if ( subPkgs.contains( name + suffix ) )
1703 QString subPkgName( name + suffix );
1704 ZyppSel subPkg = subPkgs[ subPkgName ];
1706 switch ( (*it)->status() )
1714 yuiMilestone() <<
"Ignoring unwanted subpackage " << subPkgName << endl;
1719 case S_KeepInstalled:
1723 if ( ! subPkg->installedObj() )
1725 subPkg->setStatus( S_Install );
1726 yuiMilestone() <<
"Installing subpackage " << subPkgName << endl;
1736 if ( ! subPkg->installedObj() )
1738 subPkg->setStatus( S_Install );
1739 yuiMilestone() <<
"Installing subpackage " << subPkgName << endl;
1743 subPkg->setStatus( S_Update );
1744 yuiMilestone() <<
"Updating subpackage " << subPkgName << endl;
1755 if ( _filters && _statusFilterView )
1757 _filters->
showPage( _statusFilterView );
1758 _statusFilterView->
filter();
1762 _(
"Added Subpackages:" ),
1763 QRegExp(
".*" + suffix +
"$" ),
1766 YQPkgChangesDialog::FilterAutomatic,
1767 YQPkgChangesDialog::OptionNone );
1774 yuiMilestone() <<
"Checking for retracted installed packages..." << endl;
1776 for ( ZyppPoolIterator it = zyppPkgBegin(); it != zyppPkgEnd(); ++it )
1778 if ( (*it)->hasRetractedInstalled() )
1782 yuiMilestone() <<
"No retracted packages installed." << endl;
1791 QString settingsName =
"YQPackageSelector";
1793 if ( onlineUpdateMode() )
1794 settingsName =
"YQOnlineUpdate";
1797 settingsName =
"YQSystemUpdate";
1799 QSettings settings( QSettings::UserScope, SETTINGS_DIR, settingsName );
1801 _showDevelAction->setChecked(settings.value(
"Options/showDevelPackages",
true ).toBool());
1802 pkgExcludeDevelChanged(_showDevelAction->isChecked());
1804 _showDebugAction->setChecked(settings.value(
"Options/showDebugPackages",
true ).toBool());
1814 map<string, string> sysconfig = zypp::base::sysconfig::read( PATH_TO_YAST_SYSCONFIG );
1816 bool auto_check = AUTO_CHECK_DEPENDENCIES_DEFAULT;
1817 auto it = sysconfig.find( OPTION_AUTO_CHECK );
1819 if ( it != sysconfig.end() )
1820 auto_check = it->second ==
"yes";
1822 _autoDependenciesAction->setChecked(auto_check);
1824 bool verify_system = zypp::getZYpp()->resolver()->systemVerification();
1825 it = sysconfig.find( OPTION_VERIFY );
1827 if ( it != sysconfig.end() )
1828 verify_system = it->second ==
"yes";
1830 _verifySystemModeAction->setChecked( verify_system );
1831 pkgVerifySytemModeChanged( verify_system );
1833 bool install_recommended = ! zypp::getZYpp()->resolver()->onlyRequires();
1834 it = sysconfig.find( OPTION_RECOMMENDED );
1836 if (it != sysconfig.end())
1837 install_recommended = it->second ==
"yes";
1839 _installRecommendedAction->setChecked( install_recommended );
1840 pkgInstallRecommendedChanged(install_recommended);
1842 bool allow_vendor_change = zypp::getZYpp()->resolver()->allowVendorChange();
1843 _allowVendorChangeAction->setChecked( allow_vendor_change );
1844 pkgAllowVendorChangeChanged( allow_vendor_change );
1846 bool clean_deps_on_remove = zypp::getZYpp()->resolver()->cleandepsOnRemove();
1847 _cleanDepsOnRemoveAction->setChecked( clean_deps_on_remove );
1848 pkgCleanDepsOnRemoveChanged( clean_deps_on_remove );
1855 QString settingsName =
"YQPackageSelector";
1857 if ( onlineUpdateMode() )
1858 settingsName =
"YQOnlineUpdate";
1861 settingsName =
"YQSystemUpdate";
1863 QSettings settings( QSettings::UserScope, SETTINGS_DIR, settingsName );
1865 settings.setValue(
"Options/showDevelPackages", _showDevelAction->isChecked() );
1866 settings.setValue(
"Options/showDebugPackages", _showDebugAction->isChecked() );
1876 zypp::base::sysconfig::writeStringVal( PATH_TO_YAST_SYSCONFIG,
1878 ( _autoDependenciesAction->isChecked() ?
"yes" :
"no" ),
1879 "Automatic dependency checking");
1880 zypp::base::sysconfig::writeStringVal( PATH_TO_YAST_SYSCONFIG,
1882 ( _verifySystemModeAction->isChecked() ?
"yes" :
"no" ),
1883 "System verification mode");
1884 zypp::base::sysconfig::writeStringVal( PATH_TO_YAST_SYSCONFIG,
1886 ( _installRecommendedAction->isChecked() ?
"yes" :
"no" ),
1887 "Install recommended packages");
1889 catch(
const std::exception &e )
1891 yuiError() <<
"Writing " << PATH_TO_YAST_SYSCONFIG <<
" failed" << endl;
1897 YQUI::ui()->busyCursor();
1902 YQUI::ui()->normalCursor();