diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,6 @@ find_package(KF5Config ${KF5_DEP_VERSION} REQUIRED) find_package(KF5ConfigWidgets ${KF5_DEP_VERSION} REQUIRED) find_package(KF5I18n ${KF5_DEP_VERSION} REQUIRED) -find_package(KF5Service ${KF5_DEP_VERSION} REQUIRED) find_package(KF5WidgetsAddons ${KF5_DEP_VERSION} REQUIRED) find_package(KF5WindowSystem ${KF5_DEP_VERSION} REQUIRED) find_package(KF5Sonnet ${KF5_DEP_VERSION} REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,7 +40,6 @@ KF5::I18n PRIVATE KF5::SonnetCore - KF5::Service KF5::ConfigWidgets KF5::WindowSystem KF5::Completion diff --git a/src/findreplace/kfinddialog.cpp b/src/findreplace/kfinddialog.cpp --- a/src/findreplace/kfinddialog.cpp +++ b/src/findreplace/kfinddialog.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include @@ -429,93 +428,74 @@ // compose a regular expression search pattern. void KFindDialog::KFindDialogPrivate::_k_showPatterns() { - if (!regexpDialogQueryDone) { - regexpDialog = KPluginTrader::createInstanceFromQuery(QStringLiteral("kregexpeditor"), - QStringLiteral("KRegExpEditor/KRegExpEditor"), - QString(), - nullptr, - q); - regexpDialogQueryDone = true; - } - - if (regexpDialog) { - KRegExpEditorInterface *iface = qobject_cast(regexpDialog); - assert(iface); + typedef struct { + const char *description; + const char *regExp; + int cursorAdjustment; + } Term; + static const Term items[] = { + { I18N_NOOP("Any Character"), ".", 0 }, + { I18N_NOOP("Start of Line"), "^", 0 }, + { I18N_NOOP("End of Line"), "$", 0 }, + { I18N_NOOP("Set of Characters"), "[]", -1 }, + { I18N_NOOP("Repeats, Zero or More Times"), "*", 0 }, + { I18N_NOOP("Repeats, One or More Times"), "+", 0 }, + { I18N_NOOP("Optional"), "?", 0 }, + { I18N_NOOP("Escape"), "\\", 0 }, + { I18N_NOOP("TAB"), "\\t", 0 }, + { I18N_NOOP("Newline"), "\\n", 0 }, + { I18N_NOOP("Carriage Return"), "\\r", 0 }, + { I18N_NOOP("White Space"), "\\s", 0 }, + { I18N_NOOP("Digit"), "\\d", 0 }, + }; + + class RegExpAction : public QAction + { + public: + RegExpAction(QObject *parent, const QString &text, const QString ®Exp, int cursor) + : QAction(text, parent), mText(text), mRegExp(regExp), mCursor(cursor) + { + } - iface->setRegExp(q->pattern()); - if (regexpDialog->exec() == QDialog::Accepted) { - q->setPattern(iface->regExp()); + QString text() const + { + return mText; } - } else { // No complete regexp-editor available, bring up the old popupmenu - typedef struct { - const char *description; - const char *regExp; - int cursorAdjustment; - } Term; - static const Term items[] = { - { I18N_NOOP("Any Character"), ".", 0 }, - { I18N_NOOP("Start of Line"), "^", 0 }, - { I18N_NOOP("End of Line"), "$", 0 }, - { I18N_NOOP("Set of Characters"), "[]", -1 }, - { I18N_NOOP("Repeats, Zero or More Times"), "*", 0 }, - { I18N_NOOP("Repeats, One or More Times"), "+", 0 }, - { I18N_NOOP("Optional"), "?", 0 }, - { I18N_NOOP("Escape"), "\\", 0 }, - { I18N_NOOP("TAB"), "\\t", 0 }, - { I18N_NOOP("Newline"), "\\n", 0 }, - { I18N_NOOP("Carriage Return"), "\\r", 0 }, - { I18N_NOOP("White Space"), "\\s", 0 }, - { I18N_NOOP("Digit"), "\\d", 0 }, - }; - - class RegExpAction : public QAction + QString regExp() const { - public: - RegExpAction(QObject *parent, const QString &text, const QString ®Exp, int cursor) - : QAction(text, parent), mText(text), mRegExp(regExp), mCursor(cursor) - { - } - - QString text() const - { - return mText; - } - QString regExp() const - { - return mRegExp; - } - int cursor() const - { - return mCursor; - } + return mRegExp; + } + int cursor() const + { + return mCursor; + } - private: - QString mText; - QString mRegExp; - int mCursor; - }; + private: + QString mText; + QString mRegExp; + int mCursor; + }; - // Populate the popup menu. - if (!patterns) { - patterns = new QMenu(q); - for (const Term &item : items) { - patterns->addAction(new RegExpAction(patterns, i18n(item.description), - QLatin1String(item.regExp), - item.cursorAdjustment)); - } + // Populate the popup menu. + if (!patterns) { + patterns = new QMenu(q); + for (const Term &item : items) { + patterns->addAction(new RegExpAction(patterns, i18n(item.description), + QLatin1String(item.regExp), + item.cursorAdjustment)); } + } - // Insert the selection into the edit control. - QAction *action = patterns->exec(regExpItem->mapToGlobal(regExpItem->rect().bottomLeft())); - if (action) { - RegExpAction *regExpAction = static_cast(action); - if (regExpAction) { - QLineEdit *editor = find->lineEdit(); + // Insert the selection into the edit control. + QAction *action = patterns->exec(regExpItem->mapToGlobal(regExpItem->rect().bottomLeft())); + if (action) { + RegExpAction *regExpAction = static_cast(action); + if (regExpAction) { + QLineEdit *editor = find->lineEdit(); - editor->insert(regExpAction->regExp()); - editor->setCursorPosition(editor->cursorPosition() + regExpAction->cursor()); - } + editor->insert(regExpAction->regExp()); + editor->setCursorPosition(editor->cursorPosition() + regExpAction->cursor()); } } }