Commit d6062a7c authored by Laurent Montel's avatar Laurent Montel
Browse files

Adapt to new api (scripted)

parent 747789db
Pipeline #248519 passed with stage
in 6 minutes and 43 seconds
......@@ -22,6 +22,7 @@
#include <QPushButton>
#include <QShortcut>
#include <QVBoxLayout>
#include <kwidgetsaddons_version.h>
//=============================================================================
//
......@@ -443,8 +444,16 @@ void KMFilterListBox::slotDelete()
const QString question =
uniqFilterSelected ? i18n("Do you want to remove the filter \"%1\"?", filter->pattern()->name()) : i18n("Do you want to remove selected filters?");
const QString dialogTitle = uniqFilterSelected ? i18n("Remove Filter") : i18n("Remove Filters");
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox::questionTwoActions(this, question, dialogTitle, KStandardGuiItem::remove(), KStandardGuiItem::cancel());
#else
const int answer = KMessageBox::questionYesNo(this, question, dialogTitle, KStandardGuiItem::remove(), KStandardGuiItem::cancel());
#endif
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return;
}
......
......@@ -22,6 +22,7 @@
#include <QActionGroup>
#include <QHeaderView>
#include <QMouseEvent>
#include <kwidgetsaddons_version.h>
using namespace MailCommon;
......@@ -469,15 +470,23 @@ bool FolderTreeView::allowedToEnterFolder(const Akonadi::Collection &collection,
// warn user that going to next folder - but keep track of
// whether he wishes to be notified again in "AskNextFolder"
// parameter (kept in the config file for kmail)
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int result = KMessageBox::questionTwoActions(const_cast<FolderTreeView *>(this),
#else
const int result = KMessageBox::questionYesNo(const_cast<FolderTreeView *>(this),
i18n("<qt>Go to the next unread message in folder <b>%1</b>?</qt>", collection.name()),
i18n("Go to Next Unread Message"),
KGuiItem(i18n("Go To")),
KGuiItem(i18n("Do Not Go To")), // defaults
QStringLiteral(":kmail_AskNextFolder"),
KMessageBox::Option());
#endif
i18n("<qt>Go to the next unread message in folder <b>%1</b>?</qt>", collection.name()),
i18n("Go to Next Unread Message"),
KGuiItem(i18n("Go To")),
KGuiItem(i18n("Do Not Go To")), // defaults
QStringLiteral(":kmail_AskNextFolder"),
KMessageBox::Option());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return result == KMessageBox::ButtonCode::PrimaryAction;
#else
return result == KMessageBox::Yes;
#endif
}
bool FolderTreeView::isUnreadFolder(const QModelIndex &current, QModelIndex &index, FolderTreeView::Move move, bool confirm)
......@@ -511,14 +520,23 @@ bool FolderTreeView::isUnreadFolder(const QModelIndex &current, QModelIndex &ind
// warn user that going to next folder - but keep track of
// whether he wishes to be notified again in "AskNextFolder"
// parameter (kept in the config file for kmail)
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KMessageBox::questionTwoActions(this,
#else
if (KMessageBox::questionYesNo(this,
i18n("<qt>Go to the next unread message in folder <b>%1</b>?</qt>", collection.name()),
i18n("Go to Next Unread Message"),
KGuiItem(i18n("Go To")),
KGuiItem(i18n("Do Not Go To")), // defaults
QStringLiteral(":kmail_AskNextFolder"),
KMessageBox::Option())
#endif
i18n("<qt>Go to the next unread message in folder <b>%1</b>?</qt>", collection.name()),
i18n("Go to Next Unread Message"),
KGuiItem(i18n("Go To")),
KGuiItem(i18n("Do Not Go To")), // defaults
QStringLiteral(":kmail_AskNextFolder"),
KMessageBox::Option())
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
== KMessageBox::ButtonCode::SecondaryAction) {
#else
== KMessageBox::No) {
#endif
return true; // assume selected (do not continue looping)
}
......
......@@ -17,6 +17,7 @@
#include <QIODevice>
#include <QMimeData>
#include <QStringList>
#include <kwidgetsaddons_version.h>
using namespace MailCommon;
......@@ -521,8 +522,17 @@ bool SnippetsModel::dropMimeData(const QMimeData *data, Qt::DropAction action, i
Q_EMIT dndDone();
return true;
} else {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KMessageBox::ButtonCode::PrimaryAction
== KMessageBox::questionTwoActions(nullptr,
i18n("Do you want to update snippet?"),
i18n("Update snippet"),
KGuiItem(i18n("Update")),
KStandardGuiItem::cancel())) {
#else
if (KMessageBox::Yes
== KMessageBox::questionYesNo(nullptr, i18n("Do you want to update snippet?"), i18n("Update snippet"), KGuiItem(i18n("Update")))) {
#endif
item->setText(text);
item->setSubject(subject);
item->setTo(to);
......@@ -546,7 +556,16 @@ bool SnippetsModel::dropMimeData(const QMimeData *data, Qt::DropAction action, i
if (item->isGroup()) {
Q_EMIT addNewDndSnippset(encodedData);
} else {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KMessageBox::ButtonCode::PrimaryAction
== KMessageBox::questionTwoActions(nullptr,
i18n("Do you want to update snippet?"),
i18n("Update snippet"),
KGuiItem(i18n("Update")),
KStandardGuiItem::cancel())) {
#else
if (KMessageBox::Yes == KMessageBox::questionYesNo(nullptr, i18n("Do you want to update snippet?"), i18n("Update snippet"))) {
#endif
item->setText(encodedData);
}
}
......
Supports Markdown
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