diff --git a/core.cpp b/core.cpp index a31ed51e2..efaa68e7f 100644 --- a/core.cpp +++ b/core.cpp @@ -213,14 +213,17 @@ void Core::start() qsrand(time(nullptr)); - if (!loadConfiguration(loadPath)) // loadPath is meaningless after this - { - emit failedToStart(); - tox_kill(tox); - tox = nullptr; - return; + if (loadPath != "") + { + if (!loadConfiguration(loadPath)) // loadPath is meaningless after this + { + emit failedToStart(); + tox_kill(tox); + tox = nullptr; + return; + } + loadPath = ""; } - loadPath = ""; tox_callback_friend_request(tox, onFriendRequest, this); tox_callback_friend_message(tox, onFriendMessage, this); diff --git a/widget/widget.cpp b/widget/widget.cpp index 84d18bc81..85ce6ae3c 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -230,9 +230,17 @@ QString Widget::detectProfile() QFile file(path); if (file.exists()) return path; + else if (QFile(path = dir.filePath("tox_save")).exists()) // also import tox_save if no data + return path; else #endif - return dir.filePath(askProfiles() + Core::TOX_EXT); + { + profile = askProfiles(); + if (profile != "") + return dir.filePath(profile + Core::TOX_EXT); + else + return ""; + } } else return path; @@ -250,8 +258,9 @@ QList Widget::searchProfiles() } QString Widget::askProfiles() -{ +{ // TODO: allow user to create new Tox ID, even if a profile already exists QList profiles = searchProfiles(); + if (profiles.empty()) return ""; bool ok; QString profile = QInputDialog::getItem(this, tr("Choose a profile"),