Commit 51d8d92c authored by Laurent Montel's avatar Laurent Montel
Browse files

Adapt to new api (scripted)

parent 0e2afa42
Pipeline #248493 failed with stage
in 8 minutes and 18 seconds
......@@ -13,6 +13,7 @@
#include <KProcess>
#include <KShell>
#include <QTemporaryFile>
#include <kwidgetsaddons_version.h>
using namespace KPIMTextEdit;
......@@ -152,21 +153,33 @@ bool RichTextExternalComposer::checkExternalEditorFinished()
return true;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int ret = KMessageBox::warningTwoActionsCancel(d->richTextComposer,
#else
const int ret = KMessageBox::warningYesNoCancel(d->richTextComposer,
xi18nc("@info",
"The external editor is still running.<nl/>"
"Do you want to stop the editor or keep it running?<nl/>"
"<warning>Stopping the editor will cause all your "
"unsaved changes to be lost.</warning>"),
i18nc("@title:window", "External Editor Running"),
KGuiItem(i18nc("@action:button", "Stop Editor")),
KGuiItem(i18nc("@action:button", "Keep Editor Running")));
#endif
xi18nc("@info",
"The external editor is still running.<nl/>"
"Do you want to stop the editor or keep it running?<nl/>"
"<warning>Stopping the editor will cause all your "
"unsaved changes to be lost.</warning>"),
i18nc("@title:window", "External Editor Running"),
KGuiItem(i18nc("@action:button", "Stop Editor")),
KGuiItem(i18nc("@action:button", "Keep Editor Running")));
switch (ret) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case KMessageBox::ButtonCode::PrimaryAction:
#else
case KMessageBox::Yes:
#endif
killExternalEditor();
return true;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case KMessageBox::ButtonCode::SecondaryAction:
#else
case KMessageBox::No:
#endif
return true;
default:
return false;
......
......@@ -41,6 +41,7 @@
#include <QScrollBar>
#include <QTextCursor>
#include <QTextDocumentFragment>
#include <kwidgetsaddons_version.h>
using namespace KPIMTextEdit;
class Q_DECL_HIDDEN RichTextEditor::RichTextEditorPrivate
......@@ -456,12 +457,20 @@ void RichTextEditor::checkSpelling(bool force)
auto backgroundSpellCheck = new Sonnet::BackgroundChecker;
if (backgroundSpellCheck->speller().availableBackends().isEmpty()) {
if (force) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox::questionTwoActions(this,
#else
const int answer = KMessageBox::questionYesNo(this,
i18n("No backend available for spell checking. Do you want to send the email anyways?"),
QString(),
KGuiItem(i18nc("@action:button", "Send"), QStringLiteral("mail-send")),
KStandardGuiItem::cancel());
#endif
i18n("No backend available for spell checking. Do you want to send the email anyways?"),
QString(),
KGuiItem(i18nc("@action:button", "Send"), QStringLiteral("mail-send")),
KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer == KMessageBox::ButtonCode::PrimaryAction) {
#else
if (answer == KMessageBox::Yes) {
#endif
Q_EMIT spellCheckingFinished();
}
} else {
......
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