Commit 4f8805f8 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from deprecated KMessageBox API

parent 7ea5c2b2
Pipeline #249681 passed with stage
in 4 minutes and 13 seconds
......@@ -27,6 +27,7 @@
#include <KIO/StoredTransferJob>
#include <KJobWidgets>
#include <KMessageBox>
#include <kwidgetsaddons_version.h>
#include "maindlg.h"
......@@ -245,12 +246,20 @@ void KParameterEditor::cmdImport_clicked()
file.close();
QFile::remove(file.fileName());
return;
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 100, 0)
} else if (KMessageBox::warningYesNo(this,
#else
} else if (KMessageBox::warningTwoActions(this,
#endif
i18n("Would you like to be informed about other lines that cannot be read?"),
QString(),
KGuiItem(i18n("Get Informed")),
KGuiItem(i18n("Ignore Information")))
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 100, 0)
== KMessageBox::No)
#else
== KMessageBox::SecondaryAction)
#endif
verbose = true;
}
}
......
......@@ -40,6 +40,7 @@
#include <KMessageBox>
#include <KStandardAction>
#include <KToolBar>
#include <kwidgetsaddons_version.h>
// local includes
#include "calculator.h"
......@@ -456,14 +457,22 @@ void MainDlg::resetUndoRedo()
bool MainDlg::checkModified()
{
if (m_modified) {
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 100, 0)
int saveit = KMessageBox::warningYesNoCancel(m_parent,
#else
int saveit = KMessageBox::warningTwoActionsCancel(m_parent,
#endif
i18n("The plot has been modified.\n"
"Do you want to save it?"),
QString(),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
switch (saveit) {
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 100, 0)
case KMessageBox::Yes:
#else
case KMessageBox::PrimaryAction:
#endif
slotSave();
if (m_modified) // the user didn't saved the file
return false;
......
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