D21940: Make automatic spellcheck work after reloading a document
This revision was automatically updated to reflect the committed changes. Closed by commit R39:42c64e1e081c: Make automatic spellcheck work after reloading a document (authored by ahmadsamir, committed by cullmann). REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D21940?vs=60467=60611 REVISION DETAIL https://phabricator.kde.org/D21940 AFFECTED FILES src/spellcheck/ontheflycheck.cpp To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, dhaumann
D21940: Make automatic spellcheck work after reloading a document
ahmadsamir added a comment. Great :). Please commit it too (as I don't have access to kde git). REPOSITORY R39 KTextEditor BRANCH document-reloaded-spellcheck (branched from master) REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, dhaumann
D21940: Make automatic spellcheck work after reloading a document
dhaumann accepted this revision. dhaumann added a comment. This revision is now accepted and ready to land. Looks good to me now :) REPOSITORY R39 KTextEditor BRANCH document-reloaded-spellcheck (branched from master) REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, dhaumann
D21940: Make automatic spellcheck work after reloading a document
ahmadsamir marked 5 inline comments as done. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, dhaumann
D21940: Make automatic spellcheck work after reloading a document
ahmadsamir updated this revision to Diff 60467. ahmadsamir removed a subscriber: dhaumann. ahmadsamir added a comment. Use a lambda instead of adding a standalone method REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D21940?vs=60154=60467 BRANCH document-reloaded-spellcheck (branched from master) REVISION DETAIL https://phabricator.kde.org/D21940 AFFECTED FILES src/spellcheck/ontheflycheck.cpp To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, dhaumann
D21940: Make automatic spellcheck work after reloading a document
dhaumann added inline comments. INLINE COMMENTS > ahmadsamir wrote in ontheflycheck.cpp:75 > In file included from /usr/include/qt5/QtCore/qalgorithms.h:43, >from /usr/include/qt5/QtCore/qlist.h:43, >from /usr/include/qt5/QtCore/QList:1, >from > /home/ahmad/dev/ktexteditor/git/src/spellcheck/ontheflycheck.h:25, >from > /home/ahmad/dev/ktexteditor/git/src/spellcheck/ontheflycheck.cpp:26: > /usr/include/qt5/QtCore/qobject.h: In instantiation of ‘static > QMetaObject::Connection QObject::connect(const typename > QtPrivate::FunctionPointer::Object*, Func1, const typename > QtPrivate::FunctionPointer::Object*, Func2, Qt::ConnectionType) [with > Func1 = void (KTextEditor::Document::*)(KTextEditor::Document*); Func2 = void > (KateOnTheFlyChecker::*)(const KTextEditor::Range&); typename > QtPrivate::FunctionPointer::Object = KTextEditor::Document; typename > QtPrivate::FunctionPointer::Object = KateOnTheFlyChecker]’: > /home/ahmad/dev/ktexteditor/git/src/spellcheck/ontheflycheck.cpp:76:58: > required from here > /usr/include/qt5/QtCore/qobject.h:241:9: error: static assertion failed: > Signal and slot arguments are not compatible. > 241 | > Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments SignalType::Arguments, typename SlotType::Arguments>::value), > | ^ In that case, please use an anonymous lambda: [this](KTextEditor:: Document*){refreshSpellCheck ();} That keeps the code closer together. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: dhaumann, sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann
D21940: Make automatic spellcheck work after reloading a document
ahmadsamir added a comment. Qt docs say that the signal must have at least as many arguments as the slot, and there is an implicit conversion between the types of the corresponding arguments in the signal and the slot. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: dhaumann, sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann
D21940: Make automatic spellcheck work after reloading a document
ahmadsamir added inline comments. INLINE COMMENTS > dhaumann wrote in ontheflycheck.cpp:75 > But refreshSpellCheck() has a default parameter, so this function exists > without any parameter. Afaik this should work?! In file included from /usr/include/qt5/QtCore/qalgorithms.h:43, from /usr/include/qt5/QtCore/qlist.h:43, from /usr/include/qt5/QtCore/QList:1, from /home/ahmad/dev/ktexteditor/git/src/spellcheck/ontheflycheck.h:25, from /home/ahmad/dev/ktexteditor/git/src/spellcheck/ontheflycheck.cpp:26: /usr/include/qt5/QtCore/qobject.h: In instantiation of ‘static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer::Object*, Func1, const typename QtPrivate::FunctionPointer::Object*, Func2, Qt::ConnectionType) [with Func1 = void (KTextEditor::Document::*)(KTextEditor::Document*); Func2 = void (KateOnTheFlyChecker::*)(const KTextEditor::Range&); typename QtPrivate::FunctionPointer::Object = KTextEditor::Document; typename QtPrivate::FunctionPointer::Object = KateOnTheFlyChecker]’: /home/ahmad/dev/ktexteditor/git/src/spellcheck/ontheflycheck.cpp:76:58: required from here /usr/include/qt5/QtCore/qobject.h:241:9: error: static assertion failed: Signal and slot arguments are not compatible. 241 | Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments::value), | ^ REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: dhaumann, sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann
D21940: Make automatic spellcheck work after reloading a document
dhaumann added inline comments. INLINE COMMENTS > ahmadsamir wrote in ontheflycheck.cpp:75 > That wouldn't work, reloaded() takes a Document pointer parameter whereas > refreshSpellcheck takes a Range parameter. But refreshSpellCheck() has a default parameter, so this function exists without any parameter. Afaik this should work?! REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: dhaumann, sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann
D21940: Make automatic spellcheck work after reloading a document
ahmadsamir added inline comments. INLINE COMMENTS > dhaumann wrote in ontheflycheck.cpp:75 > Directly connect to this, refreshSpellCheck. That wouldn't work, reloaded() takes a Document pointer parameter whereas refreshSpellcheck takes a Range parameter. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: dhaumann, sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann
D21940: Make automatic spellcheck work after reloading a document
dhaumann requested changes to this revision. dhaumann added a comment. This revision now requires changes to proceed. You don't need the extra function. Could you update the patch? INLINE COMMENTS > ontheflycheck.cpp:75 > > +connect(document, ::Document::reloaded, > +this, ::slotDocumentReloaded); Directly connect to this, refreshSpellCheck. > ontheflycheck.h:71 > > +void slotDocumentReloaded(const KTextEditor::Document *view = nullptr); > + Please delete this function complete, see next comment. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann, dhaumann Cc: dhaumann, sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann
D21940: Make automatic spellcheck work after reloading a document
sars added a comment. LGTM REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D21940 To: ahmadsamir, #ktexteditor, cullmann Cc: sars, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, dhaumann
D21940: Make automatic spellcheck work after reloading a document
ahmadsamir created this revision. ahmadsamir added reviewers: KTextEditor, cullmann. Herald added projects: Kate, Frameworks. ahmadsamir requested review of this revision. REVISION SUMMARY When a document gets reloaded for whatever reason, automatic spellcheck should be refreshed so as to re-process the document contents. BUG: 408291 FIXED-IN: 5.61.0 TEST PLAN - Open a document - with a couple of misspelled words - in kate - Enable "automatic spell checking" - Reload the document - The misspelled words in the document should be higlighted after reloading REPOSITORY R39 KTextEditor BRANCH document-reloaded-spellcheck (branched from master) REVISION DETAIL https://phabricator.kde.org/D21940 AFFECTED FILES src/spellcheck/ontheflycheck.cpp src/spellcheck/ontheflycheck.h To: ahmadsamir, #ktexteditor, cullmann Cc: kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann