mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Update lock when renaming profile
This commit is contained in:
parent
bbf75aefb9
commit
ea417d3688
|
@ -27,6 +27,7 @@
|
||||||
#include "src/widget/gui.h"
|
#include "src/widget/gui.h"
|
||||||
#include "src/historykeeper.h"
|
#include "src/historykeeper.h"
|
||||||
#include "src/misc/style.h"
|
#include "src/misc/style.h"
|
||||||
|
#include "src/profilelocker.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
@ -247,6 +248,13 @@ void ProfileForm::onRenameClicked()
|
||||||
if (!QFile::exists(file) || GUI::askQuestion(tr("Profile already exists", "rename confirm title"),
|
if (!QFile::exists(file) || 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(cur)))
|
tr("A profile named \"%1\" already exists. Do you want to erase it?", "rename confirm text").arg(cur)))
|
||||||
{
|
{
|
||||||
|
if (!ProfileLocker::lock(name))
|
||||||
|
{
|
||||||
|
GUI::showWarning(tr("Profile already exists", "rename failed title"),
|
||||||
|
tr("A profile named \"%1\" already exists and is in use.").arg(cur));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
QFile::rename(dir.filePath(cur+Core::TOX_EXT), file);
|
QFile::rename(dir.filePath(cur+Core::TOX_EXT), file);
|
||||||
QFile::rename(dir.filePath(cur+".ini"), dir.filePath(name+".ini"));
|
QFile::rename(dir.filePath(cur+".ini"), dir.filePath(name+".ini"));
|
||||||
bodyUI->profiles->setItemText(bodyUI->profiles->currentIndex(), name);
|
bodyUI->profiles->setItemText(bodyUI->profiles->currentIndex(), name);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user