Commit 6d08973c authored by Eike Ziller's avatar Eike Ziller

BaseFileFind: Make some methods static

Change-Id: I2cf75aabec2f44278c52e2bcff8a5278678517f3
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent a016c7f4
......@@ -125,6 +125,29 @@ public:
} // namespace Internal
static void syncComboWithSettings(QComboBox *combo, const QString &setting)
{
if (!combo)
return;
int index = combo->findText(setting);
if (index < 0)
combo->setEditText(setting);
else
combo->setCurrentIndex(index);
}
static void updateComboEntries(QComboBox *combo, bool onTop)
{
int index = combo->findText(combo->currentText());
if (index < 0) {
if (onTop)
combo->insertItem(0, combo->currentText());
else
combo->addItem(combo->currentText());
combo->setCurrentIndex(combo->findText(combo->currentText()));
}
}
using namespace Internal;
SearchEngine::SearchEngine()
......@@ -390,29 +413,6 @@ void BaseFileFind::readCommonSettings(QSettings *settings, const QString &defaul
syncSearchEngineCombo(currentSearchEngineIndex);
}
void BaseFileFind::syncComboWithSettings(QComboBox *combo, const QString &setting)
{
if (!combo)
return;
int index = combo->findText(setting);
if (index < 0)
combo->setEditText(setting);
else
combo->setCurrentIndex(index);
}
void BaseFileFind::updateComboEntries(QComboBox *combo, bool onTop)
{
int index = combo->findText(combo->currentText());
if (index < 0) {
if (onTop)
combo->insertItem(0, combo->currentText());
else
combo->addItem(combo->currentText());
combo->setCurrentIndex(combo->findText(combo->currentText()));
}
}
void BaseFileFind::openEditor(const SearchResultItem &item)
{
SearchResult *result = qobject_cast<SearchResult *>(sender());
......@@ -540,7 +540,7 @@ QVariant BaseFileFind::getAdditionalParameters(SearchResult *search)
QFuture<FileSearchResultList> BaseFileFind::executeSearch(const FileFindParameters &parameters)
{
return d->m_searchEngines[parameters.searchEngineIndex]->executeSearch(parameters,this);
return d->m_searchEngines[parameters.searchEngineIndex]->executeSearch(parameters, this);
}
namespace Internal {
......
......@@ -115,7 +115,7 @@ public:
protected:
virtual QVariant additionalParameters() const = 0;
QVariant getAdditionalParameters(Core::SearchResult *search);
static QVariant getAdditionalParameters(Core::SearchResult *search);
virtual QString label() const = 0; // see Core::SearchResultWindow::startNewSearch
virtual QString toolTip() const = 0; // see Core::SearchResultWindow::startNewSearch,
// add %1 placeholder where the find flags should be put
......@@ -124,8 +124,6 @@ protected:
void writeCommonSettings(QSettings *settings);
void readCommonSettings(QSettings *settings, const QString &defaultFilter);
QWidget *createPatternWidget();
void syncComboWithSettings(QComboBox *combo, const QString &setting);
void updateComboEntries(QComboBox *combo, bool onTop);
QStringList fileNameFilters() const;
SearchEngine *currentSearchEngine() const;
......
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