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

Make compile without deprecated methods

parent 12b47608
Pipeline #249902 passed with stage
in 15 minutes and 32 seconds
......@@ -36,8 +36,8 @@ VCardViewerDialog::VCardViewerDialog(const KContacts::Addressee::List &list, QWi
connect(buttonBox, &QDialogButtonBox::accepted, this, &VCardViewerDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &VCardViewerDialog::reject);
KGuiItem::assign(user1Button, KStandardGuiItem::no());
KGuiItem::assign(user2Button, KStandardGuiItem::yes());
KGuiItem::assign(user1Button, KStandardGuiItem::cancel());
KGuiItem::assign(user2Button, KStandardGuiItem::ok());
mApplyButton = buttonBox->button(QDialogButtonBox::Apply);
user1Button->setDefault(true);
setModal(true);
......
......@@ -12,6 +12,7 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <QAction>
#include <kwidgetsaddons_version.h>
AkonadiDatabaseToolsPluginInterface::AkonadiDatabaseToolsPluginInterface(QObject *parent)
: PimCommon::GenericPluginInterface(parent)
......@@ -26,7 +27,21 @@ void AkonadiDatabaseToolsPluginInterface::createAction(KActionCollection *ac)
auto action = new QAction(i18n("&Akonadi Vacuum..."), this);
ac->addAction(QStringLiteral("akonadivacuum"), action);
connect(action, &QAction::triggered, this, [this]() {
if (KMessageBox::questionYesNo(parentWidget(), i18n("Do you want to vacuum akonadi database?"), i18n("Akonadi Vacuum")) == KMessageBox::Yes) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KMessageBox::warningTwoActions(
#else
if (KMessageBox::questionYesNo(
#endif
parentWidget(),
i18n("Do you want to vacuum akonadi database?"),
i18n("Akonadi Vacuum"),
KGuiItem(i18n("Vacuum")),
KStandardGuiItem::cancel())
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
== KMessageBox::ButtonCode::PrimaryAction) {
#else
== KMessageBox::Yes) {
#endif
mTool = AkonadiDatabaseToolsUtils::AkonadiDatabaseTool::Vacuum;
slotActivated();
}
......@@ -39,7 +54,22 @@ void AkonadiDatabaseToolsPluginInterface::createAction(KActionCollection *ac)
auto action = new QAction(i18n("&Akonadi Fsck..."), this);
ac->addAction(QStringLiteral("akonadifsck"), action);
connect(action, &QAction::triggered, this, [this]() {
if (KMessageBox::questionYesNo(parentWidget(), i18n("Do you want to fsck akonadi database?"), i18n("Akonadi Fsck")) == KMessageBox::Yes) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KMessageBox::warningTwoActions(
#else
if (KMessageBox::questionYesNo(
#endif
parentWidget(),
i18n("Do you want to fsck akonadi database?"),
i18n("Akonadi Fsck"),
KGuiItem(i18n("Fsck")),
KStandardGuiItem::cancel())
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
== KMessageBox::ButtonCode::PrimaryAction) {
#else
== KMessageBox::Yes) {
#endif
mTool = AkonadiDatabaseToolsUtils::AkonadiDatabaseTool::Fsck;
slotActivated();
}
......
......@@ -856,14 +856,30 @@ public:
return false;
} else {
queryStr = i18n("%1?", path);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
yesItem = KStandardGuiItem::ok();
#else
yesItem = KStandardGuiItem::yes();
#endif
}
if (noItem.text().isEmpty()) {
noItem = KStandardGuiItem::cancel();
}
const int answer = KMessageBox::warningYesNo(nullptr, i18n("%1\n%2", warnStr, queryStr), QString(), yesItem, noItem);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox::warningTwoActions(nullptr,
#else
const int answer = KMessageBox::warningYesNo(nullptr,
#endif
i18n("%1\n%2", warnStr, queryStr),
QString(),
yesItem,
noItem);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::SecondaryAction) {
#else
if (answer == KMessageBox::No) {
#endif
return true;
}
}
......
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