1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix more save corruption bugs

askProfiles is a really dangerous function. Awful things happen when the user closes that message box. We now prevent it from being closed in more places
This commit is contained in:
tux3 2015-04-25 21:33:15 +02:00
parent 7eb9370c0b
commit d962148dd0
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -863,10 +863,11 @@ QByteArray Core::loadToxSave(QString path)
GUI::showWarning(tr("Profile already in use"),
tr("Your profile is already used by another qTox\n"
"Please select another profile"));
path = Settings::getInstance().askProfiles();
if (path.isEmpty())
QString tmppath = Settings::getInstance().askProfiles();
if (tmppath.isEmpty())
continue;
Settings::getInstance().switchProfile(QFileInfo(path).baseName());
Settings::getInstance().switchProfile(tmppath);
path = QDir(Settings::getSettingsDirPath()).filePath(tmppath + TOX_EXT);
HistoryKeeper::resetInstance();
}
@ -875,7 +876,7 @@ QByteArray Core::loadToxSave(QString path)
if (!configurationFile.exists())
{
qWarning() << "The Tox configuration file was not found";
qWarning() << "The Tox configuration file "<<path<<" was not found";
return data;
}
@ -960,7 +961,9 @@ void Core::switchConfiguration(const QString& _profile)
GUI::showWarning(tr("Profile already in use"),
tr("Your profile is already used by another qTox instance\n"
"Please select another profile"));
profile = QFileInfo(Settings::getInstance().askProfiles()).baseName();
do {
profile = Settings::getInstance().askProfiles();
} while (profile.isEmpty());
}
if (profile.isEmpty())