Commit 26d8b875 authored by Eike Ziller's avatar Eike Ziller
Browse files

Disable "Search Again" if file filter is disabled.



For example disabled it for "All Projects" searches when all projects
are closed.

Change-Id: Icc65a87577ba51f4362791dc8ecdca3c92819553
Reviewed-by: default avatarLeandro Melo <leandro.melo@nokia.com>
parent 2cb7c6ad
......@@ -242,7 +242,7 @@ void SymbolsFindFilter::onTaskStarted(const QString &type)
{
if (type == CppTools::Constants::TASK_INDEX) {
m_enabled = false;
emit changed();
emit enabledChanged(m_enabled);
}
}
......@@ -250,7 +250,7 @@ void SymbolsFindFilter::onAllTasksFinished(const QString &type)
{
if (type == CppTools::Constants::TASK_INDEX) {
m_enabled = true;
emit changed();
emit enabledChanged(m_enabled);
}
}
......
......@@ -249,7 +249,7 @@ void FindPlugin::setupFilterMenuItems()
mfindadvanced->addAction(cmd);
d->m_filterActions.insert(filter, action);
connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter()));
connect(filter, SIGNAL(changed()), this, SLOT(filterChanged()));
connect(filter, SIGNAL(enabledChanged(bool)), this, SLOT(filterChanged()));
}
d->m_findDialog->setFindFilters(findInterfaces);
d->m_openFindDialog->setEnabled(haveEnabledFilters);
......
......@@ -175,9 +175,9 @@ void FindToolWindow::setCurrentFilter(int index)
if (i == index) {
m_configWidget = configWidget;
if (m_currentFilter)
disconnect(m_currentFilter, SIGNAL(changed()), this, SLOT(updateButtonStates()));
disconnect(m_currentFilter, SIGNAL(enabledChanged(bool)), this, SLOT(updateButtonStates()));
m_currentFilter = m_filters.at(i);
connect(m_currentFilter, SIGNAL(changed()), this, SLOT(updateButtonStates()));
connect(m_currentFilter, SIGNAL(enabledChanged(bool)), this, SLOT(updateButtonStates()));
updateButtonStates();
if (m_configWidget) {
m_ui.configWidget->layout()->addWidget(m_configWidget);
......
......@@ -72,7 +72,7 @@ public:
static QPixmap pixmapForFindFlags(FindFlags flags);
static QString descriptionForFindFlags(FindFlags flags);
signals:
void changed();
void enabledChanged(bool enabled);
};
} // namespace Find
......
......@@ -474,6 +474,11 @@ void SearchResultWidget::setSearchAgainSupported(bool supported)
m_searchAgainButton->setVisible(supported && !m_cancelButton->isVisible());
}
void SearchResultWidget::setSearchAgainEnabled(bool enabled)
{
m_searchAgainButton->setEnabled(enabled);
}
void SearchResultWidget::finishSearch()
{
m_replaceTextEdit->setEnabled(m_count > 0);
......
......@@ -86,6 +86,7 @@ public:
void reset();
void setSearchAgainSupported(bool supported);
void setSearchAgainEnabled(bool enabled);
public slots:
void finishSearch();
......
......@@ -655,6 +655,11 @@ void SearchResult::reset()
m_widget->reset();
}
void SearchResult::setSearchAgainEnabled(bool enabled)
{
m_widget->setSearchAgainEnabled(enabled);
}
} // namespace Find
#include "searchresultwindow.moc"
......@@ -108,6 +108,7 @@ public slots:
void finishSearch();
void setTextToReplace(const QString &textToReplace);
void reset();
void setSearchAgainEnabled(bool enabled);
signals:
void activated(const Find::SearchResultItem &item);
......
......@@ -57,7 +57,7 @@ AllProjectsFind::AllProjectsFind(ProjectExplorerPlugin *plugin)
: m_plugin(plugin),
m_configWidget(0)
{
connect(m_plugin, SIGNAL(fileListChanged()), this, SIGNAL(changed()));
connect(m_plugin, SIGNAL(fileListChanged()), this, SLOT(handleFileListChanged()));
}
QString AllProjectsFind::id() const
......@@ -135,6 +135,11 @@ QString AllProjectsFind::toolTip() const
return tr("Filter: %1\n%2").arg(fileNameFilters().join(QLatin1String(",")));
}
void AllProjectsFind::handleFileListChanged()
{
emit enabledChanged(isEnabled());
}
QWidget *AllProjectsFind::createConfigWidget()
{
if (!m_configWidget) {
......
......@@ -70,6 +70,8 @@ protected:
QString label() const;
QString toolTip() const;
private slots:
void handleFileListChanged();
private:
ProjectExplorerPlugin *m_plugin;
......
......@@ -54,7 +54,7 @@ CurrentProjectFind::CurrentProjectFind(ProjectExplorerPlugin *plugin)
m_plugin(plugin)
{
connect(m_plugin, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
this, SIGNAL(changed()));
this, SLOT(handleProjectChanged()));
}
QString CurrentProjectFind::id() const
......@@ -99,6 +99,11 @@ QString CurrentProjectFind::label() const
return tr("Project '%1':").arg(m_plugin->currentProject()->displayName());
}
void CurrentProjectFind::handleProjectChanged()
{
emit enabledChanged(isEnabled());
}
void CurrentProjectFind::writeSettings(QSettings *settings)
{
settings->beginGroup(QLatin1String("CurrentProjectFind"));
......
......@@ -67,6 +67,9 @@ protected:
QVariant additionalParameters() const;
QString label() const;
private slots:
void handleProjectChanged();
private:
ProjectExplorerPlugin *m_plugin;
};
......
......@@ -131,6 +131,7 @@ void BaseFileFind::runNewSearch(const QString &txt, Find::FindFlags findFlags,
connect(search, SIGNAL(visibilityChanged(bool)), this, SLOT(hideHighlightAll(bool)));
connect(search, SIGNAL(cancelled()), this, SLOT(cancel()));
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain()));
connect(this, SIGNAL(enabledChanged(bool)), search, SLOT(setSearchAgainEnabled(bool)));
runSearch(search);
}
......
......@@ -104,13 +104,13 @@ void FindInCurrentFile::handleFileChange(Core::IEditor *editor)
if (!editor) {
if (m_currentFile) {
m_currentFile = 0;
emit changed();
emit enabledChanged(isEnabled());
}
} else {
Core::IFile *file = editor->file();
if (file != m_currentFile) {
m_currentFile = file;
emit changed();
emit enabledChanged(isEnabled());
}
}
}
......
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