Add serial key in app settings #4715

This commit is contained in:
Jerry (Xinyu Hou) 2015-10-22 16:31:46 -07:00
parent 3bc46dca2d
commit bc768cbca3
3 changed files with 11 additions and 1 deletions

View File

@ -132,6 +132,7 @@ void AppConfig::loadSettings()
m_UserToken = settings().value("userToken", "").toString();
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
m_AutoHide = settings().value("autoHide", false).toBool();
m_Serialkey = settings().value("serialKey", "").toString();
}
void AppConfig::saveSettings()
@ -153,6 +154,7 @@ void AppConfig::saveSettings()
settings().setValue("userToken", m_UserToken);
settings().setValue("cryptoEnabled", m_CryptoEnabled);
settings().setValue("autoHide", m_AutoHide);
settings().setValue("serialKey", m_Serialkey);
}
void AppConfig::setAutoConfig(bool autoConfig)

View File

@ -78,6 +78,8 @@ class AppConfig
QString activateEmail() { return m_ActivateEmail; }
void setUserToken(QString t) { m_UserToken = t; }
QString userToken() { return m_UserToken; }
void setSerialKey(QString serial) { m_Serialkey = serial; }
QString serialKey() { return m_Serialkey; }
QString synergysName() const { return m_SynergysName; }
QString synergycName() const { return m_SynergycName; }
@ -129,6 +131,7 @@ class AppConfig
QString m_UserToken;
bool m_CryptoEnabled;
bool m_AutoHide;
QString m_Serialkey;
static const char m_SynergysName[];
static const char m_SynergycName[];

View File

@ -60,6 +60,7 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
AppConfig& appConfig = m_MainWindow.appConfig();
m_pLineEditEmail->setText(appConfig.activateEmail());
m_pLineEditSerialKey->setText(appConfig.serialKey());
m_pLineEditSerialKey->setEnabled(false);
@ -108,7 +109,6 @@ bool SetupWizard::validateCurrentPage()
return false;
}
else {
// plugin page no longer requires email and password
// create subscription file in profile directory
SubscriptionManager subscriptionManager;
bool r = subscriptionManager.activateSerial(m_pLineEditSerialKey->text());
@ -196,6 +196,11 @@ void SetupWizard::accept()
appConfig.setEdition(m_Edition);
}
if (m_pRadioButtonSubscription->isChecked())
{
appConfig.setSerialKey(m_pLineEditSerialKey->text());
}
m_MainWindow.setEdition(m_Edition);
m_MainWindow.updateLocalFingerprint();