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" );
417 YUI_CHECK_NEW( _searchFilterView );
418 _filters->
addPage( _(
"S&earch" ), _searchFilterView,
"search" );
425 _filters->
addPage( _(
"&Keywords" ),
new QLabel(
"Keywords\nfilter\n\nfor future use",
this ),
"keywords" );
433 YUI_CHECK_NEW( _statusFilterView );
434 _filters->
addPage( _(
"&Installation Summary" ), _statusFilterView,
"inst_summary" );
438 YQPackageSelector::~YQPackageSelector()
444 YQPackageSelector::layoutRightPane( QWidget *parent )
446 QVBoxLayout *layout =
new QVBoxLayout( parent );
447 YUI_CHECK_NEW( layout );
448 layout->setContentsMargins( SPLITTER_HALF_SPACING,
453 QSplitter * splitter =
new QSplitter( Qt::Vertical, parent );
454 YUI_CHECK_NEW( splitter );
455 layout->addWidget(splitter);
457 layoutPkgList( splitter );
458 layoutDetailsViews( splitter );
459 layoutButtons( parent );
466 YQPackageSelector::layoutPkgList( QWidget *parent )
470 QWidget *_notificationsContainer =
new QWidget(parent);
471 QVBoxLayout *layout =
new QVBoxLayout(_notificationsContainer);
473 _repoUpgradingLabel =
new QLabel(_notificationsContainer);
474 _repoUpgradingLabel->setTextFormat(Qt::RichText);
475 _repoUpgradingLabel->setWordWrap(
true);
476 _repoUpgradingLabel->setVisible(
false);
478 _repoUpgradeLabel =
new QLabel(_notificationsContainer);
479 _repoUpgradeLabel->setTextFormat(Qt::RichText);
480 _repoUpgradeLabel->setWordWrap(
true);
481 _repoUpgradeLabel->setVisible(
false);
482 _repoUpgradeLabel->setObjectName(
"RepoUpgradeLabel");
484 layout->addWidget(_repoUpgradingLabel);
485 layout->addWidget(_repoUpgradeLabel);
497 YUI_CHECK_NEW( _pkgList );
499 connect( _pkgList, SIGNAL( statusChanged() ),
504 YQPackageSelector::layoutDetailsViews( QWidget *parent )
509 _detailsViews =
new QTabWidget( parent );
510 YUI_CHECK_NEW( _detailsViews );
517 YUI_CHECK_NEW( _pkgDescriptionView );
519 _detailsViews->addTab( _pkgDescriptionView, _(
"D&escription" ) );
520 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
522 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
523 _pkgDescriptionView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
530 YUI_CHECK_NEW( _pkgTechnicalDetailsView );
532 _detailsViews->addTab( _pkgTechnicalDetailsView, _(
"&Technical Data" ) );
534 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
535 _pkgTechnicalDetailsView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
543 YUI_CHECK_NEW( _pkgDependenciesView );
545 _detailsViews->addTab( _pkgDependenciesView, _(
"Dependencies" ) );
546 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
548 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
549 _pkgDependenciesView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
559 YUI_CHECK_NEW( _pkgVersionsView );
561 _detailsViews->addTab( _pkgVersionsView, _(
"&Versions" ) );
563 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
564 _pkgVersionsView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
566 connect( _pkgList, SIGNAL( statusChanged() ),
567 _pkgVersionsView, SLOT ( slotRefreshDetails() ) );
574 if ( haveInstalledPkgs )
577 YUI_CHECK_NEW( _pkgFileListView );
579 _detailsViews->addTab( _pkgFileListView, _(
"File List" ) );
580 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
582 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
583 _pkgFileListView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
591 if ( haveInstalledPkgs )
594 YUI_CHECK_NEW( _pkgChangeLogView );
596 _detailsViews->addTab( _pkgChangeLogView, _(
"Change Log" ) );
597 _detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
599 connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
600 _pkgChangeLogView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );
606 YQPackageSelector::layoutButtons( QWidget *parent )
608 QWidget * button_box =
new QWidget( parent );
609 YUI_CHECK_NEW( button_box );
610 parent->layout()->addWidget( button_box );
612 QHBoxLayout * layout =
new QHBoxLayout( button_box );
613 YUI_CHECK_NEW( layout );
615 button_box->setLayout( layout );
616 layout->setContentsMargins( 2,
621 layout->addStretch();
623 QPushButton * cancel_button =
new QPushButton( _(
"&Cancel" ), button_box );
624 YUI_CHECK_NEW( cancel_button );
625 layout->addWidget(cancel_button);
627 cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
629 connect( cancel_button, SIGNAL( clicked() ),
630 this, SLOT (
reject() ) );
633 QPushButton * accept_button =
new QPushButton( _(
"&Accept" ), button_box );
634 YUI_CHECK_NEW( accept_button );
635 layout->addWidget(accept_button);
636 accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
638 connect( accept_button, SIGNAL( clicked() ),
639 this, SLOT (
accept() ) );
641 button_box->setFixedHeight( button_box->sizeHint().height() );
646 YQPackageSelector::layoutMenuBar( QWidget *parent )
648 _menuBar =
new QMenuBar( parent );
649 YUI_CHECK_NEW( _menuBar );
650 parent->layout()->addWidget(_menuBar);
673 _fileMenu =
new QMenu( _menuBar );
674 YUI_CHECK_NEW( _fileMenu );
675 QAction * action = _menuBar->addMenu( _fileMenu );
676 action->setText( _(
"&File" ));
678 _fileMenu->addAction( _(
"&Import..." ),
this, SLOT(
pkgImport() ) );
679 _fileMenu->addAction( _(
"&Export..." ),
this, SLOT(
pkgExport() ) );
681 _fileMenu->addSeparator();
683 _fileMenu->addAction( _(
"E&xit -- Discard Changes" ),
this, SLOT(
reject() ) );
684 _fileMenu->addAction( _(
"&Quit -- Save Changes" ),
this, SLOT(
accept() ) );
693 _pkgMenu =
new QMenu( _menuBar );
694 YUI_CHECK_NEW( _pkgMenu );
695 action = _menuBar->addMenu( _pkgMenu );
696 action->setText(_(
"&Package" ));
698 _pkgMenu->addAction(_pkgList->actionSetCurrentInstall);
699 _pkgMenu->addAction(_pkgList->actionSetCurrentDontInstall);
700 _pkgMenu->addAction(_pkgList->actionSetCurrentKeepInstalled);
701 _pkgMenu->addAction(_pkgList->actionSetCurrentDelete);
702 _pkgMenu->addAction(_pkgList->actionSetCurrentUpdate);
703 _pkgMenu->addAction(_pkgList->actionSetCurrentUpdateForce);
704 _pkgMenu->addAction(_pkgList->actionSetCurrentTaboo);
705 _pkgMenu->addAction(_pkgList->actionShowCurrentSolverInfo);
707 #if ENABLE_SOURCE_RPMS
708 _pkgMenu->addSeparator();
710 _pkgMenu->addAction(_pkgList->actionInstallSourceRpm);
711 _pkgMenu->addAction(_pkgList->actionDontInstallSourceRpm);
714 _pkgMenu->addSeparator();
716 YUI_CHECK_NEW( submenu );
718 #if ENABLE_SOURCE_RPMS
719 submenu->addSeparator();
721 _pkgMenu->addAction(_pkgList->actionInstallListSourceRpms);
722 _pkgMenu->addAction(_pkgList->actionDontInstallListSourceRpms);
729 submenu =
new QMenu( _pkgMenu );
730 YUI_CHECK_NEW( submenu );
735 action = _pkgMenu->addMenu( submenu );
736 action->setText(_(
"All Packages" ));
738 submenu->addAction( _(
"Update if newer version available" ),
741 submenu->addAction( _(
"Update unconditionally" ),
752 _patchMenu =
new QMenu( _menuBar );
753 YUI_CHECK_NEW( _patchMenu );
754 action = _menuBar->addMenu( _patchMenu );
755 action->setText(_(
"&Patch" ));
757 _patchMenu->addAction(_patchList->actionSetCurrentInstall);
758 _patchMenu->addAction(_patchList->actionSetCurrentDontInstall);
759 _patchMenu->addAction(_patchList->actionSetCurrentKeepInstalled);
761 #if ENABLE_DELETING_PATCHES
762 _patchMenu->addAction(_patchList->actionSetCurrentDelete);
764 _patchMenu->addAction(_patchList->actionSetCurrentUpdate);
765 _patchMenu->addAction(_patchList->actionSetCurrentUpdateForce);
766 _patchMenu->addAction(_patchList->actionSetCurrentTaboo);
768 _patchMenu->addSeparator();
777 if ( repoMgrEnabled() )
779 _configMenu =
new QMenu( _menuBar );
780 YUI_CHECK_NEW( _configMenu );
781 action = _menuBar->addMenu( _configMenu );
782 action->setText(_(
"Confi&guration" ));
783 _configMenu->addAction( _(
"&Repositories..." ),
this, SLOT(
repoManager() ), Qt::CTRL + Qt::Key_R );
791 _dependencyMenu =
new QMenu( _menuBar );
792 YUI_CHECK_NEW( _dependencyMenu );
793 action = _menuBar->addMenu( _dependencyMenu );
794 action->setText(_(
"&Dependencies" ));
797 _autoDependenciesAction =
new QAction( _(
"&Autocheck" ),
this );
798 _autoDependenciesAction->setCheckable(
true );
799 _dependencyMenu->addAction( _autoDependenciesAction );
806 _optionsMenu =
new QMenu( _menuBar );
807 YUI_CHECK_NEW( _optionsMenu );
808 action = _menuBar->addMenu( _optionsMenu );
810 action->setText(_(
"&Options" ));
813 _showDevelAction = _optionsMenu->addAction( _(
"Show -de&vel Packages" ),
814 this, SLOT( pkgExcludeDevelChanged(
bool ) ), Qt::Key_F7 );
815 _showDevelAction->setCheckable(
true);
817 _excludeDevelPkgs =
new YQPkgObjList::ExcludeRule( _pkgList, QRegExp(
".*(\\d+bit)?-devel(-\\d+bit)?$" ), _pkgList->nameCol() );
818 YUI_CHECK_NEW( _excludeDevelPkgs );
819 _excludeDevelPkgs->
enable(
false );
822 _showDebugAction = _optionsMenu->addAction( _(
"Show -&debuginfo/-debugsource Packages" ),
824 _showDebugAction->setCheckable(
true);
825 _excludeDebugInfoPkgs =
new YQPkgObjList::ExcludeRule( _pkgList, QRegExp(
".*(-\\d+bit)?-(debuginfo|debugsource)(-32bit)?$" ), _pkgList->nameCol() );
826 YUI_CHECK_NEW( _excludeDebugInfoPkgs );
827 _excludeDebugInfoPkgs->
enable(
false );
830 _verifySystemModeAction = _optionsMenu->addAction( _(
"&System Verification Mode" ),
831 this, SLOT( pkgVerifySytemModeChanged(
bool ) ) );
832 _verifySystemModeAction->setCheckable(
true);
835 _ignoreAlreadyRecommendAction = _optionsMenu->addAction( _(
"&Ignore Recommended Packages for Already Installed Packages" ),
836 this, SLOT( pkgIgnoreAlreadyRecommendedChanged(
bool ) ) );
837 _ignoreAlreadyRecommendAction->setCheckable(
true);
841 _cleanDepsOnRemoveAction = _optionsMenu->addAction( _(
"&Cleanup when deleting packages" ),
842 this, SLOT( pkgCleanDepsOnRemoveChanged(
bool ) ) );
843 _cleanDepsOnRemoveAction->setCheckable(
true);
845 _allowVendorChangeAction = _optionsMenu->addAction( _(
"&Allow vendor change" ),
846 this, SLOT( pkgAllowVendorChangeChanged(
bool ) ) );
847 _allowVendorChangeAction->setCheckable(
true);
855 _extrasMenu =
new QMenu( _menuBar );
856 YUI_CHECK_NEW( _extrasMenu );
857 action = _menuBar->addMenu( _extrasMenu );
858 action->setText(_(
"E&xtras" ));
860 _extrasMenu->addAction( _(
"Show &Products" ),
this, SLOT(
showProducts() ) );
861 _extrasMenu->addAction( _(
"Show P&ackage Changes" ),
this, SLOT(
showAutoPkgList() ), Qt::CTRL + Qt::Key_A );
862 _extrasMenu->addAction( _(
"Show &History" ),
this, SLOT(
showHistory() ) );
864 _extrasMenu->addSeparator();
866 #if BRAINDEAD_LIB_NAMING_SCHEME
870 _extrasMenu->addAction( _(
"Install All Matching -&devel Packages" ),
this, SLOT(
installDevelPkgs() ) );
874 _extrasMenu->addAction( _(
"Install All Matching -de&buginfo Packages" ),
this, SLOT(
installDebugInfoPkgs() ) );
877 _extrasMenu->addAction( _(
"Install All Matching -debug&source Packages" ),
this, SLOT(
installDebugSourcePkgs() ) );
879 _extrasMenu->addSeparator();
881 if ( _pkgConflictDialog )
882 _extrasMenu->addAction( _(
"Generate Dependency Resolver &Test Case" ),
883 _pkgConflictDialog, SLOT( askCreateSolverTestCase() ) );
885 if ( _actionResetIgnoredDependencyProblems )
886 _extrasMenu->addAction(_actionResetIgnoredDependencyProblems);
890 _extrasMenu->addAction(_patchList->actionShowRawPatchInfo);
898 _helpMenu =
new QMenu( _menuBar );
899 YUI_CHECK_NEW( _helpMenu );
900 _menuBar->addSeparator();
901 action = _menuBar->addMenu( _helpMenu );
902 action->setText(_(
"&Help" ));
908 _helpMenu->addAction( _(
"&Overview" ),
this, SLOT(
help() ), Qt::Key_F1 );
911 _helpMenu->addAction( _(
"&Symbols" ),
this, SLOT(
symbolHelp() ), Qt::SHIFT + Qt::Key_F1 );
914 _helpMenu->addAction( _(
"&Keys" ),
this, SLOT(
keyboardHelp() ) );
921 bool hasUpdateSignal )
923 if ( ! filter )
return;
924 if ( ! pkgList )
return;
928 connect( _filters, SIGNAL( currentChanged(QWidget *) ),
929 filter, SLOT ( filterIfVisible() ) );
932 connect(
this, SIGNAL(
refresh() ),
933 filter, SLOT ( filterIfVisible() ) );
935 connect( filter, SIGNAL( filterStart() ),
936 pkgList, SLOT ( clear() ) );
938 connect( filter, SIGNAL( filterMatch( ZyppSel, ZyppPkg ) ),
939 pkgList, SLOT ( addPkgItem ( ZyppSel, ZyppPkg ) ) );
941 connect( filter, SIGNAL( filterFinished() ),
942 pkgList, SLOT ( resort() ) );
944 connect( filter, SIGNAL( filterFinished() ),
945 pkgList, SLOT ( selectSomething() ) );
947 connect( filter, SIGNAL( filterFinished() ),
948 pkgList, SLOT ( logExcludeStatistics() ) );
950 connect( filter, SIGNAL( filterFinished() ),
951 pkgList, SLOT ( setFocus() ) );
956 connect( filter, SIGNAL( updatePackages() ),
957 pkgList, SLOT ( updateItemStates() ) );
961 connect( filter, SIGNAL( updatePackages() ),
975 connectFilter( _packageKitGroupsFilterView, _pkgList,
false );
983 if ( _searchFilterView && _pkgList )
985 connect( _searchFilterView, SIGNAL( message(
const QString & ) ),
986 _pkgList, SLOT ( message(
const QString & ) ) );
989 if ( _repoFilterView && _pkgList )
991 connect( _repoFilterView, SIGNAL( filterNearMatch ( ZyppSel, ZyppPkg ) ),
992 _pkgList, SLOT ( addPkgItemDimmed ( ZyppSel, ZyppPkg ) ) );
998 connect( _pkgList, SIGNAL( statusChanged() ),
1010 if ( _pkgConflictDialog )
1014 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1015 _pkgList, SLOT ( updateItemStates() ) );
1020 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1021 _patternList, SLOT ( updateItemStates() ) );
1027 connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
1037 if ( _pkgVersionsView && _pkgList )
1039 connect( _pkgVersionsView, SIGNAL( candidateChanged( ZyppObj ) ),
1040 _pkgList, SLOT ( updateItemData() ) );
1042 connect( _pkgVersionsView, SIGNAL( multiversionSelectionChanged( ) ),
1043 _pkgList, SLOT ( updateItemData() ) );
1052 YUI_CHECK_NEW( accel );
1058 if ( _pkgMenu && _pkgList )
1060 connect( _pkgMenu, SIGNAL( aboutToShow() ),
1061 _pkgList, SLOT ( updateActions() ) );
1064 if ( _patchMenu && _patchList )
1066 connect( _patchMenu, SIGNAL( aboutToShow() ),
1067 _patchList, SLOT ( updateActions() ) );
1075 if ( _autoDependenciesAction && ! _autoDependenciesAction->isChecked() )
1085 if ( ! _pkgConflictDialog )
1087 yuiError() <<
"No package conflict dialog existing" << std::endl;
1088 return QDialog::Accepted;
1091 YQUI::ui()->busyCursor();
1093 YQUI::ui()->normalCursor();
1095 #if DEPENDENCY_FEEDBACK_IF_OK
1097 if ( result == QDialog::Accepted )
1099 QMessageBox::information(
this,
"",
1100 _(
"All package dependencies are OK." ),
1112 if ( ! _patchFilterView )
1115 YUI_CHECK_NEW( _patchFilterView );
1116 _filters->
addPage( _(
"P&atches" ), _patchFilterView,
"patches" );
1118 _patchList = _patchFilterView->
patchList();
1119 YUI_CHECK_PTR( _patchList );
1129 if ( ! _patchFilterView )
1131 yuiMilestone() <<
"Activating patches filter view" << std::endl;
1136 _filters->
showPage( _patchFilterView );
1142 _filters->
showPage( _patchFilterView );
1150 if ( _pkgList && _patchList )
1154 connect( _patchList, SIGNAL( filterMatch (
const QString &,
const QString &, FSize ) ),
1155 _pkgList, SLOT ( addPassiveItem(
const QString &,
const QString &, FSize ) ) );
1157 connect( _patchList, SIGNAL( statusChanged() ),
1160 if ( _pkgConflictDialog )
1162 connect( _pkgConflictDialog,SIGNAL( updatePackages() ),
1163 _patchList, SLOT ( updateItemStates() ) );
1166 connect(
this, SIGNAL(
refresh() ),
1167 _patchList, SLOT ( updateItemStates() ) );
1176 QString filename = YQApplication::askForSaveFileName( QString( DEFAULT_EXPORT_FILE_NAME ),
1177 QString(
"*.xml;;*" ),
1178 _(
"Save Package List" ) );
1180 if ( ! filename.isEmpty() )
1182 zypp::syscontent::Writer writer;
1183 const zypp::ResPool & pool = zypp::getZYpp()->pool();
1187 for_each( pool.begin(), pool.end(),
1188 boost::bind( &zypp::syscontent::Writer::addIf,
1189 boost::ref( writer ),
1201 std::ofstream exportFile( toUTF8( filename ).c_str() );
1202 exportFile.exceptions( std::ios_base::badbit | std::ios_base::failbit );
1203 exportFile << writer;
1205 yuiMilestone() <<
"Package list exported to " << filename << std::endl;
1207 catch ( std::exception & exception )
1209 yuiWarning() <<
"Error exporting package list to " << filename << std::endl;
1213 QFile::remove(filename);
1216 QMessageBox::warning(
this,
1218 _(
"Error exporting package list to %1" ).arg( filename ),
1219 QMessageBox::Ok | QMessageBox::Default,
1230 QString filename = QFileDialog::getOpenFileName(
this, _(
"Load Package List" ), DEFAULT_EXPORT_FILE_NAME,
1234 if ( ! filename.isEmpty() )
1236 yuiMilestone() <<
"Importing package list from " << filename << std::endl;
1240 std::ifstream importFile( toUTF8( filename ).c_str() );
1241 zypp::syscontent::Reader reader( importFile );
1247 typedef zypp::syscontent::Reader::Entry ZyppReaderEntry;
1248 typedef std::pair<string, ZyppReaderEntry> ImportMapPair;
1250 map<string, ZyppReaderEntry> importPkg;
1251 map<string, ZyppReaderEntry> importPatterns;
1253 for ( zypp::syscontent::Reader::const_iterator it = reader.begin();
1257 string kind = it->kind();
1259 if ( kind ==
"package" ) importPkg.insert ( ImportMapPair( it->name(), *it ) );
1260 else if ( kind ==
"pattern" ) importPatterns.insert( ImportMapPair( it->name(), *it ) );
1263 yuiDebug() <<
"Found " << importPkg.size()
1264 <<
" packages and " << importPatterns.size()
1265 <<
" patterns in " << filename
1273 for ( ZyppPoolIterator it = zyppPatternsBegin();
1274 it != zyppPatternsEnd();
1277 ZyppSel selectable = *it;
1278 importSelectable( *it, importPatterns.find( selectable->name() ) != importPatterns.end(),
"pattern" );
1281 for ( ZyppPoolIterator it = zyppPkgBegin();
1285 ZyppSel selectable = *it;
1286 importSelectable( *it, importPkg.find( selectable->name() ) != importPkg.end(),
"package" );
1296 if ( _statusFilterView )
1300 _filters->
showPage( _statusFilterView );
1301 _statusFilterView->
filter();
1305 catch (
const zypp::Exception & exception )
1307 yuiWarning() <<
"Error reading package list from " << filename << std::endl;
1310 QMessageBox::warning(
this,
1312 _(
"Error loading package list from %1" ).arg( filename ),
1313 QMessageBox::Ok | QMessageBox::Default,
1314 QMessageBox::NoButton,
1315 QMessageBox::NoButton );
1326 ZyppStatus oldStatus = selectable->status();
1327 ZyppStatus newStatus = oldStatus;
1335 switch ( oldStatus )
1339 case S_KeepInstalled:
1343 newStatus = oldStatus;
1348 newStatus = S_KeepInstalled;
1349 yuiDebug() <<
"Keeping " << kind <<
" " << selectable->name() << std::endl;
1355 if ( selectable->hasCandidateObj() )
1357 newStatus = S_Install;
1358 yuiDebug() <<
"Adding " << kind <<
" " << selectable->name() << std::endl;
1362 yuiDebug() <<
"Can't add " << kind <<
" " << selectable->name()
1363 <<
": No candidate" << std::endl;
1374 switch ( oldStatus )
1378 case S_KeepInstalled:
1383 yuiDebug() <<
"Deleting " << kind <<
" " << selectable->name() << std::endl;
1390 newStatus = oldStatus;
1395 if ( oldStatus != newStatus )
1396 selectable->setStatus( newStatus );
1408 yuiMilestone() << count <<
" pkgs found for update" << std::endl;
1410 if ( count >= GLOBAL_UPDATE_CONFIRMATION_THRESHOLD )
1412 if ( QMessageBox::question(
this,
"",
1414 _(
"%1 packages will be updated" ).arg( count ),
1415 _(
"&Continue" ), _(
"C&ancel" ),
1427 if ( _statusFilterView )
1429 _filters->
showPage( _statusFilterView );
1430 _statusFilterView->
clear();
1432 _statusFilterView->
filter();
1439 zypp::ResPool::repository_iterator it;
1440 _repoUpgradeLabel->setText(
"");
1441 _repoUpgradingLabel->setText(
"");
1445 for ( it = zypp::getZYpp()->pool().knownRepositoriesBegin();
1446 it != zypp::getZYpp()->pool().knownRepositoriesEnd();
1449 zypp::Repository repo(*it);
1452 if ( zypp::getZYpp()->resolver()->upgradingRepo(repo) )
1454 _repoUpgradingLabel->setText(_repoUpgradingLabel->text() + _(
"<p><small><a href=\"repoupgraderemove:///%1\">Cancel switching</a> system packages to versions in repository %2</small></p>")
1455 .arg(fromUTF8(repo.alias().c_str()))
1456 .arg(fromUTF8(repo.name().c_str()))
1461 for ( it = zypp::getZYpp()->pool().knownRepositoriesBegin();
1462 it != zypp::getZYpp()->pool().knownRepositoriesEnd();
1465 zypp::Repository repo(*it);
1469 if ( ! zypp::getZYpp()->resolver()->upgradingRepo(repo) &&
1470 ! repo.isSystemRepo() &&
1473 _repoUpgradeLabel->setText(_repoUpgradeLabel->text() + _(
"<p><a href=\"repoupgradeadd:///%1\">Switch system packages</a> to the versions in this repository (%2)</p>")
1474 .arg(fromUTF8(repo.alias().c_str()))
1475 .arg(fromUTF8(repo.name().c_str()))
1479 _repoUpgradeLabel->setVisible(!_repoUpgradeLabel->text().isEmpty() &&
1480 _repoFilterView->isVisible() );
1481 _repoUpgradingLabel->setVisible(!_repoUpgradingLabel->text().isEmpty());
1487 yuiDebug() <<
"link " << link <<
" clicked on label" << std::endl;
1490 if (url.scheme() ==
"repoupgradeadd")
1492 yuiDebug() <<
"looking for repo " << url.path() << std::endl;
1493 std::string alias(url.path().remove(0,1).toStdString());
1494 zypp::Repository repo(zypp::getZYpp()->pool().reposFind(alias));
1495 yuiDebug() << repo << std::endl;
1497 if ( repo != zypp::Repository::noRepository )
1498 zypp::getZYpp()->resolver()->addUpgradeRepo(repo);
1500 else if (url.scheme() ==
"repoupgraderemove")
1502 std::string alias(url.path().remove(0,1).toStdString());
1503 zypp::Repository repo(zypp::getZYpp()->pool().reposFind(alias));
1505 if ( repo != zypp::Repository::noRepository )
1506 zypp::getZYpp()->resolver()->removeUpgradeRepo(repo);
1509 yuiDebug() <<
"unknown link operation " << url.scheme() << std::endl;
1552 if ( _optionsMenu && _pkgList )
1554 if ( _excludeDebugInfoPkgs )
1555 _excludeDebugInfoPkgs->
enable( ! on );
1563 YQPackageSelector::pkgExcludeDevelChanged(
bool on )
1565 if ( _optionsMenu && _pkgList )
1567 if ( _excludeDevelPkgs )
1568 _excludeDevelPkgs->
enable( ! on );
1576 YQPackageSelector::pkgVerifySytemModeChanged(
bool on )
1578 zypp::getZYpp()->resolver()->setSystemVerification( on );
1582 YQPackageSelector::pkgIgnoreAlreadyRecommendedChanged(
bool on )
1584 zypp::getZYpp()->resolver()->setIgnoreAlreadyRecommended( on );
1589 YQPackageSelector::pkgCleanDepsOnRemoveChanged(
bool on )
1591 zypp::getZYpp()->resolver()->setCleandepsOnRemove( on );
1597 YQPackageSelector::pkgAllowVendorChangeChanged(
bool on )
1599 zypp::getZYpp()->resolver()->setAllowVendorChange( on );
1610 QMap<QString, ZyppSel> subPkgs;
1612 for ( ZyppPoolIterator it = zyppPkgBegin();
1616 QString name = (*it)->name().c_str();
1618 if ( name.endsWith( suffix ) || name.endsWith( suffix +
"-32bit" ) )
1620 subPkgs[ name ] = *it;
1622 yuiDebug() <<
"Found subpackage: " << name << std::endl;
1629 for ( ZyppPoolIterator it = zyppPkgBegin();
1633 QString name = (*it)->name().c_str();
1635 if ( subPkgs.contains( name + suffix ) )
1637 QString subPkgName( name + suffix );
1638 ZyppSel subPkg = subPkgs[ subPkgName ];
1640 switch ( (*it)->status() )
1648 yuiMilestone() <<
"Ignoring unwanted subpackage " << subPkgName << std::endl;
1653 case S_KeepInstalled:
1657 if ( ! subPkg->installedObj() )
1659 subPkg->setStatus( S_Install );
1660 yuiMilestone() <<
"Installing subpackage " << subPkgName << std::endl;
1670 if ( ! subPkg->installedObj() )
1672 subPkg->setStatus( S_Install );
1673 yuiMilestone() <<
"Installing subpackage " << subPkgName << std::endl;
1677 subPkg->setStatus( S_Update );
1678 yuiMilestone() <<
"Updating subpackage " << subPkgName << std::endl;
1689 if ( _filters && _statusFilterView )
1691 _filters->
showPage( _statusFilterView );
1692 _statusFilterView->
filter();
1696 _(
"Added Subpackages:" ),
1697 QRegExp(
".*" + suffix +
"$" ),
1700 YQPkgChangesDialog::FilterAutomatic,
1701 YQPkgChangesDialog::OptionNone );
1707 QString settingsName =
"YQPackageSelector";
1708 if ( onlineUpdateMode() ) settingsName =
"YQOnlineUpdate";
1709 if ( updateMode() ) settingsName =
"YQSystemUpdate";
1711 QSettings settings( QSettings::UserScope, SETTINGS_DIR, settingsName );
1713 _autoDependenciesAction->setChecked( settings.value(
"Options/AutocheckDependencies",
1714 AUTO_CHECK_DEPENDENCIES_DEFAULT ).toBool() ) ;
1716 _showDevelAction->setChecked(settings.value(
"Options/showDevelPackages",
true).toBool());
1717 pkgExcludeDevelChanged(_showDevelAction->isChecked());
1719 _showDebugAction->setChecked(settings.value(
"Options/showDebugPackages",
true).toBool());
1722 _verifySystemModeAction->setChecked( settings.value(
"Options/systemVerificationMode",
1723 zypp::getZYpp()->resolver()->systemVerification() ).toBool() );
1724 pkgVerifySytemModeChanged ( _verifySystemModeAction->isChecked() );
1726 _ignoreAlreadyRecommendAction->setChecked(
1727 settings.value(
"Options/IgnoreRecommendedPackagesForAlreadyInstalledPackages",
1728 zypp::getZYpp()->resolver()->ignoreAlreadyRecommended() ).toBool() );
1729 pkgIgnoreAlreadyRecommendedChanged(_ignoreAlreadyRecommendAction->isChecked());
1732 _cleanDepsOnRemoveAction->setChecked( settings.value(
"Options/CleanupWhenDeletingPackages",
1733 zypp::getZYpp()->resolver()->cleandepsOnRemove()).toBool() );
1734 pkgCleanDepsOnRemoveChanged(_cleanDepsOnRemoveAction->isChecked());
1736 _allowVendorChangeAction->setChecked( settings.value(
"Options/AllowVendorChange",
1737 zypp::getZYpp()->resolver()->allowVendorChange() ).toBool() );
1738 pkgAllowVendorChangeChanged(_allowVendorChangeAction->isChecked());
1747 QString settingsName =
"YQPackageSelector";
1748 if ( onlineUpdateMode() ) settingsName =
"YQOnlineUpdate";
1749 if ( updateMode() ) settingsName =
"YQSystemUpdate";
1751 QSettings settings( QSettings::UserScope, SETTINGS_DIR, settingsName );
1753 settings.setValue(
"Options/AutocheckDependencies", _autoDependenciesAction->isChecked() );
1754 settings.setValue(
"Options/showDevelPackages", _showDevelAction->isChecked() );
1755 settings.setValue(
"Options/showDebugPackages", _showDebugAction->isChecked() );
1756 settings.setValue(
"Options/systemVerificationMode", _verifySystemModeAction->isChecked() );
1757 settings.setValue(
"Options/IgnoreRecommendedPackagesForAlreadyInstalledPackages", _ignoreAlreadyRecommendAction->isChecked() );
1758 settings.setValue(
"Options/CleanupWhenDeletingPackages", _cleanDepsOnRemoveAction->isChecked() );
1759 settings.setValue(
"Options/AllowVendorChange", _allowVendorChangeAction->isChecked() );
1763 #include "YQPackageSelector.moc"
Display the description of a ZyppObj derived object along with its name and summary.
void onlineUpdateConfiguration()
void addPatchFilterView()
void showPage(QWidget *page)
QWidget * rightPane() const
int globalSetPkgStatus(ZyppStatus newStatus, bool force, bool countOnly)
void connectFilter(QWidget *filter, QWidget *pkgList, bool hasUpdateSignal=true)
void addPage(const QString &pageLabel, QWidget *pageContent, const QString &internalName)
static int countEnabledRepositories()
YQPkgDiskUsageList * diskUsageList() const
Filter view for packages that made problems during update.
static bool haveInstalledPkgs()
void importSelectable(ZyppSel selectable, bool isWanted, const char *kind)
void updateRepositoryUpgradeLabel()
static void showHistoryDialog()
int manualResolvePackageDependencies()
void enable(bool enable=true)
Display a list of zypp::Patch objects and ( below ) details about the currently selected patch...
void slotRepoUpgradeLabelLinkClicked(const QString &link)
Display a pkg's file list.
static std::string iconPath(const std::string &name, int size)
Display a list of zypp::Package objects.
Display a list of zypp::Pattern objects.
Filter view for searching within packages.
void installDebugInfoPkgs()
Display technical details (very much like 'rpm -qi') for a ZYPP object - the installed instance...
Filter view for packages that made problems during update.
Package version selector: Display a list of available versions from all the different installation so...
void autoResolveDependencies()
static void showProductDialog()
static bool haveProblematicPackages()
Display a list of zypp::Selection objects.
static bool showChangesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString::null, Filters f=FilterAutomatic, Options o=OptionAutoAcceptIfEmpty)
virtual QMenu * addAllInListSubMenu(QMenu *menu)
void installDebugSourcePkgs()
virtual QMenu * addAllInListSubMenu(QMenu *menu)
YQPkgPatchList * patchList() const
void hotkeyInsertPatchFilterView()
void installSubPkgs(const QString &suffix)
Display technical details ( very much like 'rpm -qi' ) for a zypp::Package object - the installed ins...
int resolveDependencies()
void pkgExcludeDebugChanged(bool on)
int solveAndShowConflicts()
void globalUpdatePkgForce()
Display a pkg's file list.
zypp::Repository selectedRepo() const