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. 33
      src/Kdb3Database.cpp
  2. 6
      src/forms/SettingsDlg.ui
  3. 4
      src/lib/GroupView.cpp

@ -1695,24 +1695,41 @@ QList<IEntryHandle*> Kdb3Database::search(IGroupHandle* Group,const QString& sea
} }
else else
SearchEntries=entries(); 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; bool match=false;
if(Fields[0])match=match||searchStringContains(search,SearchEntries[i]->title(),CaseSensitive,RegExp); 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[1])match=match||searchStringContains(search,SearchEntries[i]->username(),CaseSensitive,RegExp);
if(Fields[2])match=match||searchStringContains(search,SearchEntries[i]->url(),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); if(Fields[3])match=match||searchStringContains(search,Password.string(),CaseSensitive,RegExp);
Password.lock(); Password.lock();
if(Fields[4])match=match||searchStringContains(search,SearchEntries[i]->comment(),CaseSensitive,RegExp); 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(Fields[5])match=match||searchStringContains(search,SearchEntries[i]->binaryDesc(),CaseSensitive,RegExp);
if(!match){ if(match)
SearchEntries.removeAt(i); ResultEntries << SearchEntries[i];
i--;
}
} }
return SearchEntries; return ResultEntries;
} }
void Kdb3Database::rebuildIndices(QList<StdGroup*>& list){ void Kdb3Database::rebuildIndices(QList<StdGroup*>& list){

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

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