diff options
36 files changed, 166 insertions, 95 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp index 124ec906b1f..2b81b509659 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp @@ -83,8 +83,12 @@ QList<Core::LocatorFilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface< return m_result; } -void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const +void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) // Get the project containing the target selected const auto cmakeProject = qobject_cast<CMakeProject *>( Utils::findOrDefault(SessionManager::projects(), [selection](Project *p) { diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h index 374c5816fa7..28fede0f751 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h @@ -40,7 +40,8 @@ public: void prepareSearch(const QString &entry) override; QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; private: diff --git a/src/plugins/coreplugin/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index df624793ddf..4d7cb124f38 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -180,8 +180,12 @@ QList<LocatorFilterEntry> BaseFileFilter::matchesFor(QFutureInterface<LocatorFil return betterEntries; } -void BaseFileFilter::accept(LocatorFilterEntry selection) const +void BaseFileFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) EditorManager::openEditor(selection.internalData.toString(), Id(), EditorManager::CanContainLineAndColumnNumber); } diff --git a/src/plugins/coreplugin/locator/basefilefilter.h b/src/plugins/coreplugin/locator/basefilefilter.h index c4623a25dcb..e9d55681e26 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.h +++ b/src/plugins/coreplugin/locator/basefilefilter.h @@ -72,7 +72,8 @@ public: void prepareSearch(const QString &entry) override; QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; protected: void setFileIterator(Iterator *iterator); diff --git a/src/plugins/coreplugin/locator/commandlocator.cpp b/src/plugins/coreplugin/locator/commandlocator.cpp index 14e57ad0178..bb38336656c 100644 --- a/src/plugins/coreplugin/locator/commandlocator.cpp +++ b/src/plugins/coreplugin/locator/commandlocator.cpp @@ -95,8 +95,12 @@ QList<LocatorFilterEntry> CommandLocator::matchesFor(QFutureInterface<LocatorFil return betterEntries; } -void CommandLocator::accept(LocatorFilterEntry entry) const +void CommandLocator::accept(LocatorFilterEntry entry, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) // Retrieve action via index. const int index = entry.internalData.toInt(); QTC_ASSERT(index >= 0 && index < d->commands.size(), return); diff --git a/src/plugins/coreplugin/locator/commandlocator.h b/src/plugins/coreplugin/locator/commandlocator.h index 1ce2eb0226e..f3b855e587b 100644 --- a/src/plugins/coreplugin/locator/commandlocator.h +++ b/src/plugins/coreplugin/locator/commandlocator.h @@ -47,7 +47,8 @@ public: QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; private: diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp index d46550a5698..47f53687925 100644 --- a/src/plugins/coreplugin/locator/executefilter.cpp +++ b/src/plugins/coreplugin/locator/executefilter.cpp @@ -79,8 +79,12 @@ QList<LocatorFilterEntry> ExecuteFilter::matchesFor(QFutureInterface<LocatorFilt return value; } -void ExecuteFilter::accept(LocatorFilterEntry selection) const +void ExecuteFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) ExecuteFilter *p = const_cast<ExecuteFilter *>(this); const QString value = selection.displayName.trimmed(); diff --git a/src/plugins/coreplugin/locator/executefilter.h b/src/plugins/coreplugin/locator/executefilter.h index 32d8f78705b..1bf14d831d7 100644 --- a/src/plugins/coreplugin/locator/executefilter.h +++ b/src/plugins/coreplugin/locator/executefilter.h @@ -51,7 +51,8 @@ public: ExecuteFilter(); QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &) override {} private: diff --git a/src/plugins/coreplugin/locator/externaltoolsfilter.cpp b/src/plugins/coreplugin/locator/externaltoolsfilter.cpp index 7307473168b..72b75303f38 100644 --- a/src/plugins/coreplugin/locator/externaltoolsfilter.cpp +++ b/src/plugins/coreplugin/locator/externaltoolsfilter.cpp @@ -47,8 +47,12 @@ QList<LocatorFilterEntry> ExternalToolsFilter::matchesFor(QFutureInterface<Locat return m_results; } -void ExternalToolsFilter::accept(LocatorFilterEntry selection) const +void ExternalToolsFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) auto tool = selection.internalData.value<ExternalTool *>(); QTC_ASSERT(tool, return); diff --git a/src/plugins/coreplugin/locator/externaltoolsfilter.h b/src/plugins/coreplugin/locator/externaltoolsfilter.h index 86ebf5f851b..0da84363295 100644 --- a/src/plugins/coreplugin/locator/externaltoolsfilter.h +++ b/src/plugins/coreplugin/locator/externaltoolsfilter.h @@ -38,7 +38,8 @@ public: QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; void prepareSearch(const QString &entry) override; diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index 78510d46ff1..7a4be1eee9d 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -57,8 +57,7 @@ QList<LocatorFilterEntry> *categorize(const QString &entry, const QString &candi } // anynoumous namespace -FileSystemFilter::FileSystemFilter(LocatorWidget *locatorWidget) - : m_locatorWidget(locatorWidget) +FileSystemFilter::FileSystemFilter() { setId("Files in file system"); setDisplayName(tr("Files in File System")); @@ -148,15 +147,18 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF return betterEntries; } -void FileSystemFilter::accept(LocatorFilterEntry selection) const +void FileSystemFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(selectionLength) QString fileName = selection.fileName; QFileInfo info(fileName); if (info.isDir()) { QString value = shortcutString(); value += QLatin1Char(' '); value += QDir::toNativeSeparators(info.absoluteFilePath() + QLatin1Char('/')); - m_locatorWidget->show(value, value.length()); + *newText = value; + *selectionStart = value.length(); return; } else if (!info.exists()) { QFile file(selection.internalData.toString()); diff --git a/src/plugins/coreplugin/locator/filesystemfilter.h b/src/plugins/coreplugin/locator/filesystemfilter.h index 63384e2cd91..57cd96206eb 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.h +++ b/src/plugins/coreplugin/locator/filesystemfilter.h @@ -36,25 +36,23 @@ namespace Core { namespace Internal { -class LocatorWidget; - class FileSystemFilter : public ILocatorFilter { Q_OBJECT public: - explicit FileSystemFilter(LocatorWidget *locatorWidget); + explicit FileSystemFilter(); void prepareSearch(const QString &entry) override; QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; QByteArray saveState() const override; void restoreState(const QByteArray &state) override; bool openConfigDialog(QWidget *parent, bool &needsRefresh) override; void refresh(QFutureInterface<void> &) override {} private: - LocatorWidget *m_locatorWidget; bool m_includeHidden = true; QString m_currentDocumentDirectory; }; diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp index 7dfde167414..966654c1c0d 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp @@ -419,10 +419,12 @@ void ILocatorFilter::setConfigurable(bool configurable) */ /*! - \fn void ILocatorFilter::accept(LocatorFilterEntry selection) const + \fn void ILocatorFilter::accept(LocatorFilterEntry selection, QString *newText, int *selectionStart, int *selectionLength) const Called with the entry specified by \a selection when the user activates it in the result list. + Implementations can return a new search term \a newText, which has \a selectionLength characters + starting from \a selectionStart preselected, and the cursor set to the end of the selection. */ /*! diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.h b/src/plugins/coreplugin/locator/ilocatorfilter.h index fba8d19b2fb..f9430511570 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.h +++ b/src/plugins/coreplugin/locator/ilocatorfilter.h @@ -117,7 +117,8 @@ public: virtual QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) = 0; - virtual void accept(LocatorFilterEntry selection) const = 0; + virtual void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const = 0; virtual void refresh(QFutureInterface<void> &future) = 0; diff --git a/src/plugins/coreplugin/locator/locator.cpp b/src/plugins/coreplugin/locator/locator.cpp index 91e80fc4bf7..addb172db28 100644 --- a/src/plugins/coreplugin/locator/locator.cpp +++ b/src/plugins/coreplugin/locator/locator.cpp @@ -48,6 +48,7 @@ #include <utils/algorithm.h> #include <utils/mapreduce.h> #include <utils/qtcassert.h> +#include <utils/utilsicons.h> #include <QSettings> #include <QtPlugin> @@ -89,31 +90,29 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) m_settingsPage = new LocatorSettingsPage(this); m_corePlugin->addObject(m_settingsPage); - m_locatorWidget = new LocatorWidget(this); - m_locatorWidget->setEnabled(false); - StatusBarWidget *view = new StatusBarWidget; - view->setWidget(m_locatorWidget); - view->setContext(Context("LocatorWidget")); - view->setPosition(StatusBarWidget::First); - m_corePlugin->addAutoReleasedObject(view); - - QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); + QAction *action = new QAction(Utils::Icons::ZOOM.icon(), tr("Locate..."), this); Command *cmd = ActionManager::registerAction(action, Constants::LOCATE); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); - connect(action, &QAction::triggered, this, &Locator::openLocator); - connect(cmd, &Command::keySequenceChanged, - this, [this, cmd]() { updatePlaceholderText(cmd); }); - updatePlaceholderText(cmd); + connect(action, &QAction::triggered, this, [] { + LocatorManager::show(QString()); + }); ActionContainer *mtools = ActionManager::actionContainer(Constants::M_TOOLS); mtools->addAction(cmd); - m_corePlugin->addObject(new LocatorManager(m_locatorWidget)); + auto locatorWidget = new LocatorWidget(this); + StatusBarWidget *view = new StatusBarWidget; + view->setWidget(locatorWidget); + view->setContext(Context("LocatorWidget")); + view->setPosition(StatusBarWidget::First); + m_corePlugin->addAutoReleasedObject(view); + + m_corePlugin->addObject(new LocatorManager(locatorWidget)); m_openDocumentsFilter = new OpenDocumentsFilter; m_corePlugin->addObject(m_openDocumentsFilter); - m_fileSystemFilter = new FileSystemFilter(m_locatorWidget); + m_fileSystemFilter = new FileSystemFilter(); m_corePlugin->addObject(m_fileSystemFilter); m_executeFilter = new ExecuteFilter(); @@ -122,7 +121,7 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) m_externalToolsFilter = new ExternalToolsFilter; m_corePlugin->addObject(m_externalToolsFilter); - m_corePlugin->addAutoReleasedObject(new LocatorFiltersFilter(this, m_locatorWidget)); + m_corePlugin->addAutoReleasedObject(new LocatorFiltersFilter(this)); #ifdef Q_OS_OSX m_corePlugin->addAutoReleasedObject(new SpotlightLocatorFilter); #endif @@ -130,21 +129,6 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) connect(ICore::instance(), &ICore::saveSettingsRequested, this, &Locator::saveSettings); } -void Locator::updatePlaceholderText(Command *command) -{ - QTC_ASSERT(command, return); - if (command->keySequence().isEmpty()) - m_locatorWidget->setPlaceholderText(tr("Type to locate")); - else - m_locatorWidget->setPlaceholderText(tr("Type to locate (%1)").arg( - command->keySequence().toString(QKeySequence::NativeText))); -} - -void Locator::openLocator() -{ - m_locatorWidget->show(QString()); -} - void Locator::extensionsInitialized() { m_filters = ExtensionSystem::PluginManager::getObjects<ILocatorFilter>(); @@ -198,11 +182,10 @@ void Locator::loadSettings() settings->endGroup(); settings->endGroup(); - m_locatorWidget->updateFilterList(); - m_locatorWidget->setEnabled(true); if (m_refreshTimer.interval() > 0) m_refreshTimer.start(); m_settingsInitialized = true; + emit filtersChanged(); } void Locator::updateEditorManagerPlaceholderText() @@ -296,7 +279,7 @@ void Locator::setFilters(QList<ILocatorFilter *> f) { m_filters = f; updateEditorManagerPlaceholderText(); // possibly some shortcut changed - m_locatorWidget->updateFilterList(); + emit filtersChanged(); } void Locator::setCustomFilters(QList<ILocatorFilter *> filters) diff --git a/src/plugins/coreplugin/locator/locator.h b/src/plugins/coreplugin/locator/locator.h index 84b1ab64de6..40e560e97d2 100644 --- a/src/plugins/coreplugin/locator/locator.h +++ b/src/plugins/coreplugin/locator/locator.h @@ -40,7 +40,6 @@ namespace Core { namespace Internal { class CorePlugin; -class LocatorWidget; class OpenDocumentsFilter; class FileSystemFilter; class LocatorSettingsPage; @@ -65,17 +64,17 @@ public: int refreshInterval(); void setRefreshInterval(int interval); +signals: + void filtersChanged(); + public slots: void refresh(QList<ILocatorFilter *> filters = QList<ILocatorFilter *>()); void saveSettings(); - void openLocator(); private: - void updatePlaceholderText(Core::Command *command); void loadSettings(); void updateEditorManagerPlaceholderText(); - LocatorWidget *m_locatorWidget; LocatorSettingsPage *m_settingsPage; bool m_settingsInitialized = false; diff --git a/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp index ae61898aeac..9b72dff0d81 100644 --- a/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp +++ b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp @@ -35,10 +35,8 @@ using namespace Core::Internal; Q_DECLARE_METATYPE(ILocatorFilter*) -LocatorFiltersFilter::LocatorFiltersFilter(Locator *plugin, - LocatorWidget *locatorWidget): +LocatorFiltersFilter::LocatorFiltersFilter(Locator *plugin): m_plugin(plugin), - m_locatorWidget(locatorWidget), m_icon(Utils::Icons::NEXT.icon()) { setId("FiltersFilter"); @@ -87,15 +85,18 @@ QList<LocatorFilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Loca return entries; } -void LocatorFiltersFilter::accept(LocatorFilterEntry selection) const +void LocatorFiltersFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(selectionLength) bool ok; int index = selection.internalData.toInt(&ok); QTC_ASSERT(ok && index >= 0 && index < m_filterShortcutStrings.size(), return); const QString shortcutString = m_filterShortcutStrings.at(index); - if (!shortcutString.isEmpty()) - m_locatorWidget->show(shortcutString + QLatin1Char(' '), - shortcutString.length() + 1); + if (!shortcutString.isEmpty()) { + *newText = shortcutString + QLatin1Char(' '); + *selectionStart = shortcutString.length() + 1; + } } void LocatorFiltersFilter::refresh(QFutureInterface<void> &future) diff --git a/src/plugins/coreplugin/locator/locatorfiltersfilter.h b/src/plugins/coreplugin/locator/locatorfiltersfilter.h index a97cc9493af..238eb440abb 100644 --- a/src/plugins/coreplugin/locator/locatorfiltersfilter.h +++ b/src/plugins/coreplugin/locator/locatorfiltersfilter.h @@ -33,7 +33,6 @@ namespace Core { namespace Internal { class Locator; -class LocatorWidget; /*! This filter provides the user with the list of available Locator filters. @@ -44,19 +43,18 @@ class LocatorFiltersFilter : public ILocatorFilter Q_OBJECT public: - LocatorFiltersFilter(Locator *plugin, - LocatorWidget *locatorWidget); + LocatorFiltersFilter(Locator *plugin); // ILocatorFilter void prepareSearch(const QString &entry) override; QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; private: Locator *m_plugin; - LocatorWidget *m_locatorWidget; QStringList m_filterShortcutStrings; QStringList m_filterDisplayNames; QIcon m_icon; diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index 55ffc5c93c6..e05a09337ad 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -283,7 +283,6 @@ LocatorWidget::LocatorWidget(Locator *qop) : setAttribute(Qt::WA_Hover); setFocusProxy(m_fileLineEdit); - setWindowTitle(tr("Locate...")); resize(200, 90); QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); @@ -296,7 +295,6 @@ LocatorWidget::LocatorWidget(Locator *qop) : layout->setMargin(0); layout->addWidget(m_fileLineEdit); - setWindowIcon(Utils::Icons::ZOOM.icon()); const QPixmap pixmap = Utils::Icons::MAGNIFIER.pixmap(); m_fileLineEdit->setFiltering(true); m_fileLineEdit->setButtonPixmap(Utils::FancyLineEdit::Left, pixmap); @@ -345,11 +343,27 @@ LocatorWidget::LocatorWidget(Locator *qop) : m_showProgressTimer.setSingleShot(true); m_showProgressTimer.setInterval(50); // don't show progress for < 50ms tasks connect(&m_showProgressTimer, &QTimer::timeout, [this]() { setProgressIndicatorVisible(true);}); + + Command *locateCmd = ActionManager::command(Constants::LOCATE); + if (QTC_GUARD(locateCmd)) { + connect(locateCmd, &Command::keySequenceChanged, this, [this,locateCmd] { + updatePlaceholderText(locateCmd); + }); + updatePlaceholderText(locateCmd); + } + + connect(m_locatorPlugin, &Locator::filtersChanged, this, &LocatorWidget::updateFilterList); + updateFilterList(); } -void LocatorWidget::setPlaceholderText(const QString &text) +void LocatorWidget::updatePlaceholderText(Command *command) { - m_fileLineEdit->setPlaceholderText(text); + QTC_ASSERT(command, return); + if (command->keySequence().isEmpty()) + m_fileLineEdit->setPlaceholderText(tr("Type to locate")); + else + m_fileLineEdit->setPlaceholderText(tr("Type to locate (%1)").arg( + command->keySequence().toString(QKeySequence::NativeText))); } void LocatorWidget::updateFilterList() @@ -658,10 +672,17 @@ void LocatorWidget::acceptCurrentEntry() if (!index.isValid()) return; const LocatorFilterEntry entry = m_locatorModel->data(index, ItemDataRoles::ResultItemRole).value<LocatorFilterEntry>(); - m_completionList->hide(); - m_fileLineEdit->clearFocus(); Q_ASSERT(entry.filter != nullptr); - entry.filter->accept(entry); + QString newText; + int selectionStart = -1; + int selectionLength = 0; + entry.filter->accept(entry, &newText, &selectionStart, &selectionLength); + if (newText.isEmpty()) { + m_completionList->hide(); + m_fileLineEdit->clearFocus(); + } else { + show(newText, selectionStart, selectionLength); + } } void LocatorWidget::show(const QString &text, int selectionStart, int selectionLength) diff --git a/src/plugins/coreplugin/locator/locatorwidget.h b/src/plugins/coreplugin/locator/locatorwidget.h index f6f2f6f4a4f..80b32192284 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.h +++ b/src/plugins/coreplugin/locator/locatorwidget.h @@ -58,7 +58,7 @@ public: void show(const QString &text, int selectionStart = -1, int selectionLength = 0); - void setPlaceholderText(const QString &text); + void updatePlaceholderText(Command *command); private: void showPopup(); diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp index d6bfcab4ef3..16b14ba9767 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp @@ -114,8 +114,12 @@ void OpenDocumentsFilter::refresh(QFutureInterface<void> &future) QMetaObject::invokeMethod(this, "refreshInternally", Qt::BlockingQueuedConnection); } -void OpenDocumentsFilter::accept(LocatorFilterEntry selection) const +void OpenDocumentsFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) EditorManager::openEditor(selection.internalData.toString(), Id(), EditorManager::CanContainLineAndColumnNumber); } diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.h b/src/plugins/coreplugin/locator/opendocumentsfilter.h index 00622d1dbfd..8d140c86d79 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.h +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.h @@ -45,7 +45,8 @@ public: OpenDocumentsFilter(); QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; public slots: diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index 537dcc6da87..bc0584a0a56 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -119,8 +119,13 @@ QList<Core::LocatorFilterEntry> CppCurrentDocumentFilter::matchesFor( return betterEntries; } -void CppCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection) const +void CppCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, + int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) IndexItem::Ptr info = qvariant_cast<CppTools::IndexItem::Ptr>(selection.internalData); Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column()); } diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.h b/src/plugins/cpptools/cppcurrentdocumentfilter.h index 2a93cd3432e..d3452e26e10 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.h +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.h @@ -48,7 +48,8 @@ public: QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; private: diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 084c4d5479d..f8bf53dd325 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -121,8 +121,12 @@ QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor( return betterEntries; } -void CppLocatorFilter::accept(Core::LocatorFilterEntry selection) const +void CppLocatorFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) IndexItem::Ptr info = qvariant_cast<IndexItem::Ptr>(selection.internalData); Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column()); } diff --git a/src/plugins/cpptools/cpplocatorfilter.h b/src/plugins/cpptools/cpplocatorfilter.h index 84ab9802ba6..1ce112b6626 100644 --- a/src/plugins/cpptools/cpplocatorfilter.h +++ b/src/plugins/cpptools/cpplocatorfilter.h @@ -43,7 +43,8 @@ public: QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; protected: diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index 61bf3d76b31..0428ee9c83d 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -137,8 +137,12 @@ QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFi return entries; } -void HelpIndexFilter::accept(LocatorFilterEntry selection) const +void HelpIndexFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) const QString &key = selection.displayName; const QMap<QString, QUrl> &links = HelpManager::linksForKeyword(key); diff --git a/src/plugins/help/helpindexfilter.h b/src/plugins/help/helpindexfilter.h index 701c37dbd39..1cf1f412975 100644 --- a/src/plugins/help/helpindexfilter.h +++ b/src/plugins/help/helpindexfilter.h @@ -45,7 +45,8 @@ public: void prepareSearch(const QString &entry) override; QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; Q_INVOKABLE QSet<QString> searchMatches(const QString &databaseFilePath, diff --git a/src/plugins/help/remotehelpfilter.cpp b/src/plugins/help/remotehelpfilter.cpp index 85684df6b71..6e176b9df66 100644 --- a/src/plugins/help/remotehelpfilter.cpp +++ b/src/plugins/help/remotehelpfilter.cpp @@ -143,8 +143,12 @@ QList<Core::LocatorFilterEntry> RemoteHelpFilter::matchesFor(QFutureInterface<Co return entries; } -void RemoteHelpFilter::accept(Core::LocatorFilterEntry selection) const +void RemoteHelpFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) const QString &url = selection.displayName; if (!url.isEmpty()) emit linkActivated(url); diff --git a/src/plugins/help/remotehelpfilter.h b/src/plugins/help/remotehelpfilter.h index 1dc89ab0856..607cbab943a 100644 --- a/src/plugins/help/remotehelpfilter.h +++ b/src/plugins/help/remotehelpfilter.h @@ -45,7 +45,8 @@ public: // ILocatorFilter QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; QByteArray saveState() const override; void restoreState(const QByteArray &state) override; diff --git a/src/plugins/macros/macrolocatorfilter.cpp b/src/plugins/macros/macrolocatorfilter.cpp index a631eafd546..b38ef531d8d 100644 --- a/src/plugins/macros/macrolocatorfilter.cpp +++ b/src/plugins/macros/macrolocatorfilter.cpp @@ -86,8 +86,12 @@ QList<Core::LocatorFilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface< return betterEntries; } -void MacroLocatorFilter::accept(Core::LocatorFilterEntry selection) const +void MacroLocatorFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) // Give the focus back to the editor Core::IEditor *editor = Core::EditorManager::currentEditor(); if (editor) diff --git a/src/plugins/macros/macrolocatorfilter.h b/src/plugins/macros/macrolocatorfilter.h index 442de6d3e24..f8dc6577537 100644 --- a/src/plugins/macros/macrolocatorfilter.h +++ b/src/plugins/macros/macrolocatorfilter.h @@ -45,7 +45,8 @@ public: QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; private: diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.cpp b/src/plugins/qmljstools/qmljsfunctionfilter.cpp index 036ba1a314d..7c00e6c9f02 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.cpp +++ b/src/plugins/qmljstools/qmljsfunctionfilter.cpp @@ -104,8 +104,12 @@ QList<Core::LocatorFilterEntry> FunctionFilter::matchesFor( return betterEntries; } -void FunctionFilter::accept(Core::LocatorFilterEntry selection) const +void FunctionFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) const LocatorData::Entry entry = qvariant_cast<LocatorData::Entry>(selection.internalData); Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column); } diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.h b/src/plugins/qmljstools/qmljsfunctionfilter.h index d696744694c..5d41c870d5d 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.h +++ b/src/plugins/qmljstools/qmljsfunctionfilter.h @@ -42,7 +42,8 @@ public: QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &future) override; private: diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp index 13769727338..76a81522b18 100644 --- a/src/plugins/texteditor/linenumberfilter.cpp +++ b/src/plugins/texteditor/linenumberfilter.cpp @@ -88,8 +88,12 @@ QList<LocatorFilterEntry> LineNumberFilter::matchesFor(QFutureInterface<LocatorF return value; } -void LineNumberFilter::accept(LocatorFilterEntry selection) const +void LineNumberFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) IEditor *editor = EditorManager::currentEditor(); if (editor) { EditorManager::addCurrentPositionToNavigationHistory(); diff --git a/src/plugins/texteditor/linenumberfilter.h b/src/plugins/texteditor/linenumberfilter.h index 8d0fe999ede..de35e95696c 100644 --- a/src/plugins/texteditor/linenumberfilter.h +++ b/src/plugins/texteditor/linenumberfilter.h @@ -46,7 +46,8 @@ public: void prepareSearch(const QString &entry) override; QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface<void> &) override {} private: |