Commit 2e0b8b91 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use action texts for buttons of decision/confirmation dialogs

parent 3c584fc5
Pipeline #94389 passed with stage
in 21 minutes and 24 seconds
......@@ -132,7 +132,12 @@ void SieveEditorGraphicalModeWidget::setImportScript(const QString &script)
mSieveParsingWarning->animatedShow();
}
} else {
if (KMessageBox::Yes == KMessageBox::questionYesNo(this, i18n("Error during importing script. Do you want to switch to text mode?"))) {
const int answer = KMessageBox::questionYesNo(this,
i18n("Error during importing script. Do you want to switch to text mode?"),
QString(),
KGuiItem(i18nc("@action:button", "Switch to Text Mode")),
KGuiItem(i18nc("@action:button", "Do Not Switch"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
Q_EMIT switchTextMode(script);
}
qCDebug(LIBKSIEVE_LOG) << " cannot import script";
......
......@@ -264,8 +264,12 @@ void SieveScriptListBox::slotDelete()
{
QListWidgetItem *item = mSieveListScript->currentItem();
if (item) {
if (KMessageBox::warningYesNo(this, i18n("Do you want to delete \"%1\" script?", item->text()), i18nc("@title:window", "Delete Script"))
== KMessageBox::Yes) {
const int answer = KMessageBox::warningYesNo(this,
i18n("Do you want to delete \"%1\" script?", item->text()),
i18nc("@title:window", "Delete Script"),
KStandardGuiItem::del(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::Yes) {
auto itemScript = static_cast<SieveScriptListItem *>(item);
Q_EMIT removePage(itemScript->scriptPage());
delete item;
......
......@@ -174,7 +174,12 @@ void SieveEditor::addNormalMessage(const QString &msg)
void SieveEditor::closeEvent(QCloseEvent *e)
{
if (d->mSieveEditorWidget->originalScript() != d->mSieveEditorWidget->script()) {
if (KMessageBox::No == KMessageBox::warningYesNo(this, i18n("Script is modified. Do you want to close editor ?"))) {
const int answer = KMessageBox::warningYesNo(this,
i18n("Script is modified. Do you want to close editor?"),
QString(),
KGuiItem(i18nc("@action:button", "Close Editor"), QStringLiteral("dialog-close")),
KGuiItem(i18nc("@action:button", "Do Not Close"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::No) {
e->ignore();
return;
}
......
......@@ -53,7 +53,12 @@ void SieveEditorAbstractWidget::setImportScript(const QString &)
void SieveEditorAbstractWidget::slotImport()
{
if (!currentscript().isEmpty()) {
if (KMessageBox::warningYesNo(this, i18n("You will overwrite script. Do you want to continue?"), i18n("Import Script")) == KMessageBox::No) {
const int answer = KMessageBox::warningYesNo(this,
i18n("You will overwrite script. Do you want to continue?"),
i18n("Import Script"),
KStandardGuiItem::cont(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::No) {
return;
}
}
......
......@@ -71,8 +71,12 @@ void MultiImapVacationDialog::reject()
auto vacationPage = qobject_cast<VacationPageWidget *>(d->mTabWidget->widget(i));
if (vacationPage) {
if (vacationPage->wasChanged()) {
if (KMessageBox::questionYesNo(this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "Confirmation"))
== KMessageBox::Yes) {
const int answer = KMessageBox::questionYesNo(this,
i18nc("@info", "Do you really want to cancel?"),
i18nc("@title:window", "Confirmation"),
KGuiItem(i18nc("@action:button", "Cancel Editing"), QStringLiteral("dialog-ok")),
KGuiItem(i18nc("@action:button", "Do Not Cancel"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
QDialog::reject(); // Discard current changes
}
canCloseDialog = false;
......
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