Commit 63fe2a1d authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use action texts for buttons of decision/confirmation dialogs

parent 4e0de839
Pipeline #94380 passed with stage
in 4 minutes and 32 seconds
......@@ -132,7 +132,12 @@ void ThemeEditorPage::installTheme(const QString &themePath)
QDir dir(themePath);
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
if (KMessageBox::questionYesNo(this, i18n("Theme already exists. Do you want to overwrite it?"), i18n("Theme already exists")) == KMessageBox::No) {
const int answer = KMessageBox::questionYesNo(this,
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::No) {
return;
}
} else {
......@@ -249,7 +254,11 @@ bool ThemeEditorPage::saveTheme(bool withConfirmation)
{
if (themeWasChanged()) {
if (withConfirmation) {
const int result = KMessageBox::questionYesNoCancel(this, i18n("Do you want to save current project?"), i18n("Save current project"));
const int result = KMessageBox::questionYesNoCancel(this,
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
if (result == KMessageBox::Yes) {
storeTheme();
} else if (result == KMessageBox::Cancel) {
......
......@@ -121,7 +121,12 @@ void ContactEditorPage::installTheme(const QString &themePath)
QDir dir(themePath);
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
if (KMessageBox::questionYesNo(this, i18n("Theme already exists. Do you want to overwrite it?"), i18n("Theme already exists")) == KMessageBox::No) {
const int answer = KMessageBox::questionYesNo(this,
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::No) {
return;
}
} else {
......@@ -265,7 +270,11 @@ bool ContactEditorPage::saveTheme(bool withConfirmation)
{
if (themeWasChanged()) {
if (withConfirmation) {
const int result = KMessageBox::questionYesNoCancel(this, i18n("Do you want to save current project?"), i18n("Save current project"));
const int result = KMessageBox::questionYesNoCancel(this,
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
if (result == KMessageBox::Yes) {
storeTheme();
} else if (result == KMessageBox::Cancel) {
......
......@@ -99,7 +99,8 @@ void ManageThemes::slotDeleteTheme()
} else {
msg = i18n("Do you want to remove %1 selected themes?", selectedThemeCount);
}
if (KMessageBox::questionYesNo(this, msg, i18n("Remove theme")) == KMessageBox::Yes) {
const int answer = KMessageBox::questionYesNo(this, msg, i18n("Remove theme"), KStandardGuiItem::remove(), KStandardGuiItem::cancel());
if (answer == KMessageBox::Yes) {
for (QListWidgetItem *item : selectItems) {
if (QDir((d->mLocalDirectory + QLatin1Char('/') + item->text())).removeRecursively()) {
delete item;
......
......@@ -156,7 +156,12 @@ void ThemeEditorPage::installTheme(const QString &themePath)
QDir dir(themePath);
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
if (KMessageBox::questionYesNo(this, i18n("Theme already exists. Do you want to overwrite it?"), i18n("Theme already exists")) == KMessageBox::No) {
const int answer = KMessageBox::questionYesNo(this,
i18n("Theme already exists. Do you want to overwrite it?"),
i18n("Theme already exists"),
KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::No) {
return;
}
} else {
......@@ -276,7 +281,11 @@ bool ThemeEditorPage::saveTheme(bool withConfirmation)
{
if (themeWasChanged()) {
if (withConfirmation) {
const int result = KMessageBox::questionYesNoCancel(this, i18n("Do you want to save current project?"), i18n("Save current project"));
const int result = KMessageBox::questionYesNoCancel(this,
i18n("Do you want to save current project?"),
i18n("Save current project"),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
if (result == KMessageBox::Yes) {
storeTheme();
} else if (result == KMessageBox::Cancel) {
......
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