Skip to content

Commit

Permalink
Added a confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
varjolintu committed Mar 16, 2019
1 parent 5470c0e commit f401a7f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/browser/BrowserService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ QJsonObject BrowserService::getDatabaseGroups()

QJsonObject BrowserService::createNewGroup(const QString& groupName)
{
QJsonObject result;
if (thread() != QThread::currentThread()) {
QMetaObject::invokeMethod(this, "createNewGroup", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(QJsonObject, result), Q_ARG(QString, groupName));
return result;
}

auto db = getDatabase();
if (!db) {
return {};
Expand All @@ -210,7 +217,6 @@ QJsonObject BrowserService::createNewGroup(const QString& groupName)
return {};
}

QJsonObject result;
auto group = rootGroup->findGroupByPath(groupName);

// Group already exists
Expand All @@ -220,6 +226,16 @@ QJsonObject BrowserService::createNewGroup(const QString& groupName)
return result;
}

auto dialogResult = MessageBox::warning(nullptr,
tr("KeePassXC: Create a new group"),
tr("A request for creating a new group \"%1\" has been received.\n"
"Do you want to create this group?\n").arg(groupName),
MessageBox::Yes | MessageBox::No);

if (dialogResult != MessageBox::Yes) {
return result;
}

QString name, uuid;
Group* previousGroup = rootGroup;
auto groups = groupName.split("/");
Expand Down

0 comments on commit f401a7f

Please sign in to comment.