Commit 0869c21f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't return error when we cancel dialog

parent 43f16f05
Pipeline #70297 canceled with stage
...@@ -206,17 +206,20 @@ void KDebugSettingsDialog::slotInsertCategories() ...@@ -206,17 +206,20 @@ void KDebugSettingsDialog::slotInsertCategories()
void KDebugSettingsDialog::slotSaveAsGroup() void KDebugSettingsDialog::slotSaveAsGroup()
{ {
const QString groupPath = LoadGroupMenu::defaultWritableGroupPath(); const QString groupPath = LoadGroupMenu::defaultWritableGroupPath();
const QString name = QInputDialog::getText(this, i18n("Group Name"), i18n("Name:")); bool ok = false;
const QString trimmedName = name.trimmed(); const QString name = QInputDialog::getText(this, i18n("Group Name"), i18n("Name:"), QLineEdit::Normal, QString(), &ok);
if (!trimmedName.isEmpty()) { if (ok) {
if (mLoadToolButton->groupNames().contains(trimmedName)) { const QString trimmedName = name.trimmed();
KMessageBox::error(this, i18n("%1 is already used as a group name.\nPlease save as another name.", trimmedName)); if (!trimmedName.isEmpty()) {
if (mLoadToolButton->groupNames().contains(trimmedName)) {
KMessageBox::error(this, i18n("%1 is already used as a group name.\nPlease save as another name.", trimmedName));
} else {
saveRules(groupPath + QLatin1Char('/') + trimmedName, true);
Q_EMIT updateLoadGroupMenu();
}
} else { } else {
saveRules(groupPath + QLatin1Char('/') + trimmedName, true); KMessageBox::error(this, i18n("Can not save as empty name. Please use a new one."));
Q_EMIT updateLoadGroupMenu();
} }
} else {
KMessageBox::error(this, i18n("Can not save as empty name. Please use a new one."));
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment