summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
authorFrerich Raabe <raabe@froglogic.com>2015-11-09 22:18:23 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-12-08 13:06:29 +0000
commitac89d6b1e6fd50689cd047a8a92a0841367ff844 (patch)
tree692f8b081e47dec74b9ba592b1228483b2a21d2c /src/sdk
parentf747e559e12e4a9d675e26070d7d0c510d9106c8 (diff)
Automatically chose to perform uninstall if appropriate
This patch makes the maintenance tool automatically chose (but not start) deinstallation if there are no valid repositories available. Without this, all three options are available but the first two will show an error message if there is not even one repository available. This simplifies the maintenance tool for purely offline installers which use no repositories whatsoever. Change-Id: If496ac6858191c758a7bae6ec4a9434f88ddaac0 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/installerbasecommons.cpp23
-rw-r--r--src/sdk/installerbasecommons.h3
2 files changed, 23 insertions, 3 deletions
diff --git a/src/sdk/installerbasecommons.cpp b/src/sdk/installerbasecommons.cpp
index 2f916a81d..017a95d2d 100644
--- a/src/sdk/installerbasecommons.cpp
+++ b/src/sdk/installerbasecommons.cpp
@@ -37,6 +37,7 @@
#include <scriptengine.h>
#include <packagemanagerpagefactory.h>
#include <productkeycheck.h>
+#include <settings.h>
using namespace QInstaller;
@@ -90,9 +91,15 @@ MaintenanceGui::MaintenanceGui(PackageManagerCore *core)
connect(intro, &IntroductionPage::packageManagerCoreTypeChanged,
this, &MaintenanceGui::updateRestartPage);
- setPage(PackageManagerCore::Introduction, intro);
- setPage(PackageManagerCore::ComponentSelection, new ComponentSelectionPage(core));
- setPage(PackageManagerCore::LicenseCheck, new LicenseAgreementPage(core));
+ if (!core->isOfflineOnly() || validRepositoriesAvailable()) {
+ setPage(PackageManagerCore::Introduction, intro);
+ setPage(PackageManagerCore::ComponentSelection, new ComponentSelectionPage(core));
+ setPage(PackageManagerCore::LicenseCheck, new LicenseAgreementPage(core));
+ } else {
+ core->setUninstaller();
+ core->setCompleteUninstallation(true);
+ }
+
setPage(PackageManagerCore::ReadyForInstallation, new ReadyForInstallationPage(core));
setPage(PackageManagerCore::PerformInstallation, new PerformInstallationPage(core));
setPage(PackageManagerCore::InstallationFinished, new FinishedPage(core));
@@ -116,3 +123,13 @@ void MaintenanceGui::updateRestartPage()
wizardPageVisibilityChangeRequested((packageManagerCore()->isUninstaller() ? false : true),
PackageManagerCore::InstallationFinished + 1);
}
+
+bool MaintenanceGui::validRepositoriesAvailable() const
+{
+ foreach (const Repository &repo, packageManagerCore()->settings().repositories()) {
+ if (repo.isEnabled() && repo.isValid()) {
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/src/sdk/installerbasecommons.h b/src/sdk/installerbasecommons.h
index a6e55e989..8a5c7bb76 100644
--- a/src/sdk/installerbasecommons.h
+++ b/src/sdk/installerbasecommons.h
@@ -62,6 +62,9 @@ public:
private Q_SLOTS:
void updateRestartPage();
+
+private:
+ bool validRepositoriesAvailable() const;
};
#endif // INSTALLERBASECOMMONS_H