summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/installerbase.cpp18
-rw-r--r--src/sdk/installerbase.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index 5c8478036..918a846fc 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -296,19 +296,14 @@ int InstallerBase::run()
if (parser.isSet(QLatin1String(CommandLineOptions::SilentUpdate))) {
if (m_core->isInstaller())
throw QInstaller::Error(QLatin1String("Cannot start installer binary as updater."));
- const ProductKeyCheck *const productKeyCheck = ProductKeyCheck::instance();
- if (!productKeyCheck->hasValidLicense())
- throw QInstaller::Error(QLatin1String("Silent update not allowed."));
+ checkLicense();
m_core->setUpdater();
m_core->updateComponentsSilently();
} else if (parser.isSet(QLatin1String(CommandLineOptions::ListInstalledPackages))){
if (m_core->isInstaller())
throw QInstaller::Error(QLatin1String("Cannot start installer binary as package manager."));
+ checkLicense();
m_core->setPackageManager();
-
- const ProductKeyCheck *const productKeyCheck = ProductKeyCheck::instance();
- if (!productKeyCheck->hasValidLicense())
- throw QInstaller::Error(QLatin1String("No valid license found."));
m_core->listInstalledPackages();
} else {
//create the wizard GUI
@@ -384,3 +379,12 @@ QStringList InstallerBase::repositories(const QString &list) const
qDebug().noquote() << "Adding custom repository:" << item;
return items;
}
+
+void InstallerBase::checkLicense()
+{
+ const ProductKeyCheck *const productKeyCheck = ProductKeyCheck::instance();
+ if (!productKeyCheck->hasValidLicense()) {
+ qDebug() << "No valid license found.";
+ throw QInstaller::Error(QLatin1String("No valid license found."));
+ }
+}
diff --git a/src/sdk/installerbase.h b/src/sdk/installerbase.h
index 677f567ee..3f51331cd 100644
--- a/src/sdk/installerbase.h
+++ b/src/sdk/installerbase.h
@@ -49,6 +49,7 @@ public:
private:
void dumpResourceTree() const;
QStringList repositories(const QString &list) const;
+ void checkLicense();
private:
QInstaller::PackageManagerCore *m_core;