summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2017-05-12 12:22:54 +0300
committerKatja Marttila <katja.marttila@qt.io>2017-05-15 05:44:33 +0000
commit22d340e39e119b32baf18f206c7363743119b9c8 (patch)
tree365ea59250e52cfd97fe9102388402c0f448c955
parent41b18d6aa0277ae90bf6c76ee7bbc50696e7be26 (diff)
Check license when doing silentUpdate
Task-number: QTAUTO-428 Change-Id: Ib3d56b59a12d4c7091a6abdbc5231ed5dbe2c3b1 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
-rw-r--r--src/libs/installer/productkeycheck.cpp5
-rw-r--r--src/libs/installer/productkeycheck.h1
-rw-r--r--src/sdk/installerbase.cpp3
3 files changed, 9 insertions, 0 deletions
diff --git a/src/libs/installer/productkeycheck.cpp b/src/libs/installer/productkeycheck.cpp
index 4a8ce4677..c1dfe83d6 100644
--- a/src/libs/installer/productkeycheck.cpp
+++ b/src/libs/installer/productkeycheck.cpp
@@ -101,3 +101,8 @@ QList<int> ProductKeyCheck::registeredPages() const
{
return QList<int>();
}
+
+bool ProductKeyCheck::hasValidLicense() const
+{
+ return true;
+}
diff --git a/src/libs/installer/productkeycheck.h b/src/libs/installer/productkeycheck.h
index 221fdc7ef..b7e8c6d52 100644
--- a/src/libs/installer/productkeycheck.h
+++ b/src/libs/installer/productkeycheck.h
@@ -66,6 +66,7 @@ public:
bool isValidPackage(const QString &packageName) const;
QList<int> registeredPages() const;
+ bool hasValidLicense() const;
private:
ProductKeyCheck();
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index e09e651a2..043d7beca 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -287,6 +287,9 @@ 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."));
m_core->setUpdater();
m_core->updateComponentsSilently();
}