implemented Database as interface (pure virtual)
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@64 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
|
||||
CEditEntryDlg::CEditEntryDlg(PwDatabase* _db, CEntry* _entry,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||
CEditEntryDlg::CEditEntryDlg(Database* _db, CEntry* _entry,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||
: QDialog(parent,name, modal,fl)
|
||||
{
|
||||
Q_ASSERT(_db);
|
||||
@@ -143,11 +143,11 @@ Combo_IconPicker->setCurrentItem(entry->ImageID);
|
||||
void CEditEntryDlg::InitGroupComboBox(){
|
||||
QString tmp;
|
||||
int i;
|
||||
for(i=0;i!=db->Groups.size();i++){
|
||||
for(i=0;i!=db->numGroups();i++){
|
||||
tmp="";
|
||||
for(int j=0;j<db->Groups[i].Level;j++)tmp+=" ";
|
||||
Combo_Group->insertItem(EntryIcons[db->Groups[i].ImageID],
|
||||
tmp+db->Groups[i].Name,i);
|
||||
for(int j=0;j<db->group(i).Level;j++)tmp+=" ";
|
||||
Combo_Group->insertItem(EntryIcons[db->group(i).ImageID],
|
||||
tmp+db->group(i).Name,i);
|
||||
}
|
||||
Combo_Group->setCurrentItem(db->getGroupIndex(entry->GroupID));
|
||||
}
|
||||
@@ -190,7 +190,7 @@ QString s=Edit_Password->text();
|
||||
entry->Password.setString(s,true);
|
||||
entry->Additional=Edit_Comment->text();
|
||||
if(Combo_Group->currentItem()!=db->getGroupIndex(entry->GroupID)){
|
||||
db->moveEntry(entry,&db->Groups[Combo_Group->currentItem()]);
|
||||
db->moveEntry(entry,&db->group(Combo_Group->currentItem()));
|
||||
EntryMoved=true; ModFlag=true;
|
||||
}
|
||||
entry->ImageID=Combo_IconPicker->currentItem();
|
||||
|
||||
@@ -31,7 +31,7 @@ class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CEditEntryDlg(PwDatabase* _db, CEntry* _entry,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0);
|
||||
CEditEntryDlg(Database* _db, CEntry* _entry,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0);
|
||||
~CEditEntryDlg();
|
||||
virtual void showEvent(QShowEvent *);
|
||||
/*$PUBLIC_FUNCTIONS$*/
|
||||
@@ -48,7 +48,7 @@ protected slots:
|
||||
|
||||
public:
|
||||
CEntry* entry;
|
||||
PwDatabase* db;
|
||||
Database* db;
|
||||
QPixmap* banner_pixmap;
|
||||
bool ModFlag;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <qregexp.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
CSearchDlg::CSearchDlg(PwDatabase* _db,CGroup* pGroup,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||
CSearchDlg::CSearchDlg(Database* _db,CGroup* pGroup,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||
: QDialog(parent,name, modal,fl)
|
||||
{
|
||||
setupUi(this);
|
||||
@@ -80,30 +80,30 @@ if(txt==""){
|
||||
QMessageBox::information(this,tr("Notice"),tr("Please enter a search string."),tr("OK"));
|
||||
return;}
|
||||
|
||||
for(int i=0;i<db->Entries.size();i++){
|
||||
for(int i=0;i<db->numEntries();i++){
|
||||
if(group){
|
||||
if(checkBox_Recursive->isChecked()){
|
||||
QList<int> groups=db->getChildIds(group);
|
||||
groups << group->ID;
|
||||
bool IsInAnyGroup=false;
|
||||
for(int j=0; j<groups.size();j++){
|
||||
if(db->Entries[i].GroupID == groups[j]){IsInAnyGroup=true; break;}}
|
||||
if(db->entry(i).GroupID == groups[j]){IsInAnyGroup=true; break;}}
|
||||
if(!IsInAnyGroup)continue;
|
||||
}
|
||||
else
|
||||
if(db->Entries[i].GroupID != group->ID)continue;
|
||||
if(db->entry(i).GroupID != group->ID)continue;
|
||||
}
|
||||
|
||||
bool hit=false;
|
||||
if(checkBox_Title->isChecked()) hit=hit||search(db->Entries[i].Title);
|
||||
if(checkBox_Username->isChecked()) hit=hit||search(db->Entries[i].UserName);
|
||||
if(checkBox_URL->isChecked()) hit=hit||search(db->Entries[i].URL);
|
||||
if(checkBox_Comment->isChecked()) hit=hit||search(db->Entries[i].Additional);
|
||||
if(checkBox_Attachment->isChecked()) hit=hit||search(db->Entries[i].BinaryDesc);
|
||||
db->Entries[i].Password.unlock();
|
||||
if(checkBox_Password->isChecked()) hit=hit||search(db->Entries[i].Password.string());
|
||||
db->Entries[i].Password.lock();
|
||||
if(hit)Hits.push_back(db->Entries[i].sID);
|
||||
if(checkBox_Title->isChecked()) hit=hit||search(db->entry(i).Title);
|
||||
if(checkBox_Username->isChecked()) hit=hit||search(db->entry(i).UserName);
|
||||
if(checkBox_URL->isChecked()) hit=hit||search(db->entry(i).URL);
|
||||
if(checkBox_Comment->isChecked()) hit=hit||search(db->entry(i).Additional);
|
||||
if(checkBox_Attachment->isChecked()) hit=hit||search(db->entry(i).BinaryDesc);
|
||||
db->entry(i).Password.unlock();
|
||||
if(checkBox_Password->isChecked()) hit=hit||search(db->entry(i).Password.string());
|
||||
db->entry(i).Password.lock();
|
||||
if(hit)Hits.push_back(db->entry(i).sID);
|
||||
}
|
||||
|
||||
done(1);
|
||||
|
||||
@@ -27,7 +27,7 @@ class CSearchDlg : public QDialog, public Ui_Search_Dlg
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSearchDlg(PwDatabase* _db, CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0,
|
||||
CSearchDlg(Database* _db, CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0,
|
||||
bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||
~CSearchDlg();
|
||||
QList<Q_UINT32> Hits;
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
QString txt;
|
||||
CGroup* group;
|
||||
bool regexp;
|
||||
PwDatabase* db;
|
||||
Database* db;
|
||||
bool search(const QString& str);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user