diff options
author | Francois Ferrand <thetypz@gmail.com> | 2012-06-01 17:13:53 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@nokia.com> | 2012-06-21 13:03:56 +0200 |
commit | 4cac96447d05489bc9477799249c2fb83b590329 (patch) | |
tree | 3216647885b8a9c197b7398cc5040496301e60ac /src/plugins/locator/locatorwidget.cpp | |
parent | 69552f01d4a25f5d97b85e0fdd2c4c7d87982f50 (diff) |
Allow specifying line number when selecting a file with the locator.
When using the file selections locators (OpenDocumentsFilter, FileSystemFilter,
and those inherited from BaseFileFilter), allow specifying the line where to open
the file: like 'file.cpp:654'.
This syntax works for wildcards/incomplete expression as well: toto:423 will match
'toto', and open resulting file at line 423.
Also, fix line extraction in editormanager, to support a single semicolon (without
number) as well as a line explicitely set to 0.
Change-Id: I80e13b59aa9c972f33963cfee81ec04f277fe526
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Diffstat (limited to 'src/plugins/locator/locatorwidget.cpp')
-rw-r--r-- | src/plugins/locator/locatorwidget.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp index 5725a13c23..eb24477aa6 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/locator/locatorwidget.cpp @@ -43,6 +43,7 @@ #include <coreplugin/modemanager.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/command.h> +#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/coreconstants.h> #include <coreplugin/fileiconprovider.h> #include <utils/filterlineedit.h> @@ -189,8 +190,9 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const FilterEntry &entry = mEntries[index.row()]; if (entry.resolveFileIcon && entry.displayIcon.isNull()) { entry.resolveFileIcon = false; - entry.displayIcon = - Core::FileIconProvider::instance()->icon(QFileInfo(entry.internalData.toString())); + QString path = entry.internalData.toString(); + Core::EditorManager::splitLineNumber(&path); + entry.displayIcon = Core::FileIconProvider::instance()->icon(QFileInfo(path)); } return entry.displayIcon; } else if (role == Qt::ForegroundRole && index.column() == 1) { |