diff --git a/kdevplatform/language/duchain/ducontext.cpp b/kdevplatform/language/duchain/ducontext.cpp index 535587bb38d93c65aff7e2beff94d44a344d2b0c..db0f742cb41d7751f804f817ecaad620e1b6b76e 100644 --- a/kdevplatform/language/duchain/ducontext.cpp +++ b/kdevplatform/language/duchain/ducontext.cpp @@ -1496,7 +1496,6 @@ TopDUContext* DUContext::topContext() const } QWidget* DUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext, - const QString& htmlPrefix, const QString& htmlSuffix, AbstractNavigationWidget::DisplayHints hints) const { if (decl) { @@ -1506,7 +1505,6 @@ QWidget* DUContext::createNavigationWidget(Declaration* decl, TopDUContext* topC decl), TopDUContextPointer( topContext)); - context->setPrefixSuffix(htmlPrefix, htmlSuffix); widget->setContext(NavigationContextPointer(context)); return widget; } else { diff --git a/kdevplatform/language/duchain/ducontext.h b/kdevplatform/language/duchain/ducontext.h index 79b3cd92d9c8102e56c1814d8cb8b7d35841ce14..64ae9653473959b3d37bccfb650cc9d85a5dc682 100644 --- a/kdevplatform/language/duchain/ducontext.h +++ b/kdevplatform/language/duchain/ducontext.h @@ -675,8 +675,6 @@ private: * Zero to create a widget for this context. * @param topContext Top-context from where the navigation-widget is triggered. * In C++, this is needed to resolve forward-declarations. - * @param htmlPrefix Html-formatted text that should be prepended before any information shown by this widget - * @param htmlSuffix Html-formatted text that should be appended to any information shown by this widget * * Can return zero which disables the navigation widget. * @@ -685,8 +683,6 @@ private: * enables you to change the document contents from the widget without immediately closing the widget. */ virtual QWidget* createNavigationWidget(Declaration* decl = nullptr, TopDUContext* topContext = nullptr, - const QString& htmlPrefix = QString(), - const QString& htmlSuffix = QString(), AbstractNavigationWidget::DisplayHints hints = AbstractNavigationWidget::NoHints) const; diff --git a/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp b/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp index 4940736c68ae95a6862f63ffcab8d2643bdeb5dd..89ed6740eb07f73e62ecb4cc24b2d9de56d37862 100644 --- a/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp +++ b/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp @@ -90,8 +90,6 @@ QString AbstractDeclarationNavigationContext::html(bool shorten) modifyHtml() += QLatin1String("

"); - addExternalHtml(prefix()); - if (!d->m_declaration.data()) { modifyHtml() += i18n("
lost declaration
"); return currentHtml(); @@ -365,8 +363,6 @@ QString AbstractDeclarationNavigationContext::html(bool shorten) //modifyHtml() += "
"; - addExternalHtml(suffix()); - modifyHtml() += QLatin1String("

"); return currentHtml(); diff --git a/kdevplatform/language/duchain/navigation/abstractincludenavigationcontext.cpp b/kdevplatform/language/duchain/navigation/abstractincludenavigationcontext.cpp index f5a706ff904e6f603efdf5fd4cc2e44619c75828..5bf4db85ad9701d16ac6007e1c274baea7638c9f 100644 --- a/kdevplatform/language/duchain/navigation/abstractincludenavigationcontext.cpp +++ b/kdevplatform/language/duchain/navigation/abstractincludenavigationcontext.cpp @@ -78,7 +78,6 @@ QString AbstractIncludeNavigationContext::html(bool shorten) { clear(); modifyHtml() += QLatin1String("

"); - addExternalHtml(prefix()); QUrl u = m_item.url(); NavigationAction action(u, KTextEditor::Cursor(0, 0)); @@ -102,8 +101,6 @@ QString AbstractIncludeNavigationContext::html(bool shorten) modifyHtml() += i18n("not parsed yet"); } - addExternalHtml(suffix()); - modifyHtml() += QLatin1String("

"); return currentHtml(); } diff --git a/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp b/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp index a4c29e68bc1656abe05a77b124dcdc0959d041ef..8a8f8b7991d3382d49bdf2a1679448190d0ea3c2 100644 --- a/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp +++ b/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp @@ -56,7 +56,6 @@ public: QMap m_linkLines; //Holds the line for each link QMap m_intLinks; AbstractNavigationContext* m_previousContext; - QString m_prefix, m_suffix; TopDUContextPointer m_topContext; QString m_currentText; //Here the text is built @@ -87,32 +86,6 @@ AbstractNavigationContext::~AbstractNavigationContext() { } -void AbstractNavigationContext::addExternalHtml(const QString& text) -{ - int lastPos = 0; - int pos = 0; - QString fileMark = QStringLiteral("KDEV_FILE_LINK{"); - while (pos < text.length() && (pos = text.indexOf(fileMark, pos)) != -1) { - modifyHtml() += text.mid(lastPos, pos - lastPos); - - pos += fileMark.length(); - - if (pos != text.length()) { - int fileEnd = text.indexOf(QLatin1Char('}'), pos); - if (fileEnd != -1) { - QString file = text.mid(pos, fileEnd - pos); - pos = fileEnd + 1; - const QUrl url = QUrl::fromUserInput(file); - makeLink(url.fileName(), file, NavigationAction(url, KTextEditor::Cursor())); - } - } - - lastPos = pos; - } - - modifyHtml() += text.mid(lastPos, text.length() - lastPos); -} - void AbstractNavigationContext::makeLink(const QString& name, const DeclarationPointer& declaration, NavigationAction::Type actionType) { @@ -398,22 +371,6 @@ int AbstractNavigationContext::linkCount() const return d->m_linkCount; } -QString AbstractNavigationContext::prefix() const -{ - return d->m_prefix; -} - -QString AbstractNavigationContext::suffix() const -{ - return d->m_suffix; -} - -void AbstractNavigationContext::setPrefixSuffix(const QString& prefix, const QString& suffix) -{ - d->m_prefix = prefix; - d->m_suffix = suffix; -} - NavigationContextPointer AbstractNavigationContext::back() { if (d->m_previousContext) diff --git a/kdevplatform/language/duchain/navigation/abstractnavigationcontext.h b/kdevplatform/language/duchain/navigation/abstractnavigationcontext.h index 59e2e03b82e104d5278a8d2da62dad9a2dbf886e..3eb033e285ebb4dacb63d4f2ad6caab38534e5b8 100644 --- a/kdevplatform/language/duchain/navigation/abstractnavigationcontext.h +++ b/kdevplatform/language/duchain/navigation/abstractnavigationcontext.h @@ -74,10 +74,6 @@ public: void up(); void down(); - QString prefix() const; - QString suffix() const; - void setPrefixSuffix(const QString& prefix, const QString& suffix); - NavigationContextPointer accept(); NavigationContextPointer back(); NavigationContextPointer accept(IndexedDeclaration decl); @@ -143,8 +139,6 @@ protected: //Clears the computed html and links void clear(); - void addExternalHtml(const QString& text); - ///Creates and registers a link to the given declaration, labeled by the given name virtual void makeLink(const QString& name, const DeclarationPointer& declaration, NavigationAction::Type actionType); diff --git a/plugins/clang/duchain/clangducontext.cpp b/plugins/clang/duchain/clangducontext.cpp index ab40a94aa9f258723f1d224ee469a284f538f2c7..99048e57080e87dc2dd50883b85164dbfd2b0267 100644 --- a/plugins/clang/duchain/clangducontext.cpp +++ b/plugins/clang/duchain/clangducontext.cpp @@ -30,7 +30,6 @@ using namespace KDevelop; template<> QWidget* ClangTopDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext, - const QString& htmlPrefix, const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) const { if (!decl) { @@ -41,14 +40,13 @@ QWidget* ClangTopDUContext::createNavigationWidget(Declaration* decl, TopDUConte item.isDirectory = false; item.basePath = u.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); - return new ClangNavigationWidget(item, TopDUContextPointer(topContext ? topContext : this->topContext()), htmlPrefix, htmlSuffix, hints); + return new ClangNavigationWidget(item, TopDUContextPointer(topContext ? topContext : this->topContext()), hints); } return new ClangNavigationWidget(DeclarationPointer(decl), hints); } template<> QWidget* ClangNormalDUContext::createNavigationWidget(Declaration* decl, TopDUContext* /*topContext*/, - const QString& /*htmlPrefix*/, const QString& /*htmlSuffix*/, KDevelop::AbstractNavigationWidget::DisplayHints hints) const { if (!decl) { diff --git a/plugins/clang/duchain/clangducontext.h b/plugins/clang/duchain/clangducontext.h index c80cb0f4238ce350b00170c57ea0ddc692d8323e..b4a1e9b00b04500abdb8c694de83cab82106fba8 100644 --- a/plugins/clang/duchain/clangducontext.h +++ b/plugins/clang/duchain/clangducontext.h @@ -41,7 +41,6 @@ public: QWidget* createNavigationWidget(KDevelop::Declaration* decl = nullptr, KDevelop::TopDUContext* topContext = nullptr, - const QString& htmlPrefix = QString(), const QString& htmlSuffix = QString(), KDevelop::AbstractNavigationWidget::DisplayHints hints = KDevelop::AbstractNavigationWidget::NoHints) const override; enum { diff --git a/plugins/clang/duchain/macronavigationcontext.cpp b/plugins/clang/duchain/macronavigationcontext.cpp index 187f44e654c4f49fddad749196c2c82afe3bc7e6..6c95db123f431720cd7b3b42730c0d4960baae18 100644 --- a/plugins/clang/duchain/macronavigationcontext.cpp +++ b/plugins/clang/duchain/macronavigationcontext.cpp @@ -47,7 +47,6 @@ QString MacroNavigationContext::html(bool shorten) clear(); modifyHtml() += QLatin1String("

"); - addExternalHtml(prefix()); QStringList parameterList; parameterList.reserve(m_macro->parametersSize()); diff --git a/plugins/clang/duchain/navigationwidget.cpp b/plugins/clang/duchain/navigationwidget.cpp index a7624eae12dc1b9c562b2d81a7c26a3d5b65f69b..a1dc2c67c1056ed62844efe637df4df2c9d736c3 100644 --- a/plugins/clang/duchain/navigationwidget.cpp +++ b/plugins/clang/duchain/navigationwidget.cpp @@ -110,7 +110,6 @@ ClangNavigationWidget::ClangNavigationWidget(const MacroDefinition::Ptr& macro, } ClangNavigationWidget::ClangNavigationWidget(const IncludeItem& includeItem, const KDevelop::TopDUContextPointer& topContext, - const QString& htmlPrefix, const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) : AbstractNavigationWidget() { @@ -119,7 +118,6 @@ ClangNavigationWidget::ClangNavigationWidget(const IncludeItem& includeItem, con //The first context is registered so it is kept alive by the shared-pointer mechanism auto context = new IncludeNavigationContext(includeItem, topContext); - context->setPrefixSuffix(htmlPrefix, htmlSuffix); setContext(NavigationContextPointer(context)); } diff --git a/plugins/clang/duchain/navigationwidget.h b/plugins/clang/duchain/navigationwidget.h index 48a5b3843bcc702bf99284eb0485c41c4824988f..18bbe1a64770e74464865aee5988cb8e80b7baf9 100644 --- a/plugins/clang/duchain/navigationwidget.h +++ b/plugins/clang/duchain/navigationwidget.h @@ -44,7 +44,6 @@ public: ClangNavigationWidget(const MacroDefinition::Ptr& macro, const KDevelop::DocumentCursor& expansionLocation, KDevelop::AbstractNavigationWidget::DisplayHints hints = KDevelop::AbstractNavigationWidget::NoHints); ClangNavigationWidget(const KDevelop::IncludeItem& includeItem, const KDevelop::TopDUContextPointer& topContext, - const QString& htmlPrefix = QString(), const QString& htmlSuffix = QString(), KDevelop::AbstractNavigationWidget::DisplayHints hints = KDevelop::AbstractNavigationWidget::NoHints); ~ClangNavigationWidget() override = default; diff --git a/plugins/contextbrowser/contextbrowserview.cpp b/plugins/contextbrowser/contextbrowserview.cpp index 23f5640b6f9fd9c4cc8c6195da2c845d4a74018d..daf3000400afe6dddbe3bd3c4de333235d75d963 100644 --- a/plugins/contextbrowser/contextbrowserview.cpp +++ b/plugins/contextbrowser/contextbrowserview.cpp @@ -135,8 +135,7 @@ QWidget* ContextBrowserView::createWidget(KDevelop::DUContext* context) { m_context = IndexedDUContext(context); if (m_context.data()) { - return m_context.data()->createNavigationWidget(nullptr, nullptr, {}, {}, - AbstractNavigationWidget::EmbeddableWidget); + return m_context.data()->createNavigationWidget(nullptr, nullptr, AbstractNavigationWidget::EmbeddableWidget); } return nullptr; } @@ -149,8 +148,7 @@ KDevelop::IndexedDeclaration ContextBrowserView::declaration() const QWidget* ContextBrowserView::createWidget(Declaration* decl, TopDUContext* topContext) { m_declaration = IndexedDeclaration(decl); - return decl->context()->createNavigationWidget(decl, topContext, {}, {}, - AbstractNavigationWidget::EmbeddableWidget); + return decl->context()->createNavigationWidget(decl, topContext, AbstractNavigationWidget::EmbeddableWidget); } void ContextBrowserView::resetWidget() diff --git a/plugins/qmljs/duchain/navigation/navigationwidget.cpp b/plugins/qmljs/duchain/navigation/navigationwidget.cpp index 81114c0a60715ae757eb2d0ea2bbad1435b2430a..94a18121f711aac7356370d7c01a943c4fb2e979 100644 --- a/plugins/qmljs/duchain/navigation/navigationwidget.cpp +++ b/plugins/qmljs/duchain/navigation/navigationwidget.cpp @@ -31,23 +31,18 @@ namespace QmlJS { NavigationWidget::NavigationWidget(KDevelop::Declaration* decl, KDevelop::TopDUContext* topContext, - const QString& htmlPrefix, - const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) { auto context = new DeclarationNavigationContext( DeclarationPointer(decl), TopDUContextPointer(topContext) ); - context->setPrefixSuffix(htmlPrefix, htmlSuffix); setContext(NavigationContextPointer(context)); setDisplayHints(hints); } NavigationWidget::NavigationWidget(const KDevelop::IncludeItem& includeItem, const KDevelop::TopDUContextPointer& topContext, - const QString& htmlPrefix, - const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) : AbstractNavigationWidget() { @@ -57,7 +52,6 @@ NavigationWidget::NavigationWidget(const KDevelop::IncludeItem& includeItem, auto context = new AbstractIncludeNavigationContext( includeItem, topContext, StandardParsingEnvironment); - context->setPrefixSuffix(htmlPrefix, htmlSuffix); setContext(NavigationContextPointer(context)); } } diff --git a/plugins/qmljs/duchain/navigation/navigationwidget.h b/plugins/qmljs/duchain/navigation/navigationwidget.h index cdd587222414a36d23c9fadbc184aa65d7cc8cb4..fcf8543d92c3826dbd65363d8b9b28b1764eec60 100644 --- a/plugins/qmljs/duchain/navigation/navigationwidget.h +++ b/plugins/qmljs/duchain/navigation/navigationwidget.h @@ -38,13 +38,9 @@ class KDEVQMLJSDUCHAIN_EXPORT NavigationWidget : public KDevelop::AbstractNaviga public: NavigationWidget(KDevelop::Declaration* decl, KDevelop::TopDUContext* topContext, - const QString& htmlPrefix, - const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints); NavigationWidget(const KDevelop::IncludeItem& includeItem, const KDevelop::TopDUContextPointer& topContext, - const QString& htmlPrefix, - const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints); }; diff --git a/plugins/qmljs/duchain/qmljsducontext.cpp b/plugins/qmljs/duchain/qmljsducontext.cpp index 430d088ed8a8149d1d0d42f7be595fe3d502cd6c..23c1db3dbf584f0fdb4ce676cc0ce42c6664f647 100644 --- a/plugins/qmljs/duchain/qmljsducontext.cpp +++ b/plugins/qmljs/duchain/qmljsducontext.cpp @@ -37,7 +37,6 @@ namespace QmlJS { template<> QWidget* QmlJSTopDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext, - const QString& htmlPrefix, const QString& htmlSuffix, AbstractNavigationWidget::DisplayHints hints) const { if (!decl) { @@ -48,19 +47,18 @@ QWidget* QmlJSTopDUContext::createNavigationWidget(Declaration* decl, TopDUConte item.isDirectory = false; item.basePath = u.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); - return new NavigationWidget(item, TopDUContextPointer(topContext ? topContext : this->topContext()), htmlPrefix, htmlSuffix, hints); + return new NavigationWidget(item, TopDUContextPointer(topContext ? topContext : this->topContext()), hints); } - return new NavigationWidget(decl, topContext, htmlPrefix, htmlSuffix, hints); + return new NavigationWidget(decl, topContext, hints); } template<> -QWidget* QmlJSNormalDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext, const QString& htmlPrefix, - const QString& htmlSuffix, AbstractNavigationWidget::DisplayHints hints) const { +QWidget* QmlJSNormalDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext, AbstractNavigationWidget::DisplayHints hints) const { if (!decl) { qCDebug(KDEV_QMLJS_DUCHAIN) << "no declaration, not returning navigationwidget"; return nullptr; } - return new NavigationWidget(decl, topContext, htmlPrefix, htmlSuffix, hints); + return new NavigationWidget(decl, topContext, hints); } } diff --git a/plugins/qmljs/duchain/qmljsducontext.h b/plugins/qmljs/duchain/qmljsducontext.h index aff6061cbcd6981741e3f1b4862207c19fe408a7..f7ce87a36a369c7e3352f3a2831e4d58c53f3b9b 100644 --- a/plugins/qmljs/duchain/qmljsducontext.h +++ b/plugins/qmljs/duchain/qmljsducontext.h @@ -63,8 +63,6 @@ public: QWidget* createNavigationWidget(KDevelop::Declaration* decl, KDevelop::TopDUContext* topContext, - const QString& htmlPrefix, - const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) const override; enum { diff --git a/plugins/quickopen/duchainitemquickopen.cpp b/plugins/quickopen/duchainitemquickopen.cpp index 04c04c6371cc7fef2b9b3d68aea656c3af03dd46..96f5cfc926ec983f377469d1a8ba3aaa58c7e3c9 100644 --- a/plugins/quickopen/duchainitemquickopen.cpp +++ b/plugins/quickopen/duchainitemquickopen.cpp @@ -196,7 +196,7 @@ QWidget* DUChainItemData::expandingWidget() const } return decl->context()->createNavigationWidget(decl, decl->topContext(), - QString(), QString(), AbstractNavigationWidget::EmbeddableWidget); + AbstractNavigationWidget::EmbeddableWidget); } QIcon DUChainItemData::icon() const diff --git a/plugins/quickopen/projectfilequickopen.cpp b/plugins/quickopen/projectfilequickopen.cpp index d0efd39f9d05c3699552024463c91bd74d5d9864..991b5d0ca7cd431addb667919b15bbd3ecec0ba8 100644 --- a/plugins/quickopen/projectfilequickopen.cpp +++ b/plugins/quickopen/projectfilequickopen.cpp @@ -146,10 +146,8 @@ QWidget* ProjectFileData::expandingWidget() const } if (chosen) { - return chosen->createNavigationWidget(nullptr, nullptr, - QLatin1String("") - + i18nc("%1: project name", "Project %1", project()) - + QLatin1String("
")); + // TODO: show project name, by introducing a generic wrapper widget that supports QuickOpenEmbeddedWidgetInterface + return chosen->createNavigationWidget(); } else { auto* ret = new QTextBrowser(); ret->resize(400, 100);