From 492df1f3fd66de2b0020e8444585ff33c3cc9fe2 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Tue, 25 Oct 2016 16:27:12 +0100 Subject: [PATCH] #5657 Stop service and refresh license when trial expires --- src/gui/src/LicenseManager.cpp | 7 +++++-- src/gui/src/LicenseManager.h | 2 +- src/gui/src/MainWindow.cpp | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/src/LicenseManager.cpp b/src/gui/src/LicenseManager.cpp index d3a865e1..aa623c88 100644 --- a/src/gui/src/LicenseManager.cpp +++ b/src/gui/src/LicenseManager.cpp @@ -89,10 +89,13 @@ LicenseManager::serialKey() const return m_serialKey; } -void LicenseManager::refresh(bool acceptExpired) +void LicenseManager::refresh() { if (!m_AppConfig->serialKey().isEmpty()) { - setSerialKey(m_AppConfig->serialKey(), acceptExpired); + setSerialKey(m_AppConfig->serialKey(), true); + } + if (m_serialKey.isExpired(::time(0))) { + emit endTrial(true); } } diff --git a/src/gui/src/LicenseManager.h b/src/gui/src/LicenseManager.h index deac8b4f..3d1d03b8 100644 --- a/src/gui/src/LicenseManager.h +++ b/src/gui/src/LicenseManager.h @@ -31,7 +31,7 @@ class LicenseManager: public QObject public: LicenseManager(AppConfig* appConfig); std::pair setSerialKey(QString serialKey, bool acceptExpired = false); - void refresh(bool acceptExpired = false); + void refresh(); Edition activeEdition() const; QString activeEditionName() const; SerialKey serialKey() const; diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 8a2888fe..a431d27e 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -156,7 +156,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig, this, SLOT(sslToggled(bool)), Qt::QueuedConnection); setWindowTitle (m_LicenseManager->activeEditionName()); - m_LicenseManager->refresh(true); + m_LicenseManager->refresh(); } MainWindow::~MainWindow() @@ -451,6 +451,7 @@ void MainWindow::checkConnected(const QString& line) void MainWindow::checkLicense(const QString &line) { if (line.contains("trial has expired")) { + licenseManager().refresh(); raiseActivationDialog(); } }