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

Don't allow overwriting on profile rename

This commit is contained in:
tux3 2015-06-04 15:27:22 +02:00
parent 10ce65c22b
commit a03eea9b5f

View File

@ -237,16 +237,14 @@ void ProfileForm::onRenameClicked()
if (name.isEmpty()) break;
name = Core::sanitize(name);
if (!Profile::profileExists(name) || GUI::askQuestion(tr("Profile already exists", "rename confirm title"),
tr("A profile named \"%1\" already exists. Do you want to erase it?", "rename confirm text").arg(name)))
{
if (!nexus.getProfile()->rename(name))
GUI::showError(tr("Failed to rename", "rename failed title"),
tr("Couldn't rename the profile to \"%1\"").arg(cur));
if (Profile::profileExists(name))
GUI::showError(tr("Profile already exists", "rename failure title"),
tr("A profile named \"%1\" already exists.", "rename confirm text").arg(name));
else if (!nexus.getProfile()->rename(name))
GUI::showError(tr("Failed to rename", "rename failed title"),
tr("Couldn't rename the profile to \"%1\"").arg(cur));
else
break;
}
} while (true);
}