D5656: Adds method to force the reloading of a document
cullmann added a comment. Herald added a project: Kate. Herald edited subscribers, added: kde-frameworks-devel; removed: Frameworks. See e.g. document.cpp: QVector Document::searchText(const KTextEditor::Range &range, const QString &pattern, const SearchOptions options) const { return d->searchText(range, pattern, options); } how one can do that. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: kde-frameworks-devel, anthonyfieroni, nalvarez, kwrite-devel, hase, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann, #frameworks
D5656: Adds method to force the reloading of a document
dhaumann added a comment. Do we really need this? Or is this a reject? REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: kde-frameworks-devel, anthonyfieroni, nalvarez, kwrite-devel, hase, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D5656: Adds method to force the reloading of a document
pedroarthurp abandoned this revision. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: kde-frameworks-devel, anthonyfieroni, nalvarez, kwrite-devel, gennad, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D5656: Adds method to force the reloading of a document
pedroarthurp created this revision. Restricted Application added subscribers: Frameworks, kwrite-devel. Restricted Application added a project: Frameworks. REVISION SUMMARY Currently, `KTextEditor::Document::documentReload()` shows a dialog asking the user if he/she wants to reload a file from disk. However, there are use cases where reloading the file from disk is the norm and no user interaction is required. For example, an external script would make changes in the file and those changes should be immediately reloaded. This patch then implements a mechanism through which `KTextEditor` clients could reload the file without asking user confirmation. The main motivation of this patch is to enable this no-confirmation-required file reloading to the external script facilities of kdevplataform. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 AFFECTED FILES src/document/katedocument.cpp src/document/katedocument.h src/include/ktexteditor/document.h To: pedroarthurp Cc: kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
pedroarthurp added reviewers: dfaure, brauch, dhaumann, cullmann. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
pedroarthurp added a dependent revision: D5673: Add option to reload a file without user confirmation after the execution of a external script. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
pedroarthurp added a comment. https://phabricator.kde.org/D5673 shows a use-case for this feature. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
nalvarez added a comment. I'm pretty sure this breaks ABI by adding a new virtual function... If an application was compiled against a previous version of KTextEditor and calls `documentSave()`, when run with a newer KTextEditor version (with this patch) it may end up calling the new `documentReload(ReloadDocument)`. With garbage in the first argument. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: nalvarez, kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
pedroarthurp added a comment. In https://phabricator.kde.org/D5656#106401, @nalvarez wrote: > I'm pretty sure this breaks ABI by adding a new virtual function... If an application was compiled against a previous version of KTextEditor and calls `documentSave()`, when run with a newer KTextEditor version (with this patch) it may end up calling the new `documentReload(ReloadDocument)`. With garbage in the first argument. Do you have any advice on how I would provide this functionality without breaking the ABI? REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: nalvarez, kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
cullmann added a comment. You can add the function as non-virtual one. Then call the right one of the d pointer, like we do for other new introduced view stuff: KTextEditor::Cursor View::maxScrollPosition() const { return d->maxScrollPositionInternal(); } Its bit ugly, as you have to do that manually but its BC. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: nalvarez, kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
cullmann requested changes to this revision. cullmann added a comment. This revision now requires changes to proceed. Please go the non-virtual way, thanks. Or has somebody else a better idea (or dislikes the whole additional API function). REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: nalvarez, kwrite-devel, #frameworks
D5656: Adds method to force the reloading of a document
anthonyfieroni added a comment. Make a protected constructor Document::Document(DocumentPrivate &dd) : d(dd) {} In KateDocument extend DocumentPrivate with KateDocumentPrivate, override documentReload and give it to base Document KateDocument(...) : Document(*new KateDocumentPrivate) Then make documentReload public non-virtual in Document with implementation d->documentReload(...) => which will call KateDocumentPrivate override function REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5656 To: pedroarthurp, dfaure, brauch, dhaumann, cullmann Cc: anthonyfieroni, nalvarez, kwrite-devel, #frameworks