some work on the search function

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@30 b624d157-de02-0410-bad0-e51aec6abb33
master
tariq 19 years ago
parent 69f00ee477
commit 3d8bcf2ee8
  1. 3
      src/dialogs/SearchDlg.cpp
  2. 550
      src/forms/SearchDlg.ui
  3. 8
      src/main.cpp
  4. 2
      src/main.h
  5. 26
      src/mainwindow.cpp
  6. 3
      src/mainwindow.h

@ -30,6 +30,9 @@ CSearchDlg::CSearchDlg(CGroup* pGroup,QWidget* parent, const char* name, bool mo
: QDialog(parent,name, modal,fl)
{
setupUi(this);
connect( Button_Search, SIGNAL( clicked() ), this, SLOT( OnButtonSearch() ) );
connect( Button_Close, SIGNAL( clicked() ), this, SLOT( OnButtonClose() ) );
createBanner(Banner,Icon_Search32x32,tr("Suchen"));
checkBox_Cs->setChecked(config.SearchOptions[0]);
checkBox_regExp->setChecked(config.SearchOptions[1]);

@ -1,268 +1,298 @@
<ui version="4.0" stdsetdef="1" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>Search_Dlg</class>
<widget class="QDialog" name="Search_Dlg" >
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>Search_Dlg</class>
<widget class="QDialog" name="Search_Dlg" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>260</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>390</width>
<height>260</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>390</width>
<height>260</height>
</size>
</property>
<property name="windowTitle" >
<string>Suche...</string>
</property>
<widget class="QLabel" name="textLabel1" >
<property name="geometry" >
<rect>
<x>10</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Suchbegriff:</string>
</property>
</widget>
<widget class="QLineEdit" name="Edit_Search" >
<property name="geometry" >
<rect>
<x>110</x>
<y>60</y>
<width>270</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_regExp" >
<property name="geometry" >
<rect>
<x>110</x>
<y>110</y>
<width>170</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>regul&amp;ärer Ausdruck</string>
</property>
<property name="shortcut" >
<string>Alt+Ä</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Cs" >
<property name="geometry" >
<rect>
<x>110</x>
<y>90</y>
<width>250</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Gro&amp;ß- und Kleinschreibung beachten</string>
</property>
<property name="shortcut" >
<string>Alt+ß</string>
</property>
</widget>
<widget class="QLabel" name="Banner" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>50</height>
</rect>
</property>
<property name="pixmap" >
<pixmap/>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="checkBox" >
<property name="geometry" >
<rect>
<x>110</x>
<y>130</y>
<width>271</width>
<height>22</height>
</rect>
</property>
<property name="text" >
<string>Untergruppen einbeziehen</string>
</property>
</widget>
<widget class="Q3GroupBox" name="groupBox1" >
<property name="geometry" >
<rect>
<x>10</x>
<y>150</y>
<width>370</width>
<height>70</height>
</rect>
</property>
<property name="title" >
<string>Suche nach</string>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QCheckBox" name="checkBox_Title" >
<property name="geometry" >
<rect>
<x>20</x>
<y>20</y>
<width>110</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>&amp;Titel</string>
</property>
<property name="shortcut" >
<string>Alt+T</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Username" >
<property name="geometry" >
<rect>
<x>20</x>
<y>40</y>
<width>110</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Benut&amp;zername</string>
</property>
<property name="shortcut" >
<string>Alt+Z</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Comment" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>246</height>
</rect>
<rect>
<x>140</x>
<y>40</y>
<width>120</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>&amp;Kommentar</string>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="shortcut" >
<string>Alt+K</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_URL" >
<property name="geometry" >
<rect>
<x>260</x>
<y>20</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize" >
<size>
<width>390</width>
<height>246</height>
</size>
<property name="text" >
<string>&amp;URL</string>
</property>
<property name="shortcut" >
<string>Alt+U</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Attachment" >
<property name="geometry" >
<rect>
<x>260</x>
<y>40</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="maximumSize" >
<size>
<width>390</width>
<height>246</height>
</size>
<property name="text" >
<string>A&amp;nhang</string>
</property>
<property name="windowTitle" >
<string>Suche...</string>
<property name="shortcut" >
<string>Alt+N</string>
</property>
<widget class="QLabel" name="Banner" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>50</height>
</rect>
</property>
<property name="pixmap" >
<pixmap>image0</pixmap>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
</widget>
<widget class="Q3GroupBox" name="groupBox1" >
<property name="geometry" >
<rect>
<x>10</x>
<y>130</y>
<width>370</width>
<height>70</height>
</rect>
</property>
<property name="title" >
<string>Suche nach</string>
</property>
<widget class="QCheckBox" name="checkBox_Title" >
<property name="geometry" >
<rect>
<x>20</x>
<y>20</y>
<width>110</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>&amp;Titel</string>
</property>
<property name="shortcut" >
<string>Alt+T</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Username" >
<property name="geometry" >
<rect>
<x>20</x>
<y>40</y>
<width>110</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Benut&amp;zername</string>
</property>
<property name="shortcut" >
<string>Alt+Z</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Comment" >
<property name="geometry" >
<rect>
<x>140</x>
<y>40</y>
<width>120</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>&amp;Kommentar</string>
</property>
<property name="shortcut" >
<string>Alt+K</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_URL" >
<property name="geometry" >
<rect>
<x>260</x>
<y>20</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>&amp;URL</string>
</property>
<property name="shortcut" >
<string>Alt+U</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Attachment" >
<property name="geometry" >
<rect>
<x>260</x>
<y>40</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>A&amp;nhang</string>
</property>
<property name="shortcut" >
<string>Alt+N</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Password" >
<property name="geometry" >
<rect>
<x>140</x>
<y>20</y>
<width>110</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Pass&amp;wort</string>
</property>
<property name="shortcut" >
<string>Alt+W</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="Button_Close" >
<property name="geometry" >
<rect>
<x>280</x>
<y>210</y>
<width>97</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>S&amp;chließen</string>
</property>
<property name="shortcut" >
<string>Alt+C</string>
</property>
</widget>
<widget class="QLabel" name="textLabel1" >
<property name="geometry" >
<rect>
<x>10</x>
<y>60</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Suchbegriff:</string>
</property>
</widget>
<widget class="QPushButton" name="Button_Search" >
<property name="geometry" >
<rect>
<x>170</x>
<y>210</y>
<width>97</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>Suchen</string>
</property>
</widget>
<widget class="QLineEdit" name="Edit_Search" >
<property name="geometry" >
<rect>
<x>110</x>
<y>60</y>
<width>270</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_regExp" >
<property name="geometry" >
<rect>
<x>110</x>
<y>110</y>
<width>170</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>regul&amp;ärer Ausdruck</string>
</property>
<property name="shortcut" >
<string>Alt+ä</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_Cs" >
<property name="geometry" >
<rect>
<x>110</x>
<y>90</y>
<width>250</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Gro&amp;ß- und Kleinschreibung beachten</string>
</property>
<property name="shortcut" >
<string>Alt+ß</string>
</property>
</widget>
</widget>
<widget class="QCheckBox" name="checkBox_Password" >
<property name="geometry" >
<rect>
<x>140</x>
<y>20</y>
<width>110</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Pass&amp;wort</string>
</property>
<property name="shortcut" >
<string>Alt+W</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="Button_Search" >
<property name="geometry" >
<rect>
<x>170</x>
<y>230</y>
<width>97</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Suchen</string>
</property>
</widget>
<widget class="QPushButton" name="Button_Close" >
<property name="geometry" >
<rect>
<x>280</x>
<y>230</y>
<width>97</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>S&amp;chließen</string>
</property>
<property name="shortcut" >
<string>Alt+C</string>
</property>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<tabstops>
<tabstop>Edit_Search</tabstop>
<tabstop>checkBox_Cs</tabstop>
<tabstop>checkBox_regExp</tabstop>
<tabstop>checkBox_Title</tabstop>
<tabstop>checkBox_Username</tabstop>
<tabstop>checkBox_Password</tabstop>
<tabstop>checkBox_Comment</tabstop>
<tabstop>checkBox_URL</tabstop>
<tabstop>checkBox_Attachment</tabstop>
<tabstop>Button_Search</tabstop>
<tabstop>Button_Close</tabstop>
</tabstops>
<images>
<image name="image0" >
<data format="XPM.GZ" length="4833" >789c8597596f23470e80dfe75718c3b7c182e9eabb11ec834fc9873cbeaf601fc86ec9966df994cfc5fef794483633934d10c836fcb9582cde55fee5dbd2d9de68e9db2f5f9ee7349fb64bed153d2d7deb5e66b38fdffef3efff7ef99aa64b8baf2c5b4abffeebcb57dc5c6a9720499290640b8613e110ff22eb941b07657e7256f90be742e4a7c6a9ed076791c7a1732efbd784d3f817615a71167db0e55c0a17ce95c88f8ced3c7e74d6f306cea29fd159f583b3e8a75367d18f5bce8df0b63389be67e3ccfcd97716fd78e22cfaf1d459edefedcbedbc63e75af4cf85b33edeb8616cfef1b5b39eb7e72cf6c28b7166fb53678df7b5b3fadf388b3d503a8b3d40c6b9eaa35767d9cf37c6a5e53f73d6f3769d55bedf5f2789ac6bfcf2de1fda33ce4cdfbb716eeb6fce1acf1de3c2f2bbe7acf573605cdafe2b67f5efd359f20bb97165febe38b3c453fd2bfa7cd0a67165fea97c9db416ff1de3b1e9d77a6d12567bf8c159ed9d1ab7969fc2b8d378e2ba304579c93769bd719457fd524f2184cae221f51bd250a8fd3c35ae4cfec1b8b6fa06e3c6eaffc859d651f215b2d0c7efdab8327b969d459e9e8d7bfd57c68df587c43be4c1e20b685c1b9f0b17c1e283cfce927f96f911ca40d63fcbce7afebd31eb3a91b3fa37376ead9e64dea5759606a94f546eb23499883d9bc69932bef4acf22cf594725c1f8bfca9b3c8d3aa711e82c82bb73de3817111a4fe2171d67e1a1b97ba8e87ce5a8f12bfb48b2cfae8ceb85206894f9666135bff2e5c45d6fae894a3393a3f5be13aaeb7729eca4ff2d6ce3f5b701ef2b1c95f0aa7715dfb4de657519675d0fc8d8c9ba0f527f12faab234fd8fc695f1ab716dfa3f84ebb2089dec5f779678d381711d74beae398b7f540b3751bfd6e39ab1c9033b6bbd07e326687dcb3c2da8ecf47cfa301e9bbe37e389c94b3c0a2edba0f5f361dc194b3c8b36eed77acf9c453fab7f6d95587e6e8d83c957c25dc9668fdc5fc538b2c6e3a6e754e7adcc836252b6a9d69bccffb2ad535d67e98fb2ab538befaab3e8439947e5b84e82f6ffa17165f1bd7096fcc1ccb8b67a981b375a0f20f92d2775b078493dd54c75aaef0de9dfba75167fea2eb2f683dc5771388d753fbe396b7fca7c6b52ea2c5e57ce621fcbfdd26464f1812767ed8f63e3ced665de34c464fe9e1bb3d5b3f45bc3dca67a7fc9fba7697b46a9bf66cc13cb8fcc8b66c2960f3832b6f3988dad1e2828b799c53371d6f9766b9c5b7f4afe286983f5c3aeb3be177ace6c1ecc9cb51f6a678def8a7169f351fca710f5a93d9db3d64febacf9981aa76a2f5e3b6b7d5d1af7f6df3aebfb67e4acf93f72d6f972675cd83c7d77d67cac3bebfdfce9acf7eb87b3c66b665cdabc5feed9f44bfd51caade59395dbc4fc3f33cecc9f9b9e35bf786fdccfffc459e7ffc059eb7fe2acefcfd459df13dbceda5f4367bddffed8affdf0665c243a6f769c351f6367f51f7ad6fcefcf9dd57e72567fd959e3dd3a6bbc3b677daf34ce6affadb3dadbdb57263a5f46ce7adf8e9dd5dededfbe5e2f9cb5de5b678df7bb71a5fa59f767dccf77cd57d6f7136c185b7e79d359f3159cf53df7e8acf19e19f7f57ee5acef9b0d67f5b733b6fa844b63f38f07ceea9fcc3fca5b9bef58199b3dbce5acefa53567bd6fee8c73d54f95b3fa3b34b6fcc3b3b3f6dba1b3f6afe6a788fb6bad9f1f3f08f19b90b18ddff0f3dafefc2fe4bb284948f1b7f1e2e73fca4ff012af708ad77883b77f2f8f33bc8b9aeff1011ff1099f718e2ff88a6ff88e1ff8196da33fc92fe30aaee21aaee3060e70889bb885dbb88323dc8d7a407df941be8dd2dfa3ec5e94dac7033cc4233cc6133cc5333cc78bffb327c18029669863812556d1ef1a9ba8168080a1850ec608daaf30814bb882296ec035dc486426700b33b8837b78c0213cc2133ce367af3f7a93c01c5e700b5ee10d6fe11d093ee01396610556f104d6601d36a2d77abf0da2f41036610bb6b1841d18c12e7c873dd887033884233886133885b318297d3fc558e114cee1021208d1e01432c8a180122aa8e3c5190f2322c63bb507995aea62bc37698c9f34a14bba822d9ad235ddd02dcde80e87744f0f7fc823d1233de1363d634d737aa1577aa3ebf8047ba70ffaa4655aa1555aa375b37f0c298e6923ca0fb0a1212cd3266dd136edd08876e93bedd13e1dd0211d997e88f6031dd3099d624e67744e17f15f8b40296594cb273ef61632aa5ff34515d5d43032707c19449fd6e993db283b8217ee62fc0630fa31bf1cdf037c493bb1724ef98a162d30e56bcae185467cc3b731dfa0f935f919dff13daef1033ff2133fc77d039e73d41da55ff90d268b8afba17ea27d30a18edff9833f7999577895d7a88421aff31b6fc0e04ff5c6314acc031ef2266cc4c7ce036ff12ca66a10ff75d95eacfd2ccf3b0bfd38e651ac93f7d83b77f84e47d1e6f1222e0bf9c5ef3ff7a3f690766f4ffd0490aa85affffbf5cbef985d44a8</data>
</image>
</images>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>Q3GroupBox</class>
<extends></extends>
<header>Qt3Support/Q3GroupBox</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>Edit_Search</tabstop>
<tabstop>checkBox_Cs</tabstop>
<tabstop>checkBox_regExp</tabstop>
<tabstop>checkBox_Title</tabstop>
<tabstop>checkBox_Username</tabstop>
<tabstop>checkBox_Password</tabstop>
<tabstop>checkBox_Comment</tabstop>
<tabstop>checkBox_URL</tabstop>
<tabstop>checkBox_Attachment</tabstop>
<tabstop>Button_Search</tabstop>
<tabstop>Button_Close</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -56,6 +56,8 @@ QIcon *Icon_EditAdd;
QIcon *Icon_EditEdit;
QIcon *Icon_EditUsernameToCb;
QIcon *Icon_EditPasswordToCb;
QIcon *Icon_EditClone;
QIcon *Icon_EditOpenUrl;
QString DateTimeFormat("no-format-string");
@ -263,6 +265,12 @@ Icon_EditUsernameToCb=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/klipper_dock.png",tmpImg);
Icon_EditPasswordToCb=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/editcopy.png",tmpImg);
Icon_EditClone=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/run.png",tmpImg);
Icon_EditOpenUrl=new QIcon(tmpImg);
}

@ -56,6 +56,8 @@ extern QIcon *Icon_EditEdit;
extern QIcon *Icon_EditDelete;
extern QIcon *Icon_EditUsernameToCb;
extern QIcon *Icon_EditPasswordToCb;
extern QIcon *Icon_EditClone;
extern QIcon *Icon_EditOpenUrl;
extern QString DateTimeFormat;

@ -91,6 +91,8 @@ void KeepassMainWindow::setupConnections(){
connect(EditPasswordToClipboardAction, SIGNAL(triggered()), this, SLOT(OnEditPasswordToClipboard()));
connect(EditOpenUrlAction, SIGNAL(triggered()), this, SLOT(OnEditOpenUrl()));
connect(EditSaveAttachmentAction, SIGNAL(triggered()), this, SLOT(OnEditSaveAttachment()));
connect(EditSearchAction, SIGNAL(triggered()), this, SLOT(OnEditSearch()));
connect(EditGroupSearchAction, SIGNAL(triggered()), this, SLOT(OnEditGroupSearch()));
connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimeOut()));
connect(GroupView,SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this,
@ -126,6 +128,12 @@ EditEditEntryAction->setIcon(*Icon_EditEdit);
EditDeleteEntryAction->setIcon(*Icon_EditDelete);
EditPasswordToClipboardAction->setIcon(*Icon_EditPasswordToCb);
EditUsernameToClipboardAction->setIcon(*Icon_EditUsernameToCb);
EditCloneEntryAction->setIcon(*Icon_EditClone);
EditOpenUrlAction->setIcon(*Icon_EditOpenUrl);
EditSaveAttachmentAction->setIcon(*Icon_FileSave);
EditNewGroupAction->setIcon(*Icon_EditAdd);
EditEditGroupAction->setIcon(*Icon_EditEdit);
EditDeleteGroupAction->setIcon(*Icon_EditDelete);
}
@ -497,6 +505,24 @@ void KeepassMainWindow::OnEditOpenUrl(){
openBrowser(currentEntry()->URL);
}
void KeepassMainWindow::search(CGroup* group){
CSearchDlg dlg(group,this,"SearchDialog",false);
if(dlg.exec()){
}
else
{
}
}
void KeepassMainWindow::OnEditSearch(){
search(NULL);
}
void KeepassMainWindow::OnEditGroupSearch(){
search(currentGroup());
}
CGroup* KeepassMainWindow::currentGroup(){
Q_ASSERT(GroupView->selectedItems().size());

@ -73,6 +73,8 @@ private slots:
void OnEditPasswordToClipboard();
void OnEditSaveAttachment();
void OnEditOpenUrl();
void OnEditSearch();
void OnEditGroupSearch();
void OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*);
void OnEntryItemDoubleClicked(QTreeWidgetItem* item,int column);
void OnEntrySelectionChanged();
@ -95,6 +97,7 @@ private:
void setStateEntrySelected(SelectionState s);
void openDatabase(QString filename);
bool closeDatabase();
void search(CGroup* pGroup);
void editEntry(CEntry* pEntry);
inline CGroup* currentGroup();
inline CEntry* currentEntry();