Commit 732697d0 authored by Ismael Asensio's avatar Ismael Asensio
Browse files

Rename methods on DolphinFacetsWidget

Summary:
Small refactor patch to rename method names, from `ratingTerm` to `searchTerm`,
since its scope has grown bigger.

Test Plan: No behavior changes

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26029
parent 4dc362db
......@@ -86,7 +86,7 @@ DolphinFacetsWidget::DolphinFacetsWidget(QWidget* parent) :
topLayout->addWidget(m_ratingSelector);
topLayout->addWidget(m_tagsSelector);
resetOptions();
resetSearchTerms();
}
DolphinFacetsWidget::~DolphinFacetsWidget()
......@@ -99,12 +99,12 @@ void DolphinFacetsWidget::changeEvent(QEvent *event)
if (isEnabled()) {
updateTagsSelector();
} else {
resetOptions();
resetSearchTerms();
}
}
}
void DolphinFacetsWidget::resetOptions()
void DolphinFacetsWidget::resetSearchTerms()
{
m_typeSelector->setCurrentIndex(0);
m_dateSelector->setCurrentIndex(0);
......@@ -115,7 +115,7 @@ void DolphinFacetsWidget::resetOptions()
updateTagsMenu();
}
QString DolphinFacetsWidget::ratingTerm() const
QString DolphinFacetsWidget::searchTerms() const
{
QStringList terms;
......@@ -143,7 +143,7 @@ QString DolphinFacetsWidget::facetType() const
return m_typeSelector->currentData().toString();
}
bool DolphinFacetsWidget::isRatingTerm(const QString& term) const
bool DolphinFacetsWidget::isSearchTerm(const QString& term) const
{
const QStringList subTerms = term.split(' ', QString::SkipEmptyParts);
......@@ -166,7 +166,7 @@ bool DolphinFacetsWidget::isRatingTerm(const QString& term) const
return containsModified || containsRating || containsTag;
}
void DolphinFacetsWidget::setRatingTerm(const QString& term)
void DolphinFacetsWidget::setSearchTerm(const QString& term)
{
// If term has sub terms, then the sub terms are always "rating" and "modified" terms.
// If term has no sub terms, then the term itself is either a "rating" term or a "modified"
......
......@@ -52,13 +52,12 @@ public:
explicit DolphinFacetsWidget(QWidget* parent = nullptr);
~DolphinFacetsWidget() override;
void resetOptions();
QString ratingTerm() const;
QString searchTerms() const;
QString facetType() const;
bool isRatingTerm(const QString& term) const;
void setRatingTerm(const QString& term);
bool isSearchTerm(const QString& term) const;
void setSearchTerm(const QString& term);
void resetSearchTerms();
void setFacetType(const QString& type);
......
......@@ -28,7 +28,7 @@
namespace {
/** Checks if a given term in the Baloo::Query::searchString() is a special search term.
* This is a copy of `DolphinFacetsWidget::isRatingTerm()` method.
* This is a copy of `DolphinFacetsWidget::isSearchTerm()` method.
*/
bool isSearchTerm(const QString& term)
{
......
......@@ -478,7 +478,7 @@ QUrl DolphinSearchBox::balooUrlForSearching() const
query.addType(m_facetsWidget->facetType());
QStringList queryStrings;
QString ratingQuery = m_facetsWidget->ratingTerm();
QString ratingQuery = m_facetsWidget->searchTerms();
if (!ratingQuery.isEmpty()) {
queryStrings << ratingQuery;
}
......@@ -523,11 +523,11 @@ void DolphinSearchBox::updateFromQuery(const DolphinQuery& query)
m_fileNameButton->setChecked(true);
}
m_facetsWidget->resetOptions();
m_facetsWidget->resetSearchTerms();
m_facetsWidget->setFacetType(query.type());
const QStringList searchTerms = query.searchTerms();
for (const QString& searchTerm : searchTerms) {
m_facetsWidget->setRatingTerm(searchTerm);
m_facetsWidget->setSearchTerm(searchTerm);
}
m_startSearchTimer->stop();
......
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