Commit ae14d237 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau Committed by Laurent Montel
Browse files

Use action texts for buttons of decision/confirmation dialogs

parent 1b8f8e46
Pipeline #95350 canceled with stage
......@@ -219,8 +219,11 @@ bool ArchiveMailWidget::save() const
void ArchiveMailWidget::slotDeleteItem()
{
const QList<QTreeWidgetItem *> listItems = mWidget.treeWidget->selectedItems();
if (KMessageBox::warningYesNo(parentWidget(), i18n("Do you want to delete the selected items?"), i18nc("@title:window", "Delete Items"))
== KMessageBox::No) {
const int answer = KMessageBox::warningYesNo(parentWidget(),
i18n("Do you want to delete the selected items?"), i18nc("@title:window", "Delete Items"),
KStandardGuiItem::del(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::No) {
return;
}
......
......@@ -205,11 +205,13 @@ void FollowUpReminderInfoWidget::deleteItems(const QList<QTreeWidgetItem *> &mai
if (mailItemLst.isEmpty()) {
qCDebug(FOLLOWUPREMINDERAGENT_LOG) << "Not item selected";
} else {
if (KMessageBox::Yes
== KMessageBox::warningYesNo(
this,
i18np("Do you want to delete this selected item?", "Do you want to delete these %1 selected items?", mailItemLst.count()),
i18nc("@title:window", "Delete Items"))) {
const int answer =
KMessageBox::warningYesNo(this,
i18np("Do you want to delete this selected item?", "Do you want to delete these %1 selected items?", mailItemLst.count()),
i18nc("@title:window", "Delete Items"),
KStandardGuiItem::del(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::Yes) {
for (QTreeWidgetItem *item : mailItemLst) {
auto mailItem = static_cast<FollowUpReminderInfoItem *>(item);
mListRemoveId << mailItem->info()->uniqueIdentifier();
......
......@@ -197,20 +197,21 @@ void SendLaterWidget::slotDeleteItem()
return;
}
const int numberOfItems(listItems.count());
if (KMessageBox::warningYesNo(this,
i18np("Do you want to delete the selected item?", "Do you want to delete the selected items?", numberOfItems),
i18nc("@title:window", "Delete Items"))
== KMessageBox::No) {
int answer = KMessageBox::warningYesNo(this,
i18np("Do you want to delete the selected item?", "Do you want to delete the selected items?", numberOfItems),
i18nc("@title:window", "Delete Items"),
KStandardGuiItem::del(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::No) {
return;
}
bool deleteMessage = false;
if (KMessageBox::warningYesNo(this,
i18np("Do you want to delete the message as well?", "Do you want to delete the messages as well?", numberOfItems),
i18nc("@title:window", "Delete Messages"))
== KMessageBox::Yes) {
deleteMessage = true;
}
answer = KMessageBox::warningYesNo(this,
i18np("Do you want to delete the message as well?", "Do you want to delete the messages as well?", numberOfItems),
i18nc("@title:window", "Delete Messages"),
KStandardGuiItem::del(),
KGuiItem(i18nc("@action:button", "Do Not Delete"), QStringLiteral("dialog-cancel")));
const bool deleteMessage = (answer == KMessageBox::Yes);
for (QTreeWidgetItem *item : listItems) {
if (deleteMessage) {
......
......@@ -186,12 +186,18 @@ void SendLaterManager::sendError(MessageComposer::SendLaterInfo *info, ErrorType
break;
case TooManyItemFound:
case CanNotFetchItem:
case CanNotCreateTransport:
if (KMessageBox::No == KMessageBox::questionYesNo(nullptr, i18n("An error was found. Do you want to resend it?"), i18n("Error found"))) {
case CanNotCreateTransport: {
const int answer = KMessageBox::questionYesNo(nullptr,
i18n("An error was found. Do you want to resend it?"),
i18n("Error found"),
KGuiItem(i18nc("@action:button", "Resend"), QStringLiteral("mail-send")),
KStandardGuiItem::cancel());
if (answer == KMessageBox::No) {
removeLaterInfo(info);
}
break;
}
}
}
recreateSendList();
}
......
......@@ -55,7 +55,12 @@ void IdentityEditVcardDialog::slotDeleteCurrentVCard()
if (mVcardFileName.isEmpty()) {
return;
}
if (KMessageBox::Yes == KMessageBox::questionYesNo(this, i18n("Are you sure you want to delete this vCard?"), i18n("Delete vCard"))) {
const int answer = KMessageBox::questionYesNo(this,
i18n("Are you sure you want to delete this vCard?"),
i18n("Delete vCard"),
KStandardGuiItem::del(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::Yes) {
if (mVcardFileName.startsWith(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation))) {
deleteCurrentVcard(true);
} else {
......@@ -117,7 +122,12 @@ QString IdentityEditVcardDialog::saveVcard() const
void IdentityEditVcardDialog::reject()
{
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
}
}
......@@ -112,8 +112,12 @@ void OpenComposerJob::slotOpenComposer()
for (QList<QUrl>::ConstIterator it = attachURLs.constBegin(); it != endAttachment; ++it) {
QMimeDatabase mimeDb;
if (mimeDb.mimeTypeForUrl(*it).name() == QLatin1String("inode/directory")) {
if (KMessageBox::questionYesNo(nullptr, i18n("Do you want to attach this folder \"%1\"?", (*it).toDisplayString()), i18n("Attach Folder"))
== KMessageBox::No) {
const int answer = KMessageBox::questionYesNo(nullptr,
i18n("Do you want to attach this folder \"%1\"?", (*it).toDisplayString()),
i18n("Attach Folder"),
KGuiItem(i18nc("@action:button", "Attach"), QStringLiteral("dialog-ok")),
KGuiItem(i18nc("@action:button", "Do Not Attach"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::No) {
continue;
}
}
......
......@@ -308,8 +308,13 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCo
if (kmkernel->firstStart()) {
const QStringList listOfMailerFound = MailCommon::Util::foundMailer();
if (!listOfMailerFound.isEmpty()) {
if (KMessageBox::questionYesNoList(this, i18n("Another mailer was found on system. Do you want to import data from it?"), listOfMailerFound)
== KMessageBox::Yes) {
const int answer = KMessageBox::questionYesNoList(this,
i18n("Another mailer was found on system. Do you want to import data from it?"),
listOfMailerFound,
QString(),
KGuiItem(i18nc("@action:button", "Import"), QStringLiteral("document-import")),
KGuiItem(i18nc("@action:button", "Do Not Import"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
const QString path = QStandardPaths::findExecutable(QStringLiteral("akonadiimportwizard"));
if (!QProcess::startDetached(path, QStringList())) {
KMessageBox::error(this,
......
......@@ -15,7 +15,10 @@ int main(int argc, char **argv)
if (!listOfMailerFound.isEmpty()) {
if (KMessageBox::questionYesNoList(nullptr,
QStringLiteral("Another mailer was found on system. Do you want to import data from it?"),
listOfMailerFound)
listOfMailerFound,
QString(),
KGuiItem(QStringLiteral("Import"), QStringLiteral("document-import")),
KGuiItem(QStringLiteral("Do Not Import"), QStringLiteral("dialog-cancel")))
== KMessageBox::Yes) {
qDebug() << " launch importwizard";
} else {
......
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