Don't include entries from "Backup" group in search results

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@223 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 16 years ago
parent e5e9cebc8a
commit c451d571c2
  1. 31
      src/Kdb3Database.cpp
  2. 6
      src/forms/SettingsDlg.ui
  3. 2
      src/lib/GroupView.cpp

@ -1696,23 +1696,40 @@ QList<IEntryHandle*> Kdb3Database::search(IGroupHandle* Group,const QString& sea
else
SearchEntries=entries();
for(int i=0;i<SearchEntries.size();i++){
IGroupHandle* backupGroup = NULL;
if (!Group){
QList<IGroupHandle*> allGroups = groups();
for (int i=0; i<allGroups.size(); i++){
if (allGroups[i]->parent()==NULL && allGroups[i]->title()=="Backup"){
backupGroup = allGroups[i];
break;
}
}
}
QList<IEntryHandle*> ResultEntries;
for(int i=0; i<SearchEntries.size(); i++){
IGroupHandle* entryGroup = SearchEntries[i]->group();
while (entryGroup->parent())
entryGroup = entryGroup->parent();
if (entryGroup == backupGroup)
continue;
bool match=false;
if(Fields[0])match=match||searchStringContains(search,SearchEntries[i]->title(),CaseSensitive,RegExp);
if(Fields[1])match=match||searchStringContains(search,SearchEntries[i]->username(),CaseSensitive,RegExp);
if(Fields[2])match=match||searchStringContains(search,SearchEntries[i]->url(),CaseSensitive,RegExp);
SecString Password=SearchEntries[i]->password(); Password.unlock();
SecString Password=SearchEntries[i]->password();
Password.unlock();
if(Fields[3])match=match||searchStringContains(search,Password.string(),CaseSensitive,RegExp);
Password.lock();
if(Fields[4])match=match||searchStringContains(search,SearchEntries[i]->comment(),CaseSensitive,RegExp);
if(Fields[5])match=match||searchStringContains(search,SearchEntries[i]->binaryDesc(),CaseSensitive,RegExp);
if(!match){
SearchEntries.removeAt(i);
i--;
}
if(match)
ResultEntries << SearchEntries[i];
}
return SearchEntries;
return ResultEntries;
}
void Kdb3Database::rebuildIndices(QList<StdGroup*>& list){

@ -451,9 +451,6 @@
<height>23</height>
</size>
</property>
<property name="pixmap" >
<pixmap/>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
@ -507,9 +504,6 @@
<height>23</height>
</size>
</property>
<property name="pixmap" >
<pixmap/>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>

@ -66,8 +66,8 @@ void KeepassGroupView::updateIcons(){
void KeepassGroupView::showSearchResults(){
if(topLevelItem(topLevelItemCount()-1)!=SearchResultItem){
addTopLevelItem(SearchResultItem);
setCurrentItem(SearchResultItem);
}
setCurrentItem(SearchResultItem);
emit searchResultsSelected();
}