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

Step 1 for porting deprecated methods

parent 269cd334
Pipeline #249341 passed with stage
in 1 minute and 50 seconds
......@@ -26,6 +26,7 @@
#include <QVBoxLayout>
#include <QGridLayout>
#include <QRegularExpression>
#include <kwidgetsaddons_version.h>
using namespace KAlarmCal;
......@@ -377,7 +378,11 @@ void Find::findNext(bool forward, bool checkEnd, bool fromCurrent)
{
const QString msg = forward ? xi18nc("@info", "<para>End of alarm list reached.</para><para>Continue from the beginning?</para>")
: xi18nc("@info", "<para>Beginning of alarm list reached.</para><para>Continue from the end?</para>");
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KAMessageBox::questionYesNo(mListView, msg, QString(), KStandardGuiItem::cont(), KStandardGuiItem::cancel()) == KMessageBox::ButtonCode::PrimaryAction)
#else
if (KAMessageBox::questionYesNo(mListView, msg, QString(), KStandardGuiItem::cont(), KStandardGuiItem::cancel()) == KMessageBox::Yes)
#endif
{
mNoCurrentItem = true;
findNext(forward, false, false);
......
......@@ -65,6 +65,7 @@ using namespace KCalendarCore;
#include <QStandardPaths>
#include <QPushButton>
#include <QTemporaryFile>
#include <kwidgetsaddons_version.h>
//clazy:excludeall=non-pod-global-static
......@@ -1610,7 +1611,11 @@ void outputAlarmWarnings(QWidget* parent, const KAEvent* event)
if (KAMessageBox::warningYesNo(parent, xi18nc("@info", "<para>Alarms are currently disabled.</para><para>Do you want to enable alarms now?</para>"),
QString(), KGuiItem(i18nc("@action:button", "Enable")), KGuiItem(i18nc("@action:button", "Keep Disabled")),
QStringLiteral("EditEnableAlarms"))
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
== KMessageBox::ButtonCode::PrimaryAction)
#else
== KMessageBox::Yes)
#endif
theApp()->setAlarmsEnabled(true);
}
}
......
......@@ -52,6 +52,7 @@
#include <QStandardPaths>
#include <QSystemTrayIcon>
#include <QCommandLineParser>
#include <kwidgetsaddons_version.h>
#include <stdlib.h>
#include <ctype.h>
......@@ -841,11 +842,19 @@ void KAlarmApp::doQuit(QWidget* parent)
}
switch (option)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case KMessageBox::ButtonCode::PrimaryAction:
#else
case KMessageBox::Yes:
#endif
Preferences::setAutoStart(true);
Preferences::setNoAutoStart(false);
break;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case KMessageBox::ButtonCode::SecondaryAction:
#else
case KMessageBox::No:
#endif
Preferences::setNoAutoStart(true);
break;
case KMessageBox::Cancel:
......
......@@ -63,6 +63,7 @@ using namespace KHolidays;
#endif
#include <KWindowSystem>
#include <KHelpClient>
#include <kwidgetsaddons_version.h>
#include <QLabel>
#include <QCheckBox>
......@@ -212,7 +213,11 @@ void KAlarmPrefDlg::slotApply()
if (!errmsg.isEmpty())
{
setCurrentPage(mEmailPageItem);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KAMessageBox::warningYesNo(this, errmsg) != KMessageBox::ButtonCode::PrimaryAction)
#else
if (KAMessageBox::warningYesNo(this, errmsg) != KMessageBox::Yes)
#endif
{
mValid = false;
return;
......@@ -263,10 +268,18 @@ void KAlarmPrefDlg::slotDefault()
KGuiItem(i18nc("@action:button Reset ALL tabs", "&All")),
KGuiItem(i18nc("@action:button Reset the CURRENT tab", "C&urrent"))))
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case KMessageBox::ButtonCode::PrimaryAction:
#else
case KMessageBox::Yes:
#endif
restore(true); // restore all tabs
break;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case KMessageBox::ButtonCode::SecondaryAction:
#else
case KMessageBox::No:
#endif
Preferences::self()->useDefaults(true);
static_cast<PrefsTabBase*>(currentPage()->widget())->restore(true, false);
Preferences::self()->useDefaults(false);
......@@ -2111,5 +2124,4 @@ void ViewPrefTab::slotWindowPosChanged(QAbstractButton* button)
}
#include "moc_prefdlg_p.cpp"
#include "moc_prefdlg.cpp"
// vim: et sw=4:
......@@ -17,6 +17,7 @@
#include <KLocalizedString>
#include <QTimer>
#include <kwidgetsaddons_version.h>
using namespace KAlarmCal;
......@@ -100,7 +101,11 @@ bool FileResourceCalendarUpdater::update(bool useTimer)
bool FileResourceCalendarUpdater::prompt()
{
bool result = true;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const bool convert = (KAMessageBox::warningYesNo(mPromptParent, mPromptMessage) == KMessageBox::ButtonCode::PrimaryAction);
#else
const bool convert = (KAMessageBox::warningYesNo(mPromptParent, mPromptMessage) == KMessageBox::Yes);
#endif
if (!convert)
result = false;
if (convert)
......
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