MCPcopy Create free account
hub / github.com/KDE/kdevelop / documentUrlChanged

Method documentUrlChanged

kdevplatform/shell/textdocument.cpp:781–806  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779}
780
781void KDevelop::TextDocument::documentUrlChanged(KTextEditor::Document* document)
782{
783 Q_D(TextDocument);
784
785 Q_ASSERT(document == d->document); // we connect only to our document's signal
786
787 // KDevelop prevents a document URL change to empty to relieve slots connected to the
788 // IDocumentController::documentUrlChanged() signal from dealing with empty URLs. Furthermore,
789 // an empty IDocument URL is not unique, which is likely to break code that assumes otherwise.
790 if (d->document->url().isEmpty()) {
791#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(6, 9, 0)
792 qCWarning(SHELL) << "ignoring KTextEditor::Document URL change to empty; current URL:"
793 << url().toString(QUrl::PreferLocalFile)
794 << "; this should never happen and ought to be prevented in KTextEditor code!";
795#else
796 // The document's URL can be empty here until KTextEditor version 6.9.0 (more specifically,
797 // until https://commits.kde.org/ktexteditor/20a58cd2f989ca0001cedb6b149393e23d76e819).
798 qCDebug(SHELL) << "ignoring KTextEditor::Document URL change to empty; current URL:"
799 << url().toString(QUrl::PreferLocalFile);
800#endif
801 return;
802 }
803
804 if (url() != d->document->url())
805 setUrl(d->document->url());
806}
807
808#include "moc_textdocument.cpp"

Callers

nothing calls this directly

Calls 4

urlFunction · 0.85
isEmptyMethod · 0.45
urlMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected