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

read tox_save if no data; if no profiles, no popup

This commit is contained in:
dubslow 2014-10-10 17:07:18 -05:00
parent a99e7d2b94
commit 6ab90d4516
2 changed files with 21 additions and 9 deletions

View File

@ -213,14 +213,17 @@ void Core::start()
qsrand(time(nullptr)); qsrand(time(nullptr));
if (!loadConfiguration(loadPath)) // loadPath is meaningless after this if (loadPath != "")
{ {
emit failedToStart(); if (!loadConfiguration(loadPath)) // loadPath is meaningless after this
tox_kill(tox); {
tox = nullptr; emit failedToStart();
return; tox_kill(tox);
tox = nullptr;
return;
}
loadPath = "";
} }
loadPath = "";
tox_callback_friend_request(tox, onFriendRequest, this); tox_callback_friend_request(tox, onFriendRequest, this);
tox_callback_friend_message(tox, onFriendMessage, this); tox_callback_friend_message(tox, onFriendMessage, this);

View File

@ -230,9 +230,17 @@ QString Widget::detectProfile()
QFile file(path); QFile file(path);
if (file.exists()) if (file.exists())
return path; return path;
else if (QFile(path = dir.filePath("tox_save")).exists()) // also import tox_save if no data
return path;
else else
#endif #endif
return dir.filePath(askProfiles() + Core::TOX_EXT); {
profile = askProfiles();
if (profile != "")
return dir.filePath(profile + Core::TOX_EXT);
else
return "";
}
} }
else else
return path; return path;
@ -250,8 +258,9 @@ QList<QString> Widget::searchProfiles()
} }
QString Widget::askProfiles() QString Widget::askProfiles()
{ { // TODO: allow user to create new Tox ID, even if a profile already exists
QList<QString> profiles = searchProfiles(); QList<QString> profiles = searchProfiles();
if (profiles.empty()) return "";
bool ok; bool ok;
QString profile = QInputDialog::getItem(this, QString profile = QInputDialog::getItem(this,
tr("Choose a profile"), tr("Choose a profile"),