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

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)
return;
}
if (action == actionFind) {
QFileInfo info = m_fileSystemModel->fileInfo(current);
if (m_fileSystemModel->isDir(current))
findOnFileSystem(info.absoluteFilePath());
else
findOnFileSystem(info.absolutePath());
TextEditor::FindInFiles::findOnFileSystem(m_fileSystemModel->filePath(current));
return;
}
Core::DocumentManager::executeOpenWithMenuAction(action);
......@@ -358,21 +354,6 @@ QString FolderNavigationWidget::msgFindOnFileSystem()
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)
{
QDir::Filters filters = m_fileSystemModel->filter();
......
......@@ -61,7 +61,6 @@ public:
bool autoSynchronization() const;
static void findOnFileSystem(const QString &pathIn);
static QString msgFindOnFileSystem();
bool hiddenFilesFilter() const;
......
......@@ -114,6 +114,7 @@
#include <coreplugin/variablemanager.h>
#include <coreplugin/fileutils.h>
#include <coreplugin/removefiledialog.h>
#include <texteditor/findinfiles.h>
#include <utils/qtcassert.h>
#include <utils/parameteraction.h>
......@@ -2852,7 +2853,7 @@ void ProjectExplorerPlugin::openFile()
void ProjectExplorerPlugin::searchOnFileSystem()
{
QTC_ASSERT(d->m_currentNode, return);
FolderNavigationWidget::findOnFileSystem(pathFor(d->m_currentNode));
TextEditor::FindInFiles::findOnFileSystem(pathFor(d->m_currentNode));
}
void ProjectExplorerPlugin::showInGraphicalShell()
......
......@@ -29,8 +29,10 @@
#include "findinfiles.h"
#include <utils/filesearch.h>
#include <coreplugin/editormanager/editormanager.h>
#include <find/findplugin.h>
#include <utils/filesearch.h>
#include <utils/qtcassert.h>
#include <QDebug>
#include <QSettings>
......@@ -44,10 +46,13 @@
using namespace Find;
using namespace TextEditor;
static FindInFiles *m_instance = 0;
FindInFiles::FindInFiles()
: m_configWidget(0),
m_directory(0)
{
m_instance = this;
}
FindInFiles::~FindInFiles()
......@@ -176,3 +181,11 @@ void FindInFiles::setDirectory(const QString &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:
QString label() const;
QString toolTip() const;
public:
static void findOnFileSystem(const QString &path);
private slots:
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