diff --git a/src/gui/res/ActivationDialog.ui b/src/gui/res/ActivationDialog.ui
index 1d66c454..1425ee0c 100644
--- a/src/gui/res/ActivationDialog.ui
+++ b/src/gui/res/ActivationDialog.ui
@@ -54,6 +54,57 @@ p, li { white-space: pre-wrap; }
+ -
+
+
+
+ 2
+
+
+ 0
+
+
+ 0
+
+
+ 8
+
+
-
+
+
+
+
+
+ :/res/icons/16x16/money.png
+
+
+
+ -
+
+
+ <html><head/><body><p>Your trial has expired. <a href="http://symless.com/pricing?src=gui"><span style=" text-decoration: underline; color:#0000ff;">Buy now!</span></a></p></body></html>
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
-
@@ -66,7 +117,9 @@ p, li { white-space: pre-wrap; }
-
+
+
+
buttonBox
diff --git a/src/gui/src/ActivationDialog.cpp b/src/gui/src/ActivationDialog.cpp
index 4ad3d7b4..3f1cab9f 100644
--- a/src/gui/src/ActivationDialog.cpp
+++ b/src/gui/src/ActivationDialog.cpp
@@ -23,6 +23,10 @@ ActivationDialog::ActivationDialog(QWidget* parent, AppConfig& appConfig,
{
ui->setupUi(this);
refreshSerialKey();
+ time_t currentTime = ::time(0);
+ if (!m_LicenseManager->serialKey().isExpired(currentTime)) {
+ ui->m_trialWidget->hide();
+ }
}
void ActivationDialog::refreshSerialKey()
diff --git a/src/gui/src/LicenseManager.cpp b/src/gui/src/LicenseManager.cpp
index b82a2648..d3a865e1 100644
--- a/src/gui/src/LicenseManager.cpp
+++ b/src/gui/src/LicenseManager.cpp
@@ -44,17 +44,17 @@ LicenseManager::setSerialKey(QString serialKeyString, bool acceptExpired)
if (serialKey != m_serialKey) {
using std::swap;
swap (serialKey, m_serialKey);
- m_AppConfig->setSerialKey (serialKeyString);
- notifyActivation ("serial:" + serialKeyString);
- emit serialKeyChanged (m_serialKey);
+ m_AppConfig->setSerialKey(serialKeyString);
+ notifyActivation("serial:" + serialKeyString);
+ emit serialKeyChanged(m_serialKey);
if (serialKey.isTrial()) {
emit endTrial(false);
}
if (m_serialKey.edition() != serialKey.edition()) {
- m_AppConfig->setEdition (m_serialKey.edition());
- emit editionChanged (m_serialKey.edition());
+ m_AppConfig->setEdition(m_serialKey.edition());
+ emit editionChanged(m_serialKey.edition());
}
if (m_serialKey.isTrial()) {
@@ -91,7 +91,9 @@ LicenseManager::serialKey() const
void LicenseManager::refresh(bool acceptExpired)
{
- setSerialKey (m_AppConfig->serialKey(), acceptExpired);
+ if (!m_AppConfig->serialKey().isEmpty()) {
+ setSerialKey(m_AppConfig->serialKey(), acceptExpired);
+ }
}
void LicenseManager::skipActivation()
diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp
index 4efc88ce..10308d2b 100644
--- a/src/gui/src/MainWindow.cpp
+++ b/src/gui/src/MainWindow.cpp
@@ -420,8 +420,10 @@ void MainWindow::appendLogRaw(const QString& text)
void MainWindow::updateFromLogLine(const QString &line)
{
+ // TODO: this code makes Andrew cry
checkConnected(line);
checkFingerprint(line);
+ checkLicense(line);
}
void MainWindow::checkConnected(const QString& line)
@@ -449,7 +451,7 @@ void MainWindow::checkConnected(const QString& line)
void MainWindow::checkLicense(const QString &line)
{
if (line.contains("trial has expired")) {
- m_LicenseManager->refresh(true);
+ raiseActivationDialog();
}
}
@@ -541,6 +543,14 @@ void MainWindow::clearLog()
void MainWindow::startSynergy()
{
+ SerialKey serialKey = m_LicenseManager->serialKey();
+ time_t currentTime = ::time(0);
+ if (serialKey.isExpired(currentTime)) {
+ if (QDialog::Rejected == raiseActivationDialog()) {
+ return;
+ }
+ }
+
bool desktopMode = appConfig().processMode() == Desktop;
bool serviceMode = appConfig().processMode() == Service;
@@ -1233,11 +1243,7 @@ void MainWindow::on_m_pButtonConfigureServer_clicked()
void MainWindow::on_m_pActivate_triggered()
{
- ActivationDialog activationDialog(this, appConfig(), licenseManager());
- m_ActivationDialogRunning = true;
- connect (&activationDialog, SIGNAL(finished(int)),
- this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
- activationDialog.exec();
+ raiseActivationDialog();
}
void MainWindow::on_m_pButtonApply_clicked()
@@ -1452,22 +1458,16 @@ void MainWindow::bonjourInstallFinished()
m_pCheckBoxAutoConfig->setChecked(true);
}
-void MainWindow::on_windowShown()
+int MainWindow::raiseActivationDialog()
{
- time_t currentTime = ::time(0);
- if (!m_AppConfig->activationHasRun()
- && ((m_AppConfig->edition() == kUnregistered) ||
- (m_LicenseManager->serialKey().isExpired(currentTime)))) {
- ActivationDialog activationDialog (this, appConfig(), licenseManager());
- m_ActivationDialogRunning = true;
- connect (&activationDialog, SIGNAL(finished(int)),
- this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
- activationDialog.exec();
+ if (m_ActivationDialogRunning) {
+ return QDialog::Rejected;
}
-}
-
-void MainWindow::on_activationDialogFinish()
-{
+ ActivationDialog activationDialog (this, appConfig(), licenseManager());
+ m_ActivationDialogRunning = true;
+ connect (&activationDialog, SIGNAL(finished(int)),
+ this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
+ int result = activationDialog.exec();
m_ActivationDialogRunning = false;
if (!m_PendingClientNames.empty()) {
foreach (const QString& name, m_PendingClientNames) {
@@ -1476,6 +1476,20 @@ void MainWindow::on_activationDialogFinish()
m_PendingClientNames.clear();
}
+ if (result == QDialog::Accepted) {
+ restartSynergy();
+ }
+ return result;
+}
+
+void MainWindow::on_windowShown()
+{
+ time_t currentTime = ::time(0);
+ if (!m_AppConfig->activationHasRun()
+ && ((m_AppConfig->edition() == kUnregistered) ||
+ (m_LicenseManager->serialKey().isExpired(currentTime)))) {
+ raiseActivationDialog();
+ }
}
QString MainWindow::getProfileRootForArg()
diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h
index 632abec2..2ca3e711 100644
--- a/src/gui/src/MainWindow.h
+++ b/src/gui/src/MainWindow.h
@@ -120,7 +120,9 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void updateLocalFingerprint();
LicenseManager& licenseManager() const;
- public slots:
+ int raiseActivationDialog();
+
+public slots:
void setEdition(Edition edition);
void beginTrial(bool isExpiring);
void endTrial(bool isExpired);
@@ -230,7 +232,6 @@ private slots:
void on_m_pButtonApply_clicked();
void installBonjour();
void on_windowShown();
- void on_activationDialogFinish();
signals:
void windowShown();