fix: fixed issue with not restoring autostart setting after backup (#1601)
* fixed issue with not restoring autostart setting after backup * fixed bug when autostart setting was not saving innto backup file and not preserving after backup * deleted unused lines
This commit is contained in:
parent
369e08844f
commit
43c3ce9a6e
1 changed files with 16 additions and 1 deletions
|
@ -126,7 +126,13 @@ void SettingsController::clearLogs()
|
||||||
|
|
||||||
void SettingsController::backupAppConfig(const QString &fileName)
|
void SettingsController::backupAppConfig(const QString &fileName)
|
||||||
{
|
{
|
||||||
SystemController::saveFile(fileName, m_settings->backupAppConfig());
|
QByteArray data = m_settings->backupAppConfig();
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(data);
|
||||||
|
QJsonObject config = doc.object();
|
||||||
|
|
||||||
|
config["Conf/autoStart"] = Autostart::isAutostart();
|
||||||
|
|
||||||
|
SystemController::saveFile(fileName, QJsonDocument(config).toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsController::restoreAppConfig(const QString &fileName)
|
void SettingsController::restoreAppConfig(const QString &fileName)
|
||||||
|
@ -140,6 +146,15 @@ void SettingsController::restoreAppConfigFromData(const QByteArray &data)
|
||||||
{
|
{
|
||||||
bool ok = m_settings->restoreAppConfig(data);
|
bool ok = m_settings->restoreAppConfig(data);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
QJsonObject newConfigData = QJsonDocument::fromJson(data).object();
|
||||||
|
|
||||||
|
#if defined(Q_OS_WINDOWS) || defined(Q_OS_LINUX) || defined(Q_OS_MACX)
|
||||||
|
bool autoStart = false;
|
||||||
|
if (newConfigData.contains("Conf/autoStart")) {
|
||||||
|
autoStart = newConfigData["Conf/autoStart"].toBool();
|
||||||
|
}
|
||||||
|
toggleAutoStart(autoStart);
|
||||||
|
#endif
|
||||||
m_serversModel->resetModel();
|
m_serversModel->resetModel();
|
||||||
m_languageModel->changeLanguage(
|
m_languageModel->changeLanguage(
|
||||||
static_cast<LanguageSettings::AvailableLanguageEnum>(m_languageModel->getCurrentLanguageIndex()));
|
static_cast<LanguageSettings::AvailableLanguageEnum>(m_languageModel->getCurrentLanguageIndex()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue