Rename Group::includeInSearch() to resolveSearchingEnabled().

Make it public and drop the resolveInherit parameter.
This commit is contained in:
Felix Geyer 2014-04-26 18:27:52 +02:00
parent ad26d962dc
commit 7893a2e84d
2 changed files with 14 additions and 9 deletions

View File

@ -616,7 +616,17 @@ QList<Entry*> Group::search(const QString& searchTerm, Qt::CaseSensitivity caseS
bool resolveInherit) bool resolveInherit)
{ {
QList<Entry*> searchResult; QList<Entry*> searchResult;
if (includeInSearch(resolveInherit)) { bool search;
if (resolveInherit) {
search = resolveSearchingEnabled();
}
else if (searchingEnabled() == Disable) {
search = false;
}
else {
search = true;
}
if (search) {
Q_FOREACH (Entry* entry, m_entries) { Q_FOREACH (Entry* entry, m_entries) {
if (entry->match(searchTerm, caseSensitivity)) { if (entry->match(searchTerm, caseSensitivity)) {
searchResult.append(entry); searchResult.append(entry);
@ -629,7 +639,7 @@ QList<Entry*> Group::search(const QString& searchTerm, Qt::CaseSensitivity caseS
return searchResult; return searchResult;
} }
bool Group::includeInSearch(bool resolveInherit) bool Group::resolveSearchingEnabled() const
{ {
switch (m_data.searchingEnabled) { switch (m_data.searchingEnabled) {
case Inherit: case Inherit:
@ -637,12 +647,7 @@ bool Group::includeInSearch(bool resolveInherit)
return true; return true;
} }
else { else {
if (resolveInherit) { return m_parent->resolveSearchingEnabled();
return m_parent->includeInSearch(true);
}
else {
return true;
}
} }
case Enable: case Enable:
return true; return true;

View File

@ -65,6 +65,7 @@ public:
QString defaultAutoTypeSequence() const; QString defaultAutoTypeSequence() const;
Group::TriState autoTypeEnabled() const; Group::TriState autoTypeEnabled() const;
Group::TriState searchingEnabled() const; Group::TriState searchingEnabled() const;
bool resolveSearchingEnabled() const;
Entry* lastTopVisibleEntry() const; Entry* lastTopVisibleEntry() const;
bool isExpired() const; bool isExpired() const;
@ -147,7 +148,6 @@ private:
void cleanupParent(); void cleanupParent();
void recCreateDelObjects(); void recCreateDelObjects();
void updateTimeinfo(); void updateTimeinfo();
bool includeInSearch(bool resolveInherit);
QPointer<Database> m_db; QPointer<Database> m_db;
Uuid m_uuid; Uuid m_uuid;