#5629 Show activation dialog only after main window

This commit is contained in:
Andrew Nelless 2016-10-03 17:23:10 +01:00 committed by Andrew Nelless
parent 176d7e4725
commit 15a6a27dc6
4 changed files with 13 additions and 8 deletions

View File

@ -152,6 +152,7 @@ void ActivationDialog::accept()
} }
m_appConfig->setEdition(edition); m_appConfig->setEdition(edition);
m_appConfig->activationHasRun(true);
m_appConfig->saveSettings(); m_appConfig->saveSettings();
message.information (this, "Activated!", message.information (this, "Activated!",
@ -159,7 +160,7 @@ void ActivationDialog::accept()
MainWindow& mainWindow = dynamic_cast<MainWindow&>(*this->parent()); MainWindow& mainWindow = dynamic_cast<MainWindow&>(*this->parent());
mainWindow.setEdition(edition); mainWindow.setEdition(edition);
mainWindow.updateLocalFingerprint(); mainWindow.updateLocalFingerprint();
mainWindow.settings().sync(); mainWindow.saveSettings();
QDialog::accept(); QDialog::accept();
} }

View File

@ -139,19 +139,20 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_pLabelPadlock->hide(); m_pLabelPadlock->hide();
if (!appConfig.activationHasRun() && (appConfig.edition() == Unregistered)) {
ActivationDialog activationDialog (this, appConfig);
activationDialog.exec();
appConfig.activationHasRun(true);
}
if (appConfig.getCryptoEnabled()) { if (appConfig.getCryptoEnabled()) {
m_pSslCertificate = new SslCertificate(this); m_pSslCertificate = new SslCertificate(this);
m_pSslCertificate->generateCertificate(); m_pSslCertificate->generateCertificate();
} }
updateLocalFingerprint(); updateLocalFingerprint();
appConfig.saveSettings(); }
void
MainWindow::showEvent(QShowEvent*) {
if (!m_AppConfig.activationHasRun() && (m_AppConfig.edition() == Unregistered)) {
ActivationDialog activationDialog (this, m_AppConfig);
activationDialog.exec();
}
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()

View File

@ -66,6 +66,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
friend class QSynergyApplication; friend class QSynergyApplication;
friend class SetupWizard; friend class SetupWizard;
friend class ActivationDialog; friend class ActivationDialog;
friend class SettingsDialog;
public: public:
enum qSynergyState enum qSynergyState
@ -181,6 +182,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void restartSynergy(); void restartSynergy();
void proofreadInfo(); void proofreadInfo();
void showEvent(QShowEvent *event);
private: private:
QSettings& m_Settings; QSettings& m_Settings;
AppConfig& m_AppConfig; AppConfig& m_AppConfig;

View File

@ -151,5 +151,6 @@ void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked)
sslCertificate.generateCertificate(); sslCertificate.generateCertificate();
MainWindow& mainWindow = dynamic_cast<MainWindow&> (*this->parent()); MainWindow& mainWindow = dynamic_cast<MainWindow&> (*this->parent());
mainWindow.updateLocalFingerprint(); mainWindow.updateLocalFingerprint();
mainWindow.saveSettings();
} }
} }