Commit 372079d3 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Move findOnFileSystem from FolderNavigation to FindInFiles



Change-Id: I39069e1da20d34f9d5fd0f3caa996b13600ee5bb
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 666bdaa9
...@@ -343,11 +343,7 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev) ...@@ -343,11 +343,7 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev)
return; return;
} }
if (action == actionFind) { if (action == actionFind) {
QFileInfo info = m_fileSystemModel->fileInfo(current); TextEditor::FindInFiles::findOnFileSystem(m_fileSystemModel->filePath(current));
if (m_fileSystemModel->isDir(current))
findOnFileSystem(info.absoluteFilePath());
else
findOnFileSystem(info.absolutePath());
return; return;
} }
Core::DocumentManager::executeOpenWithMenuAction(action); Core::DocumentManager::executeOpenWithMenuAction(action);
...@@ -358,21 +354,6 @@ QString FolderNavigationWidget::msgFindOnFileSystem() ...@@ -358,21 +354,6 @@ QString FolderNavigationWidget::msgFindOnFileSystem()
return tr("Find in this directory..."); return tr("Find in this directory...");
} }
void FolderNavigationWidget::findOnFileSystem(const QString &pathIn)
{
const QFileInfo fileInfo(pathIn);
const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.absolutePath();
TextEditor::FindInFiles *fif = ExtensionSystem::PluginManager::getObject<TextEditor::FindInFiles>();
if (!fif)
return;
Find::FindPlugin *plugin = Find::FindPlugin::instance();
if (!plugin)
return;
fif->setDirectory(folder);
Find::FindPlugin::instance()->openFindDialog(fif);
}
void FolderNavigationWidget::setHiddenFilesFilter(bool filter) void FolderNavigationWidget::setHiddenFilesFilter(bool filter)
{ {
QDir::Filters filters = m_fileSystemModel->filter(); QDir::Filters filters = m_fileSystemModel->filter();
......
...@@ -61,7 +61,6 @@ public: ...@@ -61,7 +61,6 @@ public:
bool autoSynchronization() const; bool autoSynchronization() const;
static void findOnFileSystem(const QString &pathIn);
static QString msgFindOnFileSystem(); static QString msgFindOnFileSystem();
bool hiddenFilesFilter() const; bool hiddenFilesFilter() const;
......
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
#include <coreplugin/variablemanager.h> #include <coreplugin/variablemanager.h>
#include <coreplugin/fileutils.h> #include <coreplugin/fileutils.h>
#include <coreplugin/removefiledialog.h> #include <coreplugin/removefiledialog.h>
#include <texteditor/findinfiles.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
...@@ -2852,7 +2853,7 @@ void ProjectExplorerPlugin::openFile() ...@@ -2852,7 +2853,7 @@ void ProjectExplorerPlugin::openFile()
void ProjectExplorerPlugin::searchOnFileSystem() void ProjectExplorerPlugin::searchOnFileSystem()
{ {
QTC_ASSERT(d->m_currentNode, return); QTC_ASSERT(d->m_currentNode, return);
FolderNavigationWidget::findOnFileSystem(pathFor(d->m_currentNode)); TextEditor::FindInFiles::findOnFileSystem(pathFor(d->m_currentNode));
} }
void ProjectExplorerPlugin::showInGraphicalShell() void ProjectExplorerPlugin::showInGraphicalShell()
......
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
#include "findinfiles.h" #include "findinfiles.h"
#include <utils/filesearch.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <find/findplugin.h>
#include <utils/filesearch.h>
#include <utils/qtcassert.h>
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
...@@ -44,10 +46,13 @@ ...@@ -44,10 +46,13 @@
using namespace Find; using namespace Find;
using namespace TextEditor; using namespace TextEditor;
static FindInFiles *m_instance = 0;
FindInFiles::FindInFiles() FindInFiles::FindInFiles()
: m_configWidget(0), : m_configWidget(0),
m_directory(0) m_directory(0)
{ {
m_instance = this;
} }
FindInFiles::~FindInFiles() FindInFiles::~FindInFiles()
...@@ -176,3 +181,11 @@ void FindInFiles::setDirectory(const QString &directory) ...@@ -176,3 +181,11 @@ void FindInFiles::setDirectory(const QString &directory)
syncComboWithSettings(m_directory, directory); syncComboWithSettings(m_directory, directory);
} }
void FindInFiles::findOnFileSystem(const QString &path)
{
QTC_ASSERT(m_instance, return);
const QFileInfo fi(path);
const QString folder = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
m_instance->setDirectory(folder);
Find::FindPlugin::instance()->openFindDialog(m_instance);
}
...@@ -64,6 +64,9 @@ protected: ...@@ -64,6 +64,9 @@ protected:
QString label() const; QString label() const;
QString toolTip() const; QString toolTip() const;
public:
static void findOnFileSystem(const QString &path);
private slots: private slots:
void openFileBrowser(); void openFileBrowser();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment