#5657 Raise activation dialog when key expires
This commit is contained in:
parent
f441c24a23
commit
e01d0ce4c7
|
@ -54,6 +54,57 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="m_trialWidget" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="Synergy.qrc">:/res/icons/16x16/money.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="m_trialLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><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></string>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -66,7 +117,9 @@ p, li { white-space: pre-wrap; }
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="Synergy.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
|
|
|
@ -23,6 +23,10 @@ ActivationDialog::ActivationDialog(QWidget* parent, AppConfig& appConfig,
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
refreshSerialKey();
|
refreshSerialKey();
|
||||||
|
time_t currentTime = ::time(0);
|
||||||
|
if (!m_LicenseManager->serialKey().isExpired(currentTime)) {
|
||||||
|
ui->m_trialWidget->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivationDialog::refreshSerialKey()
|
void ActivationDialog::refreshSerialKey()
|
||||||
|
|
|
@ -44,17 +44,17 @@ LicenseManager::setSerialKey(QString serialKeyString, bool acceptExpired)
|
||||||
if (serialKey != m_serialKey) {
|
if (serialKey != m_serialKey) {
|
||||||
using std::swap;
|
using std::swap;
|
||||||
swap (serialKey, m_serialKey);
|
swap (serialKey, m_serialKey);
|
||||||
m_AppConfig->setSerialKey (serialKeyString);
|
m_AppConfig->setSerialKey(serialKeyString);
|
||||||
notifyActivation ("serial:" + serialKeyString);
|
notifyActivation("serial:" + serialKeyString);
|
||||||
emit serialKeyChanged (m_serialKey);
|
emit serialKeyChanged(m_serialKey);
|
||||||
|
|
||||||
if (serialKey.isTrial()) {
|
if (serialKey.isTrial()) {
|
||||||
emit endTrial(false);
|
emit endTrial(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_serialKey.edition() != serialKey.edition()) {
|
if (m_serialKey.edition() != serialKey.edition()) {
|
||||||
m_AppConfig->setEdition (m_serialKey.edition());
|
m_AppConfig->setEdition(m_serialKey.edition());
|
||||||
emit editionChanged (m_serialKey.edition());
|
emit editionChanged(m_serialKey.edition());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_serialKey.isTrial()) {
|
if (m_serialKey.isTrial()) {
|
||||||
|
@ -91,7 +91,9 @@ LicenseManager::serialKey() const
|
||||||
|
|
||||||
void LicenseManager::refresh(bool acceptExpired)
|
void LicenseManager::refresh(bool acceptExpired)
|
||||||
{
|
{
|
||||||
setSerialKey (m_AppConfig->serialKey(), acceptExpired);
|
if (!m_AppConfig->serialKey().isEmpty()) {
|
||||||
|
setSerialKey(m_AppConfig->serialKey(), acceptExpired);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LicenseManager::skipActivation()
|
void LicenseManager::skipActivation()
|
||||||
|
|
|
@ -420,8 +420,10 @@ void MainWindow::appendLogRaw(const QString& text)
|
||||||
|
|
||||||
void MainWindow::updateFromLogLine(const QString &line)
|
void MainWindow::updateFromLogLine(const QString &line)
|
||||||
{
|
{
|
||||||
|
// TODO: this code makes Andrew cry
|
||||||
checkConnected(line);
|
checkConnected(line);
|
||||||
checkFingerprint(line);
|
checkFingerprint(line);
|
||||||
|
checkLicense(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkConnected(const QString& line)
|
void MainWindow::checkConnected(const QString& line)
|
||||||
|
@ -449,7 +451,7 @@ void MainWindow::checkConnected(const QString& line)
|
||||||
void MainWindow::checkLicense(const QString &line)
|
void MainWindow::checkLicense(const QString &line)
|
||||||
{
|
{
|
||||||
if (line.contains("trial has expired")) {
|
if (line.contains("trial has expired")) {
|
||||||
m_LicenseManager->refresh(true);
|
raiseActivationDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,6 +543,14 @@ void MainWindow::clearLog()
|
||||||
|
|
||||||
void MainWindow::startSynergy()
|
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 desktopMode = appConfig().processMode() == Desktop;
|
||||||
bool serviceMode = appConfig().processMode() == Service;
|
bool serviceMode = appConfig().processMode() == Service;
|
||||||
|
|
||||||
|
@ -1233,11 +1243,7 @@ void MainWindow::on_m_pButtonConfigureServer_clicked()
|
||||||
|
|
||||||
void MainWindow::on_m_pActivate_triggered()
|
void MainWindow::on_m_pActivate_triggered()
|
||||||
{
|
{
|
||||||
ActivationDialog activationDialog(this, appConfig(), licenseManager());
|
raiseActivationDialog();
|
||||||
m_ActivationDialogRunning = true;
|
|
||||||
connect (&activationDialog, SIGNAL(finished(int)),
|
|
||||||
this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
|
|
||||||
activationDialog.exec();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_m_pButtonApply_clicked()
|
void MainWindow::on_m_pButtonApply_clicked()
|
||||||
|
@ -1452,22 +1458,16 @@ void MainWindow::bonjourInstallFinished()
|
||||||
m_pCheckBoxAutoConfig->setChecked(true);
|
m_pCheckBoxAutoConfig->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_windowShown()
|
int MainWindow::raiseActivationDialog()
|
||||||
{
|
{
|
||||||
time_t currentTime = ::time(0);
|
if (m_ActivationDialogRunning) {
|
||||||
if (!m_AppConfig->activationHasRun()
|
return QDialog::Rejected;
|
||||||
&& ((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();
|
|
||||||
}
|
}
|
||||||
}
|
ActivationDialog activationDialog (this, appConfig(), licenseManager());
|
||||||
|
m_ActivationDialogRunning = true;
|
||||||
void MainWindow::on_activationDialogFinish()
|
connect (&activationDialog, SIGNAL(finished(int)),
|
||||||
{
|
this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
|
||||||
|
int result = activationDialog.exec();
|
||||||
m_ActivationDialogRunning = false;
|
m_ActivationDialogRunning = false;
|
||||||
if (!m_PendingClientNames.empty()) {
|
if (!m_PendingClientNames.empty()) {
|
||||||
foreach (const QString& name, m_PendingClientNames) {
|
foreach (const QString& name, m_PendingClientNames) {
|
||||||
|
@ -1476,6 +1476,20 @@ void MainWindow::on_activationDialogFinish()
|
||||||
|
|
||||||
m_PendingClientNames.clear();
|
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()
|
QString MainWindow::getProfileRootForArg()
|
||||||
|
|
|
@ -120,7 +120,9 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void updateLocalFingerprint();
|
void updateLocalFingerprint();
|
||||||
LicenseManager& licenseManager() const;
|
LicenseManager& licenseManager() const;
|
||||||
|
|
||||||
public slots:
|
int raiseActivationDialog();
|
||||||
|
|
||||||
|
public slots:
|
||||||
void setEdition(Edition edition);
|
void setEdition(Edition edition);
|
||||||
void beginTrial(bool isExpiring);
|
void beginTrial(bool isExpiring);
|
||||||
void endTrial(bool isExpired);
|
void endTrial(bool isExpired);
|
||||||
|
@ -230,7 +232,6 @@ private slots:
|
||||||
void on_m_pButtonApply_clicked();
|
void on_m_pButtonApply_clicked();
|
||||||
void installBonjour();
|
void installBonjour();
|
||||||
void on_windowShown();
|
void on_windowShown();
|
||||||
void on_activationDialogFinish();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void windowShown();
|
void windowShown();
|
||||||
|
|
Loading…
Reference in New Issue