diff --git a/src/spellcheck/spellcheckdialog.h b/src/spellcheck/spellcheckdialog.h --- a/src/spellcheck/spellcheckdialog.h +++ b/src/spellcheck/spellcheckdialog.h @@ -58,8 +58,6 @@ void createActions(KActionCollection *); - void updateActions(); - // spellcheck from cursor, selection private Q_SLOTS: void spellcheckFromCursor(); @@ -93,7 +91,6 @@ KTextEditor::Cursor locatePosition(int pos); KTextEditor::ViewPrivate *m_view; - QAction *m_spellcheckSelection; Sonnet::Speller *m_speller; Sonnet::BackgroundChecker *m_backgroundChecker; diff --git a/src/spellcheck/spellcheckdialog.cpp b/src/spellcheck/spellcheckdialog.cpp --- a/src/spellcheck/spellcheckdialog.cpp +++ b/src/spellcheck/spellcheckdialog.cpp @@ -42,7 +42,6 @@ KateSpellCheckDialog::KateSpellCheckDialog(KTextEditor::ViewPrivate *view) : QObject(view) , m_view(view) - , m_spellcheckSelection(nullptr) , m_speller(nullptr) , m_backgroundChecker(nullptr) , m_sonnetDialog(nullptr) @@ -68,22 +67,15 @@ a->setIcon(QIcon::fromTheme(QStringLiteral("tools-check-spelling"))); a->setWhatsThis(i18n("Check the document's spelling from the cursor and forward")); connect(a, SIGNAL(triggered()), this, SLOT(spellcheckFromCursor())); - - m_spellcheckSelection = new QAction(i18n("Spellcheck Selection..."), this); - ac->addAction(QStringLiteral("tools_spelling_selection"), m_spellcheckSelection); - m_spellcheckSelection->setIcon(QIcon::fromTheme(QStringLiteral("tools-check-spelling"))); - m_spellcheckSelection->setWhatsThis(i18n("Check spelling of the selected text")); - connect(m_spellcheckSelection, SIGNAL(triggered()), this, SLOT(spellcheckSelection())); -} - -void KateSpellCheckDialog::updateActions() -{ - m_spellcheckSelection->setEnabled(m_view->selection()); } void KateSpellCheckDialog::spellcheckFromCursor() { - spellcheck(m_view->cursorPosition()); + if (m_view->selection()) { + spellcheckSelection(); + } else { + spellcheck(m_view->cursorPosition()); + } } void KateSpellCheckDialog::spellcheckSelection() @@ -93,7 +85,11 @@ void KateSpellCheckDialog::spellcheck() { - spellcheck(KTextEditor::Cursor(0, 0)); + if (m_view->selection()) { + spellcheckSelection(); + } else { + spellcheck(KTextEditor::Cursor(0, 0)); + } } void KateSpellCheckDialog::spellcheck(const KTextEditor::Cursor &from, const KTextEditor::Cursor &to) diff --git a/src/view/kateview.cpp b/src/view/kateview.cpp --- a/src/view/kateview.cpp +++ b/src/view/kateview.cpp @@ -1769,8 +1769,6 @@ } m_cut->setEnabled(selection() || m_config->smartCopyCut()); - - m_spell->updateActions(); } void KTextEditor::ViewPrivate::switchToCmdLine()