From 2bf60e6475797c99e9c104a2e475195d3efa8a7f Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 19 Jul 2021 17:41:05 +0300 Subject: [PATCH] kdeui: remove binary compatibility bits Signed-off-by: Ivailo Monev --- kdeui/widgets/krichtextedit.cpp | 8 +------- kdeui/widgets/krichtextedit.h | 9 --------- kdeui/widgets/ktextedit.cpp | 20 +++++++------------- kdeui/widgets/ktextedit.h | 10 ++-------- 4 files changed, 10 insertions(+), 37 deletions(-) diff --git a/kdeui/widgets/krichtextedit.cpp b/kdeui/widgets/krichtextedit.cpp index fb1fcb36..d0bc8515 100644 --- a/kdeui/widgets/krichtextedit.cpp +++ b/kdeui/widgets/krichtextedit.cpp @@ -307,18 +307,12 @@ void KRichTextEdit::switchToPlainText() { if (d->mMode == Rich) { d->mMode = Plain; - // TODO: Warn the user about this? - QMetaObject::invokeMethod(this, "insertPlainTextImplementation"); + document()->setPlainText(document()->toPlainText()); setAcceptRichText(false); emit textModeChanged(d->mMode); } } -void KRichTextEdit::insertPlainTextImplementation() -{ - document()->setPlainText(document()->toPlainText()); -} - void KRichTextEdit::setTextSuperScript(bool superscript) { QTextCharFormat fmt; diff --git a/kdeui/widgets/krichtextedit.h b/kdeui/widgets/krichtextedit.h index 722b9f29..b2e7bc51 100644 --- a/kdeui/widgets/krichtextedit.h +++ b/kdeui/widgets/krichtextedit.h @@ -33,8 +33,6 @@ class KRichTextEditPrivate; #include -#define HAVE_INSERTPLAINTEXT 1 - /** * The KRichTextEdit class provides a widget to edit and display rich text. * @@ -344,13 +342,6 @@ public Q_SLOTS: */ void setTextSubScript(bool subscript); - /** - * @since 4.10 - * Because of binary compatibility constraints, insertPlainText - * is not virtual. Therefore it must dynamically detect and call this slot. - */ - void insertPlainTextImplementation(); - Q_SIGNALS: /** diff --git a/kdeui/widgets/ktextedit.cpp b/kdeui/widgets/ktextedit.cpp index aab3ee88..8b192d03 100644 --- a/kdeui/widgets/ktextedit.cpp +++ b/kdeui/widgets/ktextedit.cpp @@ -670,9 +670,13 @@ void KTextEdit::contextMenuEvent(QContextMenuEvent *event) // Use standard context menu for already selected words, correctly spelled // words and words inside quotes. if (!wordIsMisspelled || selectedWordClicked || inQuote) { - QMetaObject::invokeMethod(this, "mousePopupMenuImplementation", Q_ARG(QPoint, event->globalPos())); - } - else { + QMenu *popup = mousePopupMenu(); + if (popup) { + aboutToShowContextMenu(popup); + popup->exec(event->globalPos()); + delete popup; + } + } else { QMenu menu; //don't use KMenu here we don't want auto management accelerator //Add the suggestions to the menu @@ -1153,14 +1157,4 @@ void KTextEdit::showAutoCorrectButton(bool show) d->showAutoCorrectionButton = show; } -void KTextEdit::mousePopupMenuImplementation(const QPoint& pos) -{ - QMenu *popup = mousePopupMenu(); - if ( popup ) { - aboutToShowContextMenu(popup); - popup->exec( pos ); - delete popup; - } -} - #include "moc_ktextedit.cpp" diff --git a/kdeui/widgets/ktextedit.h b/kdeui/widgets/ktextedit.h index f86a8674..240c5241 100644 --- a/kdeui/widgets/ktextedit.h +++ b/kdeui/widgets/ktextedit.h @@ -28,6 +28,7 @@ #define HAVE_AUTOCORRECTFEATURE 1 #define HAVE_FORCESPELLCHECKING 1 #define HAVE_MOUSEPOPUPMENUIMPLEMENTATION 1 + /** * This interface is a workaround to keep binary compatibility in KDE4, because * adding the virtual keyword to functions is not BC. @@ -215,6 +216,7 @@ class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses /** * Return standard KTextEdit popupMenu * @since 4.1 + * @todo mark as virtual */ QMenu *mousePopupMenu(); @@ -370,14 +372,6 @@ class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses */ void replace(); - - /** - * @since 4.10 - * Because of binary compatibility constraints, mousePopupMenu() - * is not virtual. Therefore it must dynamically detect and call this slot. - */ - void mousePopupMenuImplementation(const QPoint& pos); - protected Q_SLOTS: /** * @since 4.1