diff --git a/share/keepass/icons/alarmclock.png b/share/keepass/icons/alarmclock.png new file mode 100644 index 0000000..c66d2b1 Binary files /dev/null and b/share/keepass/icons/alarmclock.png differ diff --git a/share/keepass/icons/appsettings.png b/share/keepass/icons/appsettings.png new file mode 100644 index 0000000..6f3b1f4 Binary files /dev/null and b/share/keepass/icons/appsettings.png differ diff --git a/share/keepass/icons/nuvola/32x32/apps/ktouch.png b/share/keepass/icons/autotype.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/apps/ktouch.png rename to share/keepass/icons/autotype.png diff --git a/share/keepass/icons/clock.png b/share/keepass/icons/clock.png new file mode 100644 index 0000000..1f36aca Binary files /dev/null and b/share/keepass/icons/clock.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/editcopy.png b/share/keepass/icons/cloneentry.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/editcopy.png rename to share/keepass/icons/cloneentry.png diff --git a/share/keepass/icons/copypwd.png b/share/keepass/icons/copypwd.png new file mode 100644 index 0000000..dc95992 Binary files /dev/null and b/share/keepass/icons/copypwd.png differ diff --git a/share/keepass/icons/copyusername.png b/share/keepass/icons/copyusername.png new file mode 100644 index 0000000..a0c95be Binary files /dev/null and b/share/keepass/icons/copyusername.png differ diff --git a/share/keepass/icons/dbsearch.png b/share/keepass/icons/dbsearch.png new file mode 100644 index 0000000..62e3227 Binary files /dev/null and b/share/keepass/icons/dbsearch.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/configure.png b/share/keepass/icons/dbsettings.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/configure.png rename to share/keepass/icons/dbsettings.png diff --git a/share/keepass/icons/delete.png b/share/keepass/icons/delete.png new file mode 100644 index 0000000..2d5e260 Binary files /dev/null and b/share/keepass/icons/delete.png differ diff --git a/share/keepass/icons/deleteentry.png b/share/keepass/icons/deleteentry.png new file mode 100644 index 0000000..ae6f86a Binary files /dev/null and b/share/keepass/icons/deleteentry.png differ diff --git a/share/keepass/icons/deletegroup.png b/share/keepass/icons/deletegroup.png new file mode 100644 index 0000000..80dad40 Binary files /dev/null and b/share/keepass/icons/deletegroup.png differ diff --git a/share/keepass/icons/dice.png b/share/keepass/icons/dice.png new file mode 100644 index 0000000..fe15a5f Binary files /dev/null and b/share/keepass/icons/dice.png differ diff --git a/share/keepass/icons/editentry.png b/share/keepass/icons/editentry.png new file mode 100644 index 0000000..cd7d348 Binary files /dev/null and b/share/keepass/icons/editentry.png differ diff --git a/share/keepass/icons/editgroup.png b/share/keepass/icons/editgroup.png new file mode 100644 index 0000000..e8db2b8 Binary files /dev/null and b/share/keepass/icons/editgroup.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/exit.png b/share/keepass/icons/exit.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/exit.png rename to share/keepass/icons/exit.png diff --git a/share/keepass/icons/expired.png b/share/keepass/icons/expired.png new file mode 100644 index 0000000..b3f3c5f Binary files /dev/null and b/share/keepass/icons/expired.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/fileclose.png b/share/keepass/icons/fileclose.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/fileclose.png rename to share/keepass/icons/fileclose.png diff --git a/share/keepass/icons/filedelete.png b/share/keepass/icons/filedelete.png new file mode 100644 index 0000000..f2a3c2a Binary files /dev/null and b/share/keepass/icons/filedelete.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/filenew.png b/share/keepass/icons/filenew.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/filenew.png rename to share/keepass/icons/filenew.png diff --git a/share/keepass/icons/nuvola/32x32/actions/fileopen.png b/share/keepass/icons/fileopen.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/fileopen.png rename to share/keepass/icons/fileopen.png diff --git a/share/keepass/icons/nuvola/32x32/actions/filesave.png b/share/keepass/icons/filesave.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/filesave.png rename to share/keepass/icons/filesave.png diff --git a/share/keepass/icons/nuvola/32x32/actions/filesaveas.png b/share/keepass/icons/filesaveas.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/filesaveas.png rename to share/keepass/icons/filesaveas.png diff --git a/share/keepass/icons/filesavedisabled.png b/share/keepass/icons/filesavedisabled.png new file mode 100644 index 0000000..f32f63f Binary files /dev/null and b/share/keepass/icons/filesavedisabled.png differ diff --git a/share/keepass/icons/generator.png b/share/keepass/icons/generator.png new file mode 100644 index 0000000..99e878c Binary files /dev/null and b/share/keepass/icons/generator.png differ diff --git a/share/keepass/icons/groupsearch.png b/share/keepass/icons/groupsearch.png new file mode 100644 index 0000000..950c670 Binary files /dev/null and b/share/keepass/icons/groupsearch.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/help.png b/share/keepass/icons/help.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/help.png rename to share/keepass/icons/help.png diff --git a/share/keepass/icons/key.png b/share/keepass/icons/key.png index a4b0841..b74e831 100755 Binary files a/share/keepass/icons/key.png and b/share/keepass/icons/key.png differ diff --git a/share/keepass/icons/manual.png b/share/keepass/icons/manual.png new file mode 100644 index 0000000..d09e04b Binary files /dev/null and b/share/keepass/icons/manual.png differ diff --git a/share/keepass/icons/newentry.png b/share/keepass/icons/newentry.png new file mode 100644 index 0000000..0226c2f Binary files /dev/null and b/share/keepass/icons/newentry.png differ diff --git a/share/keepass/icons/newgroup.png b/share/keepass/icons/newgroup.png new file mode 100644 index 0000000..495440a Binary files /dev/null and b/share/keepass/icons/newgroup.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/edit.png b/share/keepass/icons/nuvola/32x32/actions/edit.png deleted file mode 100644 index f3ec32e..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/edit.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/edit_add.png b/share/keepass/icons/nuvola/32x32/actions/edit_add.png deleted file mode 100644 index 90fec1d..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/edit_add.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/editdelete.png b/share/keepass/icons/nuvola/32x32/actions/editdelete.png deleted file mode 100644 index ab71fae..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/editdelete.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/fileexport.png b/share/keepass/icons/nuvola/32x32/actions/fileexport.png deleted file mode 100644 index 9e27899..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/fileexport.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/find.png b/share/keepass/icons/nuvola/32x32/actions/find.png deleted file mode 100644 index f1ad60c..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/find.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/identity.png b/share/keepass/icons/nuvola/32x32/actions/identity.png deleted file mode 100644 index b38168a..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/identity.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/klipper_dock.png b/share/keepass/icons/nuvola/32x32/actions/klipper_dock.png deleted file mode 100644 index 4759626..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/klipper_dock.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/run.png b/share/keepass/icons/nuvola/32x32/actions/run.png deleted file mode 100644 index db5111a..0000000 Binary files a/share/keepass/icons/nuvola/32x32/actions/run.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/filesystems/desktop.png b/share/keepass/icons/nuvola/32x32/filesystems/desktop.png deleted file mode 100644 index 9b993a5..0000000 Binary files a/share/keepass/icons/nuvola/32x32/filesystems/desktop.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/filesystems/folder.png b/share/keepass/icons/nuvola/32x32/filesystems/folder.png deleted file mode 100644 index bd433f4..0000000 Binary files a/share/keepass/icons/nuvola/32x32/filesystems/folder.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/filesystems/folder_home.png b/share/keepass/icons/nuvola/32x32/filesystems/folder_home.png deleted file mode 100644 index 0094f83..0000000 Binary files a/share/keepass/icons/nuvola/32x32/filesystems/folder_home.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/filesystems/network_local.png b/share/keepass/icons/nuvola/32x32/filesystems/network_local.png deleted file mode 100644 index 68afcb4..0000000 Binary files a/share/keepass/icons/nuvola/32x32/filesystems/network_local.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/filesystems/trashcan_full.png b/share/keepass/icons/nuvola/32x32/filesystems/trashcan_full.png deleted file mode 100644 index f19899d..0000000 Binary files a/share/keepass/icons/nuvola/32x32/filesystems/trashcan_full.png and /dev/null differ diff --git a/share/keepass/icons/openurl.png b/share/keepass/icons/openurl.png new file mode 100644 index 0000000..47d4b36 Binary files /dev/null and b/share/keepass/icons/openurl.png differ diff --git a/share/keepass/icons/settings.png b/share/keepass/icons/settings.png deleted file mode 100755 index 7c4529f..0000000 Binary files a/share/keepass/icons/settings.png and /dev/null differ diff --git a/share/keepass/icons/nuvola/32x32/actions/reload.png b/share/keepass/icons/swap.png similarity index 100% rename from share/keepass/icons/nuvola/32x32/actions/reload.png rename to share/keepass/icons/swap.png diff --git a/share/keepass/icons/templates.png b/share/keepass/icons/templates.png new file mode 100644 index 0000000..3632895 Binary files /dev/null and b/share/keepass/icons/templates.png differ diff --git a/share/keepass/icons/text_block.png b/share/keepass/icons/text_block.png new file mode 100644 index 0000000..c4a9b8c Binary files /dev/null and b/share/keepass/icons/text_block.png differ diff --git a/share/keepass/icons/text_bold.png b/share/keepass/icons/text_bold.png new file mode 100644 index 0000000..7984923 Binary files /dev/null and b/share/keepass/icons/text_bold.png differ diff --git a/share/keepass/icons/text_center.png b/share/keepass/icons/text_center.png new file mode 100644 index 0000000..4ddfee4 Binary files /dev/null and b/share/keepass/icons/text_center.png differ diff --git a/share/keepass/icons/text_italic.png b/share/keepass/icons/text_italic.png new file mode 100644 index 0000000..1a9baad Binary files /dev/null and b/share/keepass/icons/text_italic.png differ diff --git a/share/keepass/icons/text_left.png b/share/keepass/icons/text_left.png new file mode 100644 index 0000000..54d22a3 Binary files /dev/null and b/share/keepass/icons/text_left.png differ diff --git a/share/keepass/icons/text_right.png b/share/keepass/icons/text_right.png new file mode 100644 index 0000000..20dba5b Binary files /dev/null and b/share/keepass/icons/text_right.png differ diff --git a/share/keepass/icons/text_under.png b/share/keepass/icons/text_under.png new file mode 100644 index 0000000..e9ac03b Binary files /dev/null and b/share/keepass/icons/text_under.png differ diff --git a/src/Database.h b/src/Database.h index f178126..51862e6 100644 --- a/src/Database.h +++ b/src/Database.h @@ -284,6 +284,9 @@ public: //! \param Group The group which contains the wanted entries. //! \return a list of pointers to the handles of all entries which belong to the given group. The list contains only valid handles and is sorted in an ascending order regarding to the entry indices. virtual QList entries(IGroupHandle* Group)=0; + + //! \return a list with the pointers to the handles of all expired entries of the database. The list contains only valid handles. The list is not sorted. + virtual QList expiredEntries()=0; //! \return a list with the pointers to the handles of all entries of the database. The list contains only valid handles and is not sorted. virtual QList groups()=0; diff --git a/src/StandardDatabase.cpp b/src/StandardDatabase.cpp index 2ff83eb..a370750 100644 --- a/src/StandardDatabase.cpp +++ b/src/StandardDatabase.cpp @@ -50,21 +50,21 @@ bool EntryHandleLessThan(const IEntryHandle* This,const IEntryHandle* Other){ } -bool StdEntryLessThan(const StandardDatabase::StdEntry& This,const StandardDatabase::StdEntry& Other){ +bool StdEntryLessThan(const Kdb3Database::StdEntry& This,const Kdb3Database::StdEntry& Other){ return This.Index=builtinIcons()+CustomIcons.size()) return EntryIcons[0]; if(i= CustomIcons.size()) return; @@ -92,17 +92,17 @@ void StandardDatabase::removeIcon(int id){ emit iconsModified(); } -void StandardDatabase::replaceIcon(int id,const QPixmap& icon){ +void Kdb3Database::replaceIcon(int id,const QPixmap& icon){ if(idBinaryDesc="bin-stream"; e->Title="Meta-Info"; e->Username="SYSTEM"; @@ -239,13 +239,13 @@ void StandardDatabase::createGroupTreeStateMetaStream(StdEntry* e){ e->Binary=bin; } -StandardDatabase::StdEntry* StandardDatabase::getEntry(const KpxUuid& uuid){ +Kdb3Database::StdEntry* Kdb3Database::getEntry(const KpxUuid& uuid){ for(int i=0; i& Levels,quint16 FieldType, quint32 FieldSize, quint8 *pData) +bool Kdb3Database::readGroupField(StdGroup* group,QList& Levels,quint16 FieldType, quint32 FieldSize, quint8 *pData) { switch(FieldType) { @@ -358,7 +358,7 @@ bool StandardDatabase::readGroupField(StdGroup* group,QList& Levels,qui return true; // Field supported } -bool StandardDatabase::createGroupTree(QList& Levels){ +bool Kdb3Database::createGroupTree(QList& Levels){ if(Levels[0]!=0) return false; //find the parent for every group for(int i=0;i& Levels){ return true; } -void StandardDatabase::createHandles(){ +void Kdb3Database::createHandles(){ for(int i=0;ivalue("GroupTreeState","ExpandAll")=="ExpandAll"){ for(int i=0;i> 6) & 0x0000003F); pBytes[1] = (quint8)((((quint32)d.date().year() & 0x0000003F) << 2) | (((quint32)d.date().month() >> 2) & 0x00000003)); pBytes[2] = (quint8)((((quint32)d.date().month() & 0x00000003) << 6) | (((quint32)d.date().day() & 0x0000001F) << 1) | (((quint32)d.time().hour() >> 4) & 0x00000001)); @@ -637,7 +637,7 @@ pBytes[4] = (quint8)((((quint32)d.time().minute() & 0x00000003) << 6) | ((quint3 } -bool StandardDatabase::transformKey(quint8* src,quint8* dst,quint8* KeySeed,int rounds){ +bool Kdb3Database::transformKey(quint8* src,quint8* dst,quint8* KeySeed,int rounds){ quint8 tmp[32]; AESencrypt aes; aes.key256(KeySeed); @@ -650,17 +650,17 @@ bool StandardDatabase::transformKey(quint8* src,quint8* dst,quint8* KeySeed,int } -int StandardDatabase::numGroups(){ +int Kdb3Database::numGroups(){ return Groups.size(); } -int StandardDatabase::numEntries(){ +int Kdb3Database::numEntries(){ return Entries.size(); } -void StandardDatabase::deleteGroup(StdGroup* group){ +void Kdb3Database::deleteGroup(StdGroup* group){ while(group->Childs.size()) deleteGroup(group->Childs.front()); @@ -686,11 +686,11 @@ void StandardDatabase::deleteGroup(StdGroup* group){ } -void StandardDatabase::deleteGroup(IGroupHandle* group){ +void Kdb3Database::deleteGroup(IGroupHandle* group){ deleteGroup(((GroupHandle*)group)->Group); } -void StandardDatabase::GroupHandle::setIndex(int index){ +void Kdb3Database::GroupHandle::setIndex(int index){ /* quint32 ParentId=((GroupHandle*)parent())->Id; int Pos=pDB->getGroupListIndex(this); @@ -728,7 +728,7 @@ void StandardDatabase::GroupHandle::setIndex(int index){ } -bool StandardDatabase::convHexToBinaryKey(char* HexKey, char* dst){ +bool Kdb3Database::convHexToBinaryKey(char* HexKey, char* dst){ QString hex=QString::fromAscii(HexKey,64); for(int i=0; i<64; i+=2){ bool err; @@ -740,17 +740,31 @@ bool StandardDatabase::convHexToBinaryKey(char* HexKey, char* dst){ return true; } - -void StandardDatabase::authByPwd(QString& Password){ +/* +void Kdb3Database::authByPwd(QString& Password){ if(!Password.size()) { memcpy(RawMasterKey,QByteArray(32,'\0').data(),32); return; } SHA256::hashBuffer(Password.toUtf8().data(),RawMasterKey,Password.toUtf8().size()); return; +}*/ + +void Kdb3Database::authByPwd(QString& Password){ + if(!Password.size()) { + memcpy(RawMasterKey,QByteArray(32,'\0').data(),32); + return; + } + SHA256::hashBuffer(Password.toLatin1().data(),RawMasterKey,Password.toLatin1().size()); + QByteArray lat,utf; + utf=Password.toUtf8(); + lat=Password.toLatin1(); + char *Lat=lat.data(); + char *Utf=utf.data(); + return; } -bool StandardDatabase::authByFile(QString& filename){ +bool Kdb3Database::authByFile(QString& filename){ QFile file(filename); if(!file.open(QIODevice::ReadOnly|QIODevice::Unbuffered)){ error=decodeFileError(file.error()); @@ -788,7 +802,7 @@ bool StandardDatabase::authByFile(QString& filename){ return true; } -bool StandardDatabase::authByFileAndPwd(QString& Password, QString& filename){ +bool Kdb3Database::authByFileAndPwd(QString& Password, QString& filename){ unsigned char PasswordKey[32]; unsigned char FileKey[32]; if(!authByFile(filename))return false; @@ -803,7 +817,7 @@ bool StandardDatabase::authByFileAndPwd(QString& Password, QString& filename){ return true; } -QList StandardDatabase::entries(){ +QList Kdb3Database::entries(){ QList handles; for(int i=0; i StandardDatabase::entries(){ return handles; } -QList StandardDatabase::entries(IGroupHandle* group){ +QList Kdb3Database::expiredEntries(){ + QList handles; + for(int i=0; i Kdb3Database::entries(IGroupHandle* group){ QList handles; for(int i=0; i StandardDatabase::entries(IGroupHandle* group){ return handles; } -void StandardDatabase::deleteEntry(IEntryHandle* entry){ +void Kdb3Database::deleteEntry(IEntryHandle* entry){ if(!entry)return; StdGroup* Group=((EntryHandle*)entry)->Entry->Group; int j; @@ -835,13 +860,13 @@ void StandardDatabase::deleteEntry(IEntryHandle* entry){ Entries.removeAt(j); } -void StandardDatabase::moveEntry(IEntryHandle* entry, IGroupHandle* group){ +void Kdb3Database::moveEntry(IEntryHandle* entry, IGroupHandle* group){ ((EntryHandle*)entry)->Entry->GroupId=((GroupHandle*)group)->Group->Id; ((EntryHandle*)entry)->Entry->Group=((GroupHandle*)group)->Group; } -void StandardDatabase::deleteEntries(QList entries){ +void Kdb3Database::deleteEntries(QList entries){ if(!entries.size())return; StdGroup* Group=((EntryHandle*)entries[0])->Entry->Group; for(int i=0;i entries){ } }; -QList StandardDatabase::groups(){ +QList Kdb3Database::groups(){ QList handles; for(int i=0; i StandardDatabase::groups(){ return handles; } -quint32 StandardDatabase::getNewGroupId(){ +quint32 Kdb3Database::getNewGroupId(){ quint32 id; bool used; while(1){ @@ -882,7 +907,7 @@ quint32 StandardDatabase::getNewGroupId(){ return id; } -IGroupHandle* StandardDatabase::addGroup(const CGroup* group,IGroupHandle* ParentHandle){ +IGroupHandle* Kdb3Database::addGroup(const CGroup* group,IGroupHandle* ParentHandle){ GroupHandles.append(GroupHandle(this)); Groups.append(*group); Groups.back().Id=getNewGroupId(); @@ -901,7 +926,7 @@ IGroupHandle* StandardDatabase::addGroup(const CGroup* group,IGroupHandle* Paren return &GroupHandles.back(); } -StandardDatabase::StdGroup::StdGroup(const CGroup& other){ +Kdb3Database::StdGroup::StdGroup(const CGroup& other){ OldImage=0; Index=0; Id=other.Id; @@ -909,64 +934,64 @@ StandardDatabase::StdGroup::StdGroup(const CGroup& other){ Title=other.Title; } -void StandardDatabase::EntryHandle::setTitle(const QString& Title){Entry->Title=Title; } -void StandardDatabase::EntryHandle::setUsername(const QString& Username){Entry->Username=Username;} -void StandardDatabase::EntryHandle::setUrl(const QString& Url){Entry->Url=Url;} -void StandardDatabase::EntryHandle::setPassword(const SecString& Password){Entry->Password=Password;} -void StandardDatabase::EntryHandle::setExpire(const KpxDateTime& s){Entry->Expire=s;} -void StandardDatabase::EntryHandle::setCreation(const KpxDateTime& s){Entry->Creation=s;} -void StandardDatabase::EntryHandle::setLastAccess(const KpxDateTime& s){Entry->LastAccess=s;} -void StandardDatabase::EntryHandle::setLastMod(const KpxDateTime& s){Entry->LastMod=s;} -void StandardDatabase::EntryHandle::setBinaryDesc(const QString& s){Entry->BinaryDesc=s;} -void StandardDatabase::EntryHandle::setComment(const QString& s){Entry->Comment=s;} -void StandardDatabase::EntryHandle::setBinary(const QByteArray& s){Entry->Binary=s;} -void StandardDatabase::EntryHandle::setImage(const quint32& s){Entry->Image=s;} -void StandardDatabase::EntryHandle::setOldImage(const quint32& s){Entry->OldImage=s;} -KpxUuid StandardDatabase::EntryHandle::uuid(){return Entry->Uuid;} -IGroupHandle* StandardDatabase::EntryHandle::group(){return Entry->Group->Handle;} -quint32 StandardDatabase::EntryHandle::image(){return Entry->Image;} -quint32 StandardDatabase::EntryHandle::oldImage(){return Entry->OldImage;} -QString StandardDatabase::EntryHandle::title(){return Entry->Title;} -QString StandardDatabase::EntryHandle::url(){return Entry->Url;} -QString StandardDatabase::EntryHandle::username(){return Entry->Username;} -SecString StandardDatabase::EntryHandle::password(){return Entry->Password;} -QString StandardDatabase::EntryHandle::comment(){return Entry->Comment;} -QString StandardDatabase::EntryHandle::binaryDesc(){return Entry->BinaryDesc;} -KpxDateTime StandardDatabase::EntryHandle::creation(){return Entry->Creation;} -KpxDateTime StandardDatabase::EntryHandle::lastMod(){return Entry->LastMod;} -KpxDateTime StandardDatabase::EntryHandle::lastAccess(){return Entry->LastAccess;} -KpxDateTime StandardDatabase::EntryHandle::expire(){return Entry->Expire;} -QByteArray StandardDatabase::EntryHandle::binary(){return Entry->Binary;} -quint32 StandardDatabase::EntryHandle::binarySize(){return Entry->Binary.size();} -int StandardDatabase::EntryHandle::visualIndex()const{return Entry->Index;} -void StandardDatabase::EntryHandle::setVisualIndexDirectly(int i){Entry->Index=i;} -bool StandardDatabase::EntryHandle::isValid()const{return valid;} +void Kdb3Database::EntryHandle::setTitle(const QString& Title){Entry->Title=Title; } +void Kdb3Database::EntryHandle::setUsername(const QString& Username){Entry->Username=Username;} +void Kdb3Database::EntryHandle::setUrl(const QString& Url){Entry->Url=Url;} +void Kdb3Database::EntryHandle::setPassword(const SecString& Password){Entry->Password=Password;} +void Kdb3Database::EntryHandle::setExpire(const KpxDateTime& s){Entry->Expire=s;} +void Kdb3Database::EntryHandle::setCreation(const KpxDateTime& s){Entry->Creation=s;} +void Kdb3Database::EntryHandle::setLastAccess(const KpxDateTime& s){Entry->LastAccess=s;} +void Kdb3Database::EntryHandle::setLastMod(const KpxDateTime& s){Entry->LastMod=s;} +void Kdb3Database::EntryHandle::setBinaryDesc(const QString& s){Entry->BinaryDesc=s;} +void Kdb3Database::EntryHandle::setComment(const QString& s){Entry->Comment=s;} +void Kdb3Database::EntryHandle::setBinary(const QByteArray& s){Entry->Binary=s;} +void Kdb3Database::EntryHandle::setImage(const quint32& s){Entry->Image=s;} +void Kdb3Database::EntryHandle::setOldImage(const quint32& s){Entry->OldImage=s;} +KpxUuid Kdb3Database::EntryHandle::uuid(){return Entry->Uuid;} +IGroupHandle* Kdb3Database::EntryHandle::group(){return Entry->Group->Handle;} +quint32 Kdb3Database::EntryHandle::image(){return Entry->Image;} +quint32 Kdb3Database::EntryHandle::oldImage(){return Entry->OldImage;} +QString Kdb3Database::EntryHandle::title(){return Entry->Title;} +QString Kdb3Database::EntryHandle::url(){return Entry->Url;} +QString Kdb3Database::EntryHandle::username(){return Entry->Username;} +SecString Kdb3Database::EntryHandle::password(){return Entry->Password;} +QString Kdb3Database::EntryHandle::comment(){return Entry->Comment;} +QString Kdb3Database::EntryHandle::binaryDesc(){return Entry->BinaryDesc;} +KpxDateTime Kdb3Database::EntryHandle::creation(){return Entry->Creation;} +KpxDateTime Kdb3Database::EntryHandle::lastMod(){return Entry->LastMod;} +KpxDateTime Kdb3Database::EntryHandle::lastAccess(){return Entry->LastAccess;} +KpxDateTime Kdb3Database::EntryHandle::expire(){return Entry->Expire;} +QByteArray Kdb3Database::EntryHandle::binary(){return Entry->Binary;} +quint32 Kdb3Database::EntryHandle::binarySize(){return Entry->Binary.size();} +int Kdb3Database::EntryHandle::visualIndex()const{return Entry->Index;} +void Kdb3Database::EntryHandle::setVisualIndexDirectly(int i){Entry->Index=i;} +bool Kdb3Database::EntryHandle::isValid()const{return valid;} -void StandardDatabase::EntryHandle::setVisualIndex(int index){ +void Kdb3Database::EntryHandle::setVisualIndex(int index){ QListEntries=pDB->entries(Entry->Group->Handle); Entries.move(visualIndex(),index); for(int i=0;i(Entries[i])->Entry->Index=index; + dynamic_cast(Entries[i])->Entry->Index=index; } } -StandardDatabase::EntryHandle::EntryHandle(StandardDatabase* db){ +Kdb3Database::EntryHandle::EntryHandle(Kdb3Database* db){ pDB=db; ListIndex=0; valid=true; } -bool StandardDatabase::GroupHandle::isValid(){return valid;} -void StandardDatabase::GroupHandle::setOldImage(const quint32& s){Group->OldImage=s;} -QString StandardDatabase::GroupHandle::title(){return Group->Title;} -quint32 StandardDatabase::GroupHandle::oldImage(){return Group->OldImage;} -quint32 StandardDatabase::GroupHandle::image(){return Group->Image;} -int StandardDatabase::GroupHandle::index(){return Group->Index;} -void StandardDatabase::GroupHandle::setTitle(const QString& Title){Group->Title=Title;} -void StandardDatabase::GroupHandle::setExpanded(bool IsExpanded){Group->IsExpanded=IsExpanded;} -bool StandardDatabase::GroupHandle::expanded(){return Group->IsExpanded;} -void StandardDatabase::GroupHandle::setImage(const quint32& New) +bool Kdb3Database::GroupHandle::isValid(){return valid;} +void Kdb3Database::GroupHandle::setOldImage(const quint32& s){Group->OldImage=s;} +QString Kdb3Database::GroupHandle::title(){return Group->Title;} +quint32 Kdb3Database::GroupHandle::oldImage(){return Group->OldImage;} +quint32 Kdb3Database::GroupHandle::image(){return Group->Image;} +int Kdb3Database::GroupHandle::index(){return Group->Index;} +void Kdb3Database::GroupHandle::setTitle(const QString& Title){Group->Title=Title;} +void Kdb3Database::GroupHandle::setExpanded(bool IsExpanded){Group->IsExpanded=IsExpanded;} +bool Kdb3Database::GroupHandle::expanded(){return Group->IsExpanded;} +void Kdb3Database::GroupHandle::setImage(const quint32& New) { if(Group->Image < pDB->builtinIcons() && New >= pDB->builtinIcons()) Group->OldImage=Group->Image; @@ -978,17 +1003,17 @@ void StandardDatabase::GroupHandle::setImage(const quint32& New) } -StandardDatabase::GroupHandle::GroupHandle(StandardDatabase* db){ +Kdb3Database::GroupHandle::GroupHandle(Kdb3Database* db){ pDB=db; valid=true; Group=NULL; } -IGroupHandle* StandardDatabase::GroupHandle::parent(){ +IGroupHandle* Kdb3Database::GroupHandle::parent(){ return (IGroupHandle*)Group->Parent->Handle; } -int StandardDatabase::GroupHandle::level(){ +int Kdb3Database::GroupHandle::level(){ int i=0; StdGroup* group=Group; while(group->Parent){ @@ -1000,7 +1025,7 @@ int StandardDatabase::GroupHandle::level(){ } -QList StandardDatabase::GroupHandle::childs(){ +QList Kdb3Database::GroupHandle::childs(){ QList childs; for(int i=0;iChilds.size();i++){ childs.append(Group->Childs[i]->Handle); @@ -1053,7 +1078,7 @@ else memcpy(dst,src,2); } -bool StandardDatabase::save(){ +bool Kdb3Database::save(){ if(!Groups.size()){ error=tr("The database must contain at least one group."); return false; @@ -1212,7 +1237,7 @@ bool StandardDatabase::save(){ return true; } -void StandardDatabase::createCustomIconsMetaStream(StdEntry* e){ +void Kdb3Database::createCustomIconsMetaStream(StdEntry* e){ /* Rev 3 */ e->BinaryDesc="bin-stream"; e->Title="Meta-Info"; @@ -1261,14 +1286,14 @@ void StandardDatabase::createCustomIconsMetaStream(StdEntry* e){ } } -QList StandardDatabase::sortedGroups(){ +QList Kdb3Database::sortedGroups(){ QList SortedGroups; appendChildsToGroupList(SortedGroups,RootGroup); return SortedGroups; } -void StandardDatabase::appendChildsToGroupList(QList& list,StdGroup& group){ +void Kdb3Database::appendChildsToGroupList(QList& list,StdGroup& group){ for(int i=0;iHandle; appendChildsToGroupList(list,*group.Childs[i]); @@ -1276,7 +1301,7 @@ void StandardDatabase::appendChildsToGroupList(QList& list,StdGro } -void StandardDatabase::appendChildsToGroupList(QList& list,StdGroup& group){ +void Kdb3Database::appendChildsToGroupList(QList& list,StdGroup& group){ for(int i=0;i& list,StdGroup& } -void StandardDatabase::serializeGroups(QList& GroupList,char* buffer,unsigned int& pos){ +void Kdb3Database::serializeGroups(QList& GroupList,char* buffer,unsigned int& pos){ quint16 FieldType; quint32 FieldSize; quint32 Flags=0; //unused @@ -1355,7 +1380,7 @@ void StandardDatabase::serializeGroups(QList& GroupList,char* buffer,u } -void StandardDatabase::serializeEntries(QList& EntryList,char* buffer,unsigned int& pos){ +void Kdb3Database::serializeEntries(QList& EntryList,char* buffer,unsigned int& pos){ quint16 FieldType; quint32 FieldSize; for(int i = 0; i < EntryList.size(); i++){ @@ -1447,11 +1472,11 @@ void StandardDatabase::serializeEntries(QList& EntryList,char* buffer, } } -bool StandardDatabase::close(){ +bool Kdb3Database::close(){ return true; } -void StandardDatabase::create(){ +void Kdb3Database::create(){ File=NULL; RootGroup.Title="$ROOT$"; RootGroup.Parent=NULL; @@ -1461,7 +1486,7 @@ void StandardDatabase::create(){ KeyError=false; } -bool StandardDatabase::isKeyError(){ +bool Kdb3Database::isKeyError(){ if(KeyError){ KeyError=false; return true; @@ -1470,7 +1495,7 @@ bool StandardDatabase::isKeyError(){ return false; } -IEntryHandle* StandardDatabase::cloneEntry(const IEntryHandle* entry){ +IEntryHandle* Kdb3Database::cloneEntry(const IEntryHandle* entry){ StdEntry dolly; dolly=*((EntryHandle*)entry)->Entry; dolly.Uuid.generate(); @@ -1481,7 +1506,7 @@ IEntryHandle* StandardDatabase::cloneEntry(const IEntryHandle* entry){ return &EntryHandles.back(); } -IEntryHandle* StandardDatabase::newEntry(IGroupHandle* group){ +IEntryHandle* Kdb3Database::newEntry(IGroupHandle* group){ StdEntry Entry; Entry.Uuid.generate(); Entry.Group=((GroupHandle*)group)->Group; @@ -1493,7 +1518,7 @@ IEntryHandle* StandardDatabase::newEntry(IGroupHandle* group){ return &EntryHandles.back(); } -IEntryHandle* StandardDatabase::addEntry(const CEntry* NewEntry, IGroupHandle* Group){ +IEntryHandle* Kdb3Database::addEntry(const CEntry* NewEntry, IGroupHandle* Group){ StdEntry Entry(*((StdEntry*)NewEntry)); Entry.Uuid.generate(); Entry.Group=((GroupHandle*)Group)->Group; @@ -1505,12 +1530,12 @@ IEntryHandle* StandardDatabase::addEntry(const CEntry* NewEntry, IGroupHandle* G return &EntryHandles.back(); } -void StandardDatabase::deleteLastEntry(){ +void Kdb3Database::deleteLastEntry(){ Entries.removeAt(Entries.size()-1); EntryHandles.back().invalidate(); } -bool StandardDatabase::isParent(IGroupHandle* parent, IGroupHandle* child){ +bool Kdb3Database::isParent(IGroupHandle* parent, IGroupHandle* child){ StdGroup* group=((GroupHandle*)child)->Group; while(group->Parent!=&RootGroup){ if(group->Parent==((GroupHandle*)parent)->Group)return true; @@ -1521,9 +1546,9 @@ bool StandardDatabase::isParent(IGroupHandle* parent, IGroupHandle* child){ -void StandardDatabase::cleanUpHandles(){} +void Kdb3Database::cleanUpHandles(){} -bool StandardDatabase::searchStringContains(const QString& search, const QString& string,bool Cs, bool RegExp){ +bool Kdb3Database::searchStringContains(const QString& search, const QString& string,bool Cs, bool RegExp){ if(RegExp){ QRegExp exp(search,Cs ? Qt::CaseSensitive : Qt::CaseInsensitive); if(string.contains(exp)==0)return false;} @@ -1533,14 +1558,14 @@ bool StandardDatabase::searchStringContains(const QString& search, const QString return true; } -void StandardDatabase::getEntriesRecursive(IGroupHandle* Group, QList& EntryList){ +void Kdb3Database::getEntriesRecursive(IGroupHandle* Group, QList& EntryList){ EntryList<Group->Childs.size(); i++){ getEntriesRecursive(((GroupHandle*)Group)->Group->Childs[i]->Handle,EntryList); } } -QList StandardDatabase::search(IGroupHandle* Group,const QString& search, bool CaseSensitive, bool RegExp, bool Recursive,bool* Fields){ +QList Kdb3Database::search(IGroupHandle* Group,const QString& search, bool CaseSensitive, bool RegExp, bool Recursive,bool* Fields){ bool fields[6]={true,true,true,false,true,true}; if(!Fields) Fields=fields; @@ -1574,13 +1599,13 @@ QList StandardDatabase::search(IGroupHandle* Group,const QString& return SearchEntries; } -void StandardDatabase::rebuildIndices(QList& list){ +void Kdb3Database::rebuildIndices(QList& list){ for(int i=0;iIndex=i; } } -bool StandardDatabase::createKeyFile(const QString& filename,int length, bool Hex){ +bool Kdb3Database::createKeyFile(const QString& filename,int length, bool Hex){ QFile file(filename); if(!file.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Unbuffered)){ error=decodeFileError(file.error()); @@ -1613,7 +1638,7 @@ bool StandardDatabase::createKeyFile(const QString& filename,int length, bool He } -void StandardDatabase::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,int Pos){ +void Kdb3Database::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,int Pos){ StdGroup* Parent; StdGroup* Group=((GroupHandle*)groupHandle)->Group; if(NewParent) @@ -1634,7 +1659,7 @@ void StandardDatabase::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewPare rebuildIndices(Parent->Childs); } -bool StandardDatabase::changeFile(const QString& filename){ +bool Kdb3Database::changeFile(const QString& filename){ if(File) delete File; if(filename==QString()){ diff --git a/src/StandardDatabase.h b/src/StandardDatabase.h index 63171c1..2c7e249 100644 --- a/src/StandardDatabase.h +++ b/src/StandardDatabase.h @@ -49,15 +49,15 @@ void memcpyToLEnd32(char* src,const quint32* dst); void memcpyToLEnd16(char* src,const quint16* dst); //! Implementation of the standard KeePassX database. -class StandardDatabase:public ICustomIcons,public IDatabase, public IFilePasswordAuth, public IKdbSettings{ +class Kdb3Database:public ICustomIcons,public IDatabase, public IFilePasswordAuth, public IKdbSettings{ Q_OBJECT public: class StdGroup; class StdEntry; class EntryHandle:public IEntryHandle{ - friend class StandardDatabase; + friend class Kdb3Database; public: - EntryHandle(StandardDatabase* db); + EntryHandle(Kdb3Database* db); virtual void setImage(const quint32& ImageID); void setOldImage(const quint32& OldImgID); virtual void setTitle(const QString& Title); @@ -96,12 +96,12 @@ public: bool valid; unsigned int ListIndex; KpxUuid Uuid; - StandardDatabase* pDB; + Kdb3Database* pDB; StdEntry* Entry; }; class GroupHandle:public IGroupHandle{ - friend class StandardDatabase; - GroupHandle(StandardDatabase* db); + friend class Kdb3Database; + GroupHandle(Kdb3Database* db); public: virtual void setTitle(const QString& Title); virtual void setImage(const quint32& ImageId); @@ -121,7 +121,7 @@ public: void invalidate(){valid=false;} bool valid; StdGroup* Group; - StandardDatabase* pDB; + Kdb3Database* pDB; }; friend class EntryHandle; friend class GroupHandle; @@ -143,7 +143,7 @@ public: QList Childs; QList Entries; }; - virtual ~StandardDatabase(){}; + virtual ~Kdb3Database(){}; virtual bool load(QString identifier); virtual bool save(); virtual bool close(); @@ -173,6 +173,8 @@ public: virtual QList entries(); virtual QList entries(IGroupHandle* Group); + virtual QList expiredEntries(); + virtual IEntryHandle* cloneEntry(const IEntryHandle* entry); virtual void deleteEntry(IEntryHandle* entry); virtual void deleteEntries(QList entries); diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index 65f00db..85f008b 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -38,7 +38,7 @@ (b)[(i) + 3] = (quint8) ( (n) ); \ } -void SHA256::hashBuffer(void* input, void* digest, quint32 length){ +void SHA256::hashBuffer(const void* input, void* digest, quint32 length){ sha256_context ctx; sha256_starts(&ctx); sha256_update(&ctx,(quint8*)input,length); diff --git a/src/crypto/sha256.h b/src/crypto/sha256.h index 9d5f6c8..583f96a 100755 --- a/src/crypto/sha256.h +++ b/src/crypto/sha256.h @@ -40,7 +40,7 @@ class SHA256{ SHA256(){sha256_starts(&ctx);} void update(void* input,quint32 length){sha256_update(&ctx,(quint8*)input,length);} void finish(void* digest){sha256_finish(&ctx,(quint8*)digest);} - static void hashBuffer(void* input, void* digest,quint32 length); + static void hashBuffer(const void* input, void* digest,quint32 length); private: sha256_context ctx; }; diff --git a/src/dialogs/AboutDlg.cpp b/src/dialogs/AboutDlg.cpp index 1b1441e..443064d 100755 --- a/src/dialogs/AboutDlg.cpp +++ b/src/dialogs/AboutDlg.cpp @@ -22,56 +22,58 @@ #include #include #include +#include #include "main.h" #include "AboutDlg.h" -CAboutDialog::CAboutDialog(QWidget* parent,bool modal, Qt::WFlags fl) -: QDialog(parent,fl) +AboutDialog::AboutDialog(QWidget* parent):QDialog(parent) { -setupUi(this); -createBanner(Banner,Icon_Key32x32,tr("KeePassX %1").arg(KEEPASS_VERSION)); -loadLicFromFile(); - -QString AboutTr=tr("Current Translation: None

","Please replace 'None' with the language of your translation"); -if(TrActive){ - AboutTr+=tr("Author: %1
").arg(tr("$TRANSLATION_AUTHOR")); - QString mail=tr("$TRANSLATION_AUTHOR_EMAIL","Here you can enter your email or homepage if you want."); - if(mail!=QString()){ - AboutTr+=mail+"
"; + setupUi(this); + createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("KeePassX %1").arg(KEEPASS_VERSION),width()); + loadLicFromFile(); + + QString AboutTr=tr("Current Translation: None

","Please replace 'None' with the language of your translation"); + if(TrActive){ + AboutTr+=tr("Author: %1
").arg(tr("$TRANSLATION_AUTHOR")); + QString mail=tr("$TRANSLATION_AUTHOR_EMAIL","Here you can enter your email or homepage if you want."); + if(mail!=QString()){ + AboutTr+=mail+"
"; + } + AboutTr+="
"; } - AboutTr+="
"; -} -Edit_Translation->setHtml(AboutTr+tr("\ -Information on how to translate KeePassX can be found under:\n\ -http://keepassx.sourceforge.net/")); -QString str; -str+=""+tr("Team")+"
"; -str+="
"; -str+=""+tr("Tarek Saidi")+"
"+tr("Developer, Project Admin")+"
"+tr("tariq@users.berlios.de")+"
"; -str+="
"; -str+=""+tr("Eugen Gorschenin")+"
"+tr("Web Designer")+"
"+tr("geugen@users.berlios.de")+"
"; -str+="

"; -str+=""+tr("Thanks To")+""; -str+="
"; -str+=""+tr("Matthias Miller")+"
"+tr("Patches for better MacOS X support")+"
"+tr("www.outofhanwell.com")+"
"; -str+="
"; -str+="
"; -str+=""+tr("James Nicholls")+"
"+tr("Main Application Icon")/*+"
"+tr("mailto:???")*/+"
"; -Edit_Thanks->setHtml(str); + Edit_Translation->setHtml(AboutTr+tr("\ + Information on how to translate KeePassX can be found under:\n\ + http://keepassx.sourceforge.net/")); + QString str; + str+=""+tr("Team")+"
"; + str+="
"; + str+=""+tr("Tarek Saidi")+"
"+tr("Developer, Project Admin")+"
"+tr("tariq@users.berlios.de")+"
"; + str+="
"; + str+=""+tr("Eugen Gorschenin")+"
"+tr("Web Designer")+"
"+tr("geugen@users.berlios.de")+"
"; + str+="

"; + str+=""+tr("Thanks To")+""; + str+="
"; + str+=""+tr("Matthias Miller")+"
"+tr("Patches for better MacOS X support")+"
"+tr("www.outofhanwell.com")+"
"; + str+="
"; + str+="
"; + str+=""+tr("James Nicholls")+"
"+tr("Main Application Icon")/*+"
"+tr("mailto:???")*/+"
"; + Edit_Thanks->setHtml(str); } -CAboutDialog::~CAboutDialog() -{ - +void AboutDialog::paintEvent(QPaintEvent *event){ + QDialog::paintEvent(event); + QPainter painter(this); + painter.setClipRegion(event->region()); + painter.drawPixmap(QPoint(0,0),BannerPixmap); } -void CAboutDialog::OnClose() +void AboutDialog::OnClose() { close(); } -void CAboutDialog::loadLicFromFile(){ +void AboutDialog::loadLicFromFile(){ QFile gpl(AppDir+"/../share/keepass/license.html"); if(!gpl.exists()){ @@ -95,11 +97,11 @@ Edit_License->setHtml(QString::fromUtf8(buffer,l)); delete buffer; } -void CAboutDialog::OnHomepageClicked(){ +void AboutDialog::OnHomepageClicked(){ openBrowser(tr("http://keepassx.sf.net")); } -void CAboutDialog::OnEMailClicked(){ +void AboutDialog::OnEMailClicked(){ openBrowser("mailto:keepassx@gmail.com"); } diff --git a/src/dialogs/AboutDlg.h b/src/dialogs/AboutDlg.h index eecf4ec..a0af8a4 100755 --- a/src/dialogs/AboutDlg.h +++ b/src/dialogs/AboutDlg.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005 by Tarek Saidi * - * tarek@linux * + * Copyright (C) 2005-2007 by Tarek Saidi * + * tarek.saidi@arcor.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -19,25 +19,30 @@ ***************************************************************************/ #ifndef _ABOUTDIALOG_H_ #define _ABOUTDIALOG_H_ + +#include +#include #include "ui_AboutDlg.h" #include "lib/UrlLabel.h" #include "main.h" -class CAboutDialog : public QDialog, public Ui_AboutDlg +class AboutDialog : public QDialog, public Ui_AboutDlg { Q_OBJECT public: - CAboutDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); - ~CAboutDialog(); + AboutDialog(QWidget* parent); + public slots: virtual void OnClose(); void OnHomepageClicked(); void OnEMailClicked(); private: + QPixmap BannerPixmap; inline void loadLicFromFile(); + virtual void paintEvent(QPaintEvent*); }; #endif diff --git a/src/dialogs/CalendarDlg.cpp b/src/dialogs/CalendarDlg.cpp new file mode 100644 index 0000000..dc33629 --- /dev/null +++ b/src/dialogs/CalendarDlg.cpp @@ -0,0 +1,29 @@ +/*************************************************************************** + * Copyright (C) 2007 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "main.h" +#include "CalendarDlg.h" + +CalendarDialog::CalendarDialog(QWidget* parent, const QDate& Start):QDialog(parent){ + setupUi(this); + calendarWidget->setSelectedDate(Start); + setWindowIcon(getIcon("clock")); + setWindowFlags(Qt::Sheet); +} diff --git a/src/dialogs/CalendarDlg.h b/src/dialogs/CalendarDlg.h new file mode 100644 index 0000000..2c46021 --- /dev/null +++ b/src/dialogs/CalendarDlg.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * Copyright (C) 2007 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef _CALENDAR_DLG_H_ +#define _CALENDAR_DLG_H_ + +#include +#include "ui_CalendarDlg.h" + +class CalendarDialog:public QDialog, public Ui_CalendarDialog{ + Q_OBJECT + public: + CalendarDialog(QWidget* parent, const QDate& Start=QDate::currentDate()); + + +}; + + +#endif diff --git a/src/dialogs/CollectEntropyDlg.cpp b/src/dialogs/CollectEntropyDlg.cpp index 01f030a..2373443 100644 --- a/src/dialogs/CollectEntropyDlg.cpp +++ b/src/dialogs/CollectEntropyDlg.cpp @@ -26,7 +26,7 @@ CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){ setupUi(this); - createBanner(&BannerPixmap,Icon_Key32x32,tr("Entropy Collection"),width()); + createBanner(&BannerPixmap,getPixmap("dice"),tr("Entropy Collection"),width()); KeyEntropyBuffer=new unsigned char[105]; MouseEntropyBuffer=new quint16[210]; KeyCounter=0; diff --git a/src/dialogs/CustomizeDetailViewDlg.cpp b/src/dialogs/CustomizeDetailViewDlg.cpp new file mode 100644 index 0000000..419eaf1 --- /dev/null +++ b/src/dialogs/CustomizeDetailViewDlg.cpp @@ -0,0 +1,217 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "main.h" +#include "CustomizeDetailViewDlg.h" + +bool DisableButtonSlots=false; + +CustomizeDetailViewDialog::CustomizeDetailViewDialog(QWidget* parent):QDialog(parent){ + setupUi(this); + BtnBold->setIcon(getIcon("text_bold")); + BtnItalic->setIcon(getIcon("text_italic")); + BtnUnderline->setIcon(getIcon("text_under")); + BtnAlignLeft->setIcon(getIcon("text_left")); + BtnAlignRight->setIcon(getIcon("text_right")); + BtnAlignCenter->setIcon(getIcon("text_center")); + BtnAlignBlock->setIcon(getIcon("text_block")); + BtnTemplates->setIcon(getIcon("templates")); + + QMenu* tmplmenu=new QMenu(); + tmplmenu->addAction(tr("Group"))->setData("%group%"); + tmplmenu->addAction(tr("Title"))->setData("%title%"); + tmplmenu->addAction(tr("Username"))->setData("%username%"); + tmplmenu->addAction(tr("Password"))->setData("%password%"); + tmplmenu->addAction(tr("Url"))->setData("%url%"); + tmplmenu->addAction(tr("Comment"))->setData("%comment%"); + tmplmenu->addAction(tr("Attachment Name"))->setData("%attachment%"); + tmplmenu->addAction(tr("Creation Date"))->setData("%creation%"); + tmplmenu->addAction(tr("Last Access Date"))->setData("%lastaccess%"); + tmplmenu->addAction(tr("Last Modification Date"))->setData("%lastmod%"); + tmplmenu->addAction(tr("Expiration Date"))->setData("%expire%"); + tmplmenu->addAction(tr("Time till Expiration"))->setData("%expire-timeleft%"); + BtnTemplates->setMenu(tmplmenu); + + connect(BtnBold,SIGNAL(toggled(bool)),this,SLOT(OnBtnBold(bool))); + connect(BtnItalic,SIGNAL(toggled(bool)),this,SLOT(OnBtnItalic(bool))); + connect(BtnUnderline,SIGNAL(toggled(bool)),this,SLOT(OnBtnUnderline(bool))); + connect(BtnAlignLeft,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignLeft(bool))); + connect(BtnAlignRight,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignRight(bool))); + connect(BtnAlignCenter,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignCenter(bool))); + connect(BtnAlignBlock,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignBlock(bool))); + connect(BtnColor,SIGNAL(clicked()),this,SLOT(OnBtnColor())); + connect(ButtonSave,SIGNAL(clicked()),this,SLOT(OnSave())); + connect(ButtonCancel,SIGNAL(clicked()),this,SLOT(OnCancel())); + connect(ButtonRestore,SIGNAL(clicked()),this,SLOT(OnRestoreDefault())); + connect(tmplmenu,SIGNAL(triggered(QAction*)),this,SLOT(OnInsertTemplate(QAction*))); + connect(RichEdit,SIGNAL(cursorPositionChanged()),this,SLOT(OnCursorPositionChanged())); + connect(TabWidget,SIGNAL(currentChanged(int)),this,SLOT(OnTabChanged(int))); + connect(FontSize,SIGNAL(activated(const QString&)),this,SLOT(OnFontSizeChanged(const QString&))); + connect(FontSize->lineEdit(),SIGNAL(returnPressed()),this,SLOT(OnFontSizeChanged())); + + RichEdit->setHtml(DetailViewTemplate); + + OnCursorPositionChanged(); +} + +void CustomizeDetailViewDialog::OnTabChanged(int index){ + + if(index==0){ + RichEdit->setHtml(HtmlEdit->toPlainText()); + } + if(index==1){ + HtmlEdit->setPlainText(RichEdit->toHtml()); + } +} + +void CustomizeDetailViewDialog::OnFontSizeChanged(const QString& text){ + bool ok=false; + int size=text.toInt(&ok); + if(ok && size > 0){ + RichEdit->setFontPointSize(size); + } +} + + +void CustomizeDetailViewDialog::OnCursorPositionChanged(){ + DisableButtonSlots=true; + if(RichEdit->fontWeight()==QFont::Bold)BtnBold->setChecked(true); + else BtnBold->setChecked(false); + BtnItalic->setChecked(RichEdit->fontItalic()); + BtnUnderline->setChecked(RichEdit->fontUnderline()); + switch(RichEdit->alignment()){ + case Qt::AlignLeft: + BtnAlignLeft->setChecked(true); + BtnAlignCenter->setChecked(false); + BtnAlignRight->setChecked(false); + BtnAlignBlock->setChecked(false); + break; + case Qt::AlignHCenter: + BtnAlignLeft->setChecked(false); + BtnAlignCenter->setChecked(true); + BtnAlignRight->setChecked(false); + BtnAlignBlock->setChecked(false); + break; + case Qt::AlignRight: + BtnAlignLeft->setChecked(false); + BtnAlignCenter->setChecked(false); + BtnAlignRight->setChecked(true); + BtnAlignBlock->setChecked(false); + break; + case Qt::AlignJustify: + BtnAlignLeft->setChecked(false); + BtnAlignCenter->setChecked(false); + BtnAlignRight->setChecked(false); + BtnAlignBlock->setChecked(true); + break; + } + CurrentColor=RichEdit->textColor(); + QPixmap pixmap=QPixmap(16,16); + pixmap.fill(CurrentColor); + BtnColor->setIcon(QIcon(pixmap)); + if(RichEdit->fontPointSize()>0) + FontSize->lineEdit()->setText(QString::number((int)RichEdit->fontPointSize())); + else + FontSize->lineEdit()->setText("9"); + + DisableButtonSlots=false; +} + +void CustomizeDetailViewDialog::OnBtnBold(bool toggled){ + if(DisableButtonSlots)return; + if(toggled) + RichEdit->setFontWeight(QFont::Bold); + else + RichEdit->setFontWeight(QFont::Normal); +} + +void CustomizeDetailViewDialog::OnBtnItalic(bool toggled){ + if(DisableButtonSlots)return; + RichEdit->setFontItalic(toggled); +} + +void CustomizeDetailViewDialog::OnBtnUnderline(bool toggled){ + if(DisableButtonSlots)return; + RichEdit->setFontUnderline(toggled); +} + + +void CustomizeDetailViewDialog::OnBtnAlignLeft(bool toggled){ + if(DisableButtonSlots)return; + RichEdit->setAlignment(Qt::AlignLeft); + OnCursorPositionChanged(); +} + +void CustomizeDetailViewDialog::OnBtnAlignRight(bool toggled){ + if(DisableButtonSlots)return; + RichEdit->setAlignment(Qt::AlignRight); + OnCursorPositionChanged(); +} + +void CustomizeDetailViewDialog::OnBtnAlignCenter(bool toggled){ + if(DisableButtonSlots)return; + RichEdit->setAlignment(Qt::AlignHCenter); + OnCursorPositionChanged(); +} + +void CustomizeDetailViewDialog::OnBtnAlignBlock(bool toggled){ + if(DisableButtonSlots)return; + RichEdit->setAlignment(Qt::AlignJustify); + OnCursorPositionChanged(); +} + +void CustomizeDetailViewDialog::OnBtnColor(){ + CurrentColor=QColorDialog::getColor(CurrentColor,this); + QPixmap pixmap=QPixmap(16,16); + pixmap.fill(CurrentColor); + BtnColor->setIcon(QIcon(pixmap)); + RichEdit->setTextColor(CurrentColor); +} + +void CustomizeDetailViewDialog::OnInsertTemplate(QAction* action){ + RichEdit->insertPlainText(action->data().toString()); +} + + +void CustomizeDetailViewDialog::OnSave(){ + if(TabWidget->currentIndex()==0) + DetailViewTemplate=RichEdit->toHtml(); + else if(TabWidget->currentIndex()==1) + DetailViewTemplate=HtmlEdit->toPlainText(); + + done(1); +} + +void CustomizeDetailViewDialog::OnCancel(){ + done(0); +} + +void CustomizeDetailViewDialog::OnRestoreDefault(){ + loadDefaultDetailViewTemplate(); + HtmlEdit->setPlainText(DetailViewTemplate); + RichEdit->setHtml(DetailViewTemplate); +} \ No newline at end of file diff --git a/src/dialogs/CustomizeDetailViewDlg.h b/src/dialogs/CustomizeDetailViewDlg.h new file mode 100644 index 0000000..83cf4dc --- /dev/null +++ b/src/dialogs/CustomizeDetailViewDlg.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2005-2006 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef _CUSTOMIZE_DETAIL_VIEW_H_ +#define _CUSTOMIZE_DETAIL_VIEW_H_ + +#include "ui_CustomizeDetailViewDlg.h"; +#include +#include + +class CustomizeDetailViewDialog : public QDialog, public Ui_CustomizeDetailViewDialog{ + Q_OBJECT + public: + CustomizeDetailViewDialog(QWidget* parent); + + private slots: + void OnBtnBold(bool); + void OnBtnItalic(bool); + void OnBtnUnderline(bool); + void OnBtnAlignLeft(bool); + void OnBtnAlignRight(bool); + void OnBtnAlignCenter(bool); + void OnBtnAlignBlock(bool); + void OnBtnColor(); + void OnSave(); + void OnCancel(); + void OnRestoreDefault(); + void OnInsertTemplate(QAction*); + void OnCursorPositionChanged(); + void OnTabChanged(int index); + void OnFontSizeChanged(const QString& text=QString()); + + private: + QColor CurrentColor; + + +}; + +#endif \ No newline at end of file diff --git a/src/dialogs/DatabaseSettingsDlg.cpp b/src/dialogs/DatabaseSettingsDlg.cpp index 26152a5..ac9faf9 100755 --- a/src/dialogs/DatabaseSettingsDlg.cpp +++ b/src/dialogs/DatabaseSettingsDlg.cpp @@ -32,7 +32,7 @@ CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,IDatabase* db, bool modal, Qt::W { setupUi(this); database=dynamic_cast(db); - createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width()); + createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width()); ComboAlgo->insertItem(0,tr("AES(Rijndael): 256 Bit (default)")); ComboAlgo->insertItem(1,tr("Twofish: 256 Bit")); ComboAlgo->setCurrentIndex(database->cryptAlgorithm()); //Achtung: AlgoID muss gleich dem ComboBox Index sein! @@ -77,4 +77,4 @@ void CDbSettingsDlg::OnOK() database->setKeyTransfRounds(rounds); database->setCryptAlgorithm((CryptAlgorithm)ComboAlgo->currentIndex()); done(1); -} \ No newline at end of file +} diff --git a/src/dialogs/EditEntryDlg.cpp b/src/dialogs/EditEntryDlg.cpp index 10022ec..74e7c7a 100755 --- a/src/dialogs/EditEntryDlg.cpp +++ b/src/dialogs/EditEntryDlg.cpp @@ -41,6 +41,7 @@ #include "SelectIconDlg.h" #include "PasswordGenDlg.h" #include "EditEntryDlg.h" +#include "CalendarDlg.h" @@ -52,10 +53,8 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren entry=_entry; db=_db; setupUi(this); - //not sure if this createBanner is still needed - createBanner(&BannerPixmap,Icon_Key32x32,tr("Edit Entry"),width()); - //end ModFlag=false; + QMenu *ExpirePresetsMenu=new QMenu(); connect(Edit_Password_w, SIGNAL(editingFinished()), this, SLOT(OnPasswordwLostFocus())); connect(Edit_Password_w, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordwTextChanged(const QString&))); connect(Edit_Password, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordTextChanged(const QString&))); @@ -68,10 +67,28 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren connect(buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),this,SLOT(OnButtonOK())); connect(CheckBox_ExpiresNever,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxExpiresNeverChanged(int))); connect(Button_CustomIcons,SIGNAL(clicked()),this,SLOT(OnCustomIcons())); + connect(ExpirePresetsMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnExpirePreset(QAction*))); + connect(ButtonExpirePresets,SIGNAL(triggered(QAction*)),this,SLOT(OnCalendar(QAction*))); - ButtonOpenAttachment->setIcon(*Icon_FileOpen); - ButtonDeleteAttachment->setIcon(*Icon_EditDelete); - ButtonSaveAttachment->setIcon(*Icon_FileSave); + // QAction::data() contains the time until expiration in days. + ExpirePresetsMenu->addAction(tr("Today"))->setData(0); + ExpirePresetsMenu->addSeparator(); + ExpirePresetsMenu->addAction(tr("1 Week"))->setData(7); + ExpirePresetsMenu->addAction(tr("2 Weeks"))->setData(14); + ExpirePresetsMenu->addAction(tr("3 Weeks"))->setData(21); + ExpirePresetsMenu->addSeparator(); + ExpirePresetsMenu->addAction(tr("1 Month"))->setData(30); + ExpirePresetsMenu->addAction(tr("3 Months"))->setData(60); + ExpirePresetsMenu->addAction(tr("6 Months"))->setData(180); + ExpirePresetsMenu->addSeparator(); + ExpirePresetsMenu->addAction(tr("1 Year"))->setData(365); + ButtonExpirePresets->setMenu(ExpirePresetsMenu); + ButtonExpirePresets->setDefaultAction(new QAction(tr("Calendar..."),ButtonExpirePresets)); + + ButtonOpenAttachment->setIcon(getIcon("fileopen")); + ButtonDeleteAttachment->setIcon(getIcon("filedelete")); + ButtonSaveAttachment->setIcon(getIcon("filesave")); + ButtonExpirePresets->setIcon(getIcon("clock")); setWindowTitle(entry->title()); @@ -136,9 +153,8 @@ if(event->spontaneous()==false){ } } -//Added resize event void CEditEntryDlg::resizeEvent(QResizeEvent *event){ - createBanner(&BannerPixmap,Icon_Key32x32,tr("Test 2"),width()); + createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("Test 2"),width()); QDialog::resizeEvent(event); } @@ -382,23 +398,35 @@ void CEditEntryDlg::OnButtonGenPw() void CEditEntryDlg::OnCheckBoxExpiresNeverChanged(int state){ -if(state==Qt::Unchecked){ - DateTime_Expire->setDisabled(false); -} -else -{ - DateTime_Expire->setDisabled(true); -} + if(state==Qt::Unchecked) + DateTime_Expire->setDisabled(false); + else + DateTime_Expire->setDisabled(true); } void CEditEntryDlg::OnCustomIcons(){ -CSelectIconDlg dlg(db,Combo_IconPicker->currentIndex(),this); -int r=dlg.exec(); -if(r!=-1){ - Combo_IconPicker->clear(); - for(int i=0;inumIcons();i++) - Combo_IconPicker->insertItem(i,db->icon(i),""); - Combo_IconPicker->setCurrentIndex(r); -} + CSelectIconDlg dlg(db,Combo_IconPicker->currentIndex(),this); + int r=dlg.exec(); + if(r!=-1){ + Combo_IconPicker->clear(); + for(int i=0;inumIcons();i++) + Combo_IconPicker->insertItem(i,db->icon(i),""); + Combo_IconPicker->setCurrentIndex(r); + } +} + +void CEditEntryDlg::OnExpirePreset(QAction* action){ + CheckBox_ExpiresNever->setChecked(false); + DateTime_Expire->setDate(QDate::fromJulianDay(QDate::currentDate().toJulianDay()+action->data().toInt())); + DateTime_Expire->setTime(QTime(0,0,0)); +} + +void CEditEntryDlg::OnCalendar(QAction* action){ + CalendarDialog dlg(this); + if(dlg.exec()==QDialog::Accepted){ + CheckBox_ExpiresNever->setChecked(false); + DateTime_Expire->setDate(dlg.calendarWidget->selectedDate()); + DateTime_Expire->setTime(QTime(0,0,0)); + } } diff --git a/src/dialogs/EditEntryDlg.h b/src/dialogs/EditEntryDlg.h index 19f60f7..214659f 100755 --- a/src/dialogs/EditEntryDlg.h +++ b/src/dialogs/EditEntryDlg.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005 by Tarek Saidi * - * tarek@linux * + * Copyright (C) 2005-2007 by Tarek Saidi * + * tarek.saidi@arcor.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -56,14 +56,13 @@ class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog void OnCheckBoxExpiresNeverChanged(int state); void OnCustomIcons(); void OnButtonOK(); + void OnExpirePreset(QAction*); + void OnCalendar(QAction*); private: virtual void showEvent(QShowEvent *); virtual void paintEvent(QPaintEvent*); - // Added resizeEvent - virtual void resizeEvent(QResizeEvent *); - - + virtual void resizeEvent(QResizeEvent *); }; diff --git a/src/dialogs/ExpiredEntriesDlg.cpp b/src/dialogs/ExpiredEntriesDlg.cpp new file mode 100644 index 0000000..b9c97a8 --- /dev/null +++ b/src/dialogs/ExpiredEntriesDlg.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2007 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include "main.h" +#include "ExpiredEntriesDlg.h" + +ExpiredEntriesDialog::ExpiredEntriesDialog(QWidget* parent,IDatabase* database,const QList& ExpiredEntries):QDialog(parent){ + setupUi(this); + Entries=ExpiredEntries; + for(int i=0;isetData(0,Qt::UserRole,i); + item->setText(0,Entries[i]->group()->title()); + item->setText(1,Entries[i]->title()); + item->setText(2,Entries[i]->username()); + item->setText(3,Entries[i]->expire().dateToString(Qt::LocalDate)); + item->setIcon(0,database->icon(Entries[i]->group()->image())); + item->setIcon(1,database->icon(Entries[i]->image())); + + } + connect(treeWidget,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(OnItemDoubleClicked(QTreeWidgetItem*,int))); +} + + +void ExpiredEntriesDialog::paintEvent(QPaintEvent* event){ + QDialog::paintEvent(event); + QPainter painter(this); + painter.setClipRegion(event->region()); + painter.drawPixmap(QPoint(0,0),BannerPixmap); +} + +void ExpiredEntriesDialog::resizeEvent(QResizeEvent* event){ + createBanner(&BannerPixmap,getPixmap("alarmclock"),tr("Expried Entries of the Database"),width()); + QDialog::resizeEvent(event); +} + +void ExpiredEntriesDialog::OnItemDoubleClicked(QTreeWidgetItem* item, int column){ + SelectedEntry=Entries[item->data(0,Qt::UserRole).toInt()]; + accept(); +} + +///TODO 0.2.3 locale aware string/date compare for correct sorting diff --git a/src/dialogs/ExpiredEntriesDlg.h b/src/dialogs/ExpiredEntriesDlg.h new file mode 100644 index 0000000..b60c90b --- /dev/null +++ b/src/dialogs/ExpiredEntriesDlg.h @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2007 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _EXP_ENTRIES_DLG_ +#define _EXP_ENTRIES_DLG_ + +#include +#include +#include "ui_ExpiredEntriesDlg.h" +#include "Database.h" + +class ExpiredEntriesDialog:public QDialog, public Ui_ExpiredEntriesDialog{ + Q_OBJECT + public: + ExpiredEntriesDialog(QWidget* parent,IDatabase* database,const QList& Entries); + IEntryHandle* SelectedEntry; + private: + QList Entries; + QPixmap BannerPixmap; + virtual void paintEvent(QPaintEvent*); + virtual void resizeEvent(QResizeEvent *); + + private slots: + void OnItemDoubleClicked(QTreeWidgetItem*,int); + + +}; + + +#endif diff --git a/src/dialogs/PasswordDlg.cpp b/src/dialogs/PasswordDlg.cpp index 5b0dbbf..40e4fab 100755 --- a/src/dialogs/PasswordDlg.cpp +++ b/src/dialogs/PasswordDlg.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2005-2006 by Tarek Saidi * - * tarek@linux * + * tarek.saidi@arcor.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -38,7 +38,7 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt : QDialog(parent) { setupUi(this); - createBanner(Banner,Icon_Key32x32,tr("Database Key")); + createBanner(Banner,getPixmap("key"),tr("Database Key")); db=DB; QDir media(config.MountDir); if(media.exists()){ diff --git a/src/dialogs/PasswordGenDlg.cpp b/src/dialogs/PasswordGenDlg.cpp index 8ea605a..403fe5a 100755 --- a/src/dialogs/PasswordGenDlg.cpp +++ b/src/dialogs/PasswordGenDlg.cpp @@ -37,7 +37,7 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl) : QDialog(parent,fl) { setupUi(this); - createBanner(&BannerPixmap,Icon_Key32x32,tr("Password Generator"),width()); + createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width()); connect(ButtonGenerate,SIGNAL(clicked()),this,SLOT(OnGeneratePw())); connect(Radio_1,SIGNAL(toggled(bool)),this,SLOT(OnRadio1StateChanged(bool))); diff --git a/src/dialogs/SearchDlg.cpp b/src/dialogs/SearchDlg.cpp index 32829f2..0bc7ae1 100755 --- a/src/dialogs/SearchDlg.cpp +++ b/src/dialogs/SearchDlg.cpp @@ -23,54 +23,55 @@ #include #include #include +#include #include "main.h" #include "PwmConfig.h" #include "SearchDlg.h" -CSearchDlg::CSearchDlg(IDatabase* database,IGroupHandle* Group,QWidget* parent, bool modal, Qt::WFlags fl) -: QDialog(parent,fl) +SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* parent):QDialog(parent) { -setupUi(this); -connect( Button_Search, SIGNAL( clicked() ), this, SLOT( OnSearch() ) ); -connect( Button_Close, SIGNAL( clicked() ), this, SLOT( OnClose() ) ); -db=database; -group=Group; -createBanner(Banner,Icon_Search32x32,tr("Search")); -checkBox_Cs->setChecked(config.SearchOptions[0]); -checkBox_regExp->setChecked(config.SearchOptions[1]); -checkBox_Title->setChecked(config.SearchOptions[2]); -checkBox_Username->setChecked(config.SearchOptions[3]); -checkBox_Password->setChecked(config.SearchOptions[4]); -checkBox_Comment->setChecked(config.SearchOptions[5]); -checkBox_URL->setChecked(config.SearchOptions[6]); -checkBox_Attachment->setChecked(config.SearchOptions[7]); -if(group) - checkBox_Recursive->setChecked(config.SearchOptions[8]); -else{ - checkBox_Recursive->setChecked(false); - checkBox_Recursive->setEnabled(false);} + setupUi(this); + connect( Button_Search, SIGNAL( clicked() ), this, SLOT( OnSearch() ) ); + connect( Button_Close, SIGNAL( clicked() ), this, SLOT( OnClose() ) ); + db=database; + group=Group; + createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width()); + checkBox_Cs->setChecked(config.SearchOptions[0]); + checkBox_regExp->setChecked(config.SearchOptions[1]); + checkBox_Title->setChecked(config.SearchOptions[2]); + checkBox_Username->setChecked(config.SearchOptions[3]); + checkBox_Password->setChecked(config.SearchOptions[4]); + checkBox_Comment->setChecked(config.SearchOptions[5]); + checkBox_URL->setChecked(config.SearchOptions[6]); + checkBox_Attachment->setChecked(config.SearchOptions[7]); + if(group) + checkBox_Recursive->setChecked(config.SearchOptions[8]); + else{ + checkBox_Recursive->setChecked(false); + checkBox_Recursive->setEnabled(false); + } } -CSearchDlg::~CSearchDlg() +SearchDialog::~SearchDialog() { -config.SearchOptions[0]=checkBox_Cs->isChecked(); -config.SearchOptions[1]=checkBox_regExp->isChecked(); -config.SearchOptions[2]=checkBox_Title->isChecked(); -config.SearchOptions[3]=checkBox_Username->isChecked(); -config.SearchOptions[4]=checkBox_Password->isChecked(); -config.SearchOptions[5]=checkBox_Comment->isChecked(); -config.SearchOptions[6]=checkBox_URL->isChecked(); -config.SearchOptions[7]=checkBox_Attachment->isChecked(); -if(group) config.SearchOptions[8]=checkBox_Recursive->isChecked(); + config.SearchOptions[0]=checkBox_Cs->isChecked(); + config.SearchOptions[1]=checkBox_regExp->isChecked(); + config.SearchOptions[2]=checkBox_Title->isChecked(); + config.SearchOptions[3]=checkBox_Username->isChecked(); + config.SearchOptions[4]=checkBox_Password->isChecked(); + config.SearchOptions[5]=checkBox_Comment->isChecked(); + config.SearchOptions[6]=checkBox_URL->isChecked(); + config.SearchOptions[7]=checkBox_Attachment->isChecked(); + if(group) config.SearchOptions[8]=checkBox_Recursive->isChecked(); } -void CSearchDlg::OnClose() +void SearchDialog::OnClose() { done(0); } -void CSearchDlg::OnSearch() +void SearchDialog::OnSearch() { bool Fields[6]; Fields[0]=checkBox_Title->isChecked(); @@ -83,6 +84,12 @@ void CSearchDlg::OnSearch() done(1); } +void SearchDialog::paintEvent(QPaintEvent *event){ + QDialog::paintEvent(event); + QPainter painter(this); + painter.setClipRegion(event->region()); + painter.drawPixmap(QPoint(0,0),BannerPixmap); +} diff --git a/src/dialogs/SearchDlg.h b/src/dialogs/SearchDlg.h index 073803d..58c099e 100755 --- a/src/dialogs/SearchDlg.h +++ b/src/dialogs/SearchDlg.h @@ -19,25 +19,30 @@ ***************************************************************************/ #ifndef SEARCHDLG_H #define SEARCHDLG_H + +#include +#include #include "ui_SearchDlg.h" #include "main.h" #include "Database.h" -class CSearchDlg : public QDialog, public Ui_Search_Dlg +class SearchDialog : public QDialog, public Ui_Search_Dlg { - Q_OBJECT -public: - CSearchDlg(IDatabase* database, IGroupHandle* group=NULL,QWidget* parent = 0, bool modal = true, Qt::WFlags fl = 0 ); - ~CSearchDlg(); - QList Result; - -public slots: - virtual void OnClose(); - virtual void OnSearch(); - -private: - IGroupHandle* group; - IDatabase* db; + Q_OBJECT + public: + SearchDialog(IDatabase* database, IGroupHandle* group,QWidget* parent); + ~SearchDialog(); + QList Result; + + public slots: + virtual void OnClose(); + virtual void OnSearch(); + + private: + QPixmap BannerPixmap; + IGroupHandle* group; + IDatabase* db; + virtual void paintEvent(QPaintEvent*); }; #endif diff --git a/src/dialogs/SelectIconDlg.cpp b/src/dialogs/SelectIconDlg.cpp index 4849004..8338168 100644 --- a/src/dialogs/SelectIconDlg.cpp +++ b/src/dialogs/SelectIconDlg.cpp @@ -34,8 +34,8 @@ CSelectIconDlg::CSelectIconDlg(IDatabase* database,int CurrentId,QWidget* parent db=database; Id=CurrentId; CtxMenu=new QMenu(this); - ReplaceAction=CtxMenu->addAction(*Icon_Swap,tr("Replace...")); - DeleteAction=CtxMenu->addAction(*Icon_EditDelete,tr("Delete")); + ReplaceAction=CtxMenu->addAction(getIcon("swap"),tr("Replace...")); + DeleteAction=CtxMenu->addAction(getIcon("delete"),tr("Delete")); connect(Button_AddIcon, SIGNAL(clicked()), this, SLOT(OnAddIcon())); connect(Button_PickIcon, SIGNAL(clicked()), this, SLOT(OnPickIcon())); connect(Button_Cancel, SIGNAL(clicked()), this, SLOT(OnCancel())); diff --git a/src/dialogs/SettingsDlg.cpp b/src/dialogs/SettingsDlg.cpp index d6a01f4..1f05704 100755 --- a/src/dialogs/SettingsDlg.cpp +++ b/src/dialogs/SettingsDlg.cpp @@ -29,6 +29,7 @@ #include #include #include "SettingsDlg.h" +#include "CustomizeDetailViewDlg.h" bool CSettingsDlg::PluginsModified=false; @@ -51,9 +52,10 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog) connect(Radio_IntPlugin_Kde,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginKde(bool))); connect(CheckBox_BrowserDefault,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxBrowserDefaultChanged(int))); + connect(Button_CustomizeEntryDetails,SIGNAL(clicked()),this,SLOT(OnCustomizeEntryDetails())); - createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width()); + createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width()); //General CheckBox_OpenLast->setChecked(settings->value("OpenLastFile",true).toBool()); @@ -161,12 +163,12 @@ void CSettingsDlg::OnCheckBoxBrowserDefaultChanged(int state){ void CSettingsDlg::OnOK() { apply(); - close(); + accept(); } void CSettingsDlg::OnCancel() { - close(); + reject(); } void CSettingsDlg::OnOtherButton(QAbstractButton* button){ @@ -227,7 +229,7 @@ void CSettingsDlg::OnTextColor() px->fill(c); pixmTextColor->clear(); pixmTextColor->setPixmap(*px); - createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width(),color1,color2,textcolor); + createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor); } } @@ -241,7 +243,7 @@ void CSettingsDlg::OnColor2() px->fill(c); pixmColor2->clear(); pixmColor2->setPixmap(*px); - createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width(),color1,color2,textcolor); + createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor); } } @@ -255,7 +257,7 @@ void CSettingsDlg::OnColor1() px->fill(c); pixmColor1->clear(); pixmColor1->setPixmap(*px); - createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width(),color1,color2,textcolor); + createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor); } } @@ -286,3 +288,9 @@ void CSettingsDlg::OnIntPluginGnome(bool toggled){ void CSettingsDlg::OnIntPluginKde(bool toggled){ Label_IntPlugin_Info->show(); } + + +void CSettingsDlg::OnCustomizeEntryDetails(){ + CustomizeDetailViewDialog dlg(this); + dlg.exec(); +} diff --git a/src/dialogs/SettingsDlg.h b/src/dialogs/SettingsDlg.h index 4c1f16d..dce674b 100755 --- a/src/dialogs/SettingsDlg.h +++ b/src/dialogs/SettingsDlg.h @@ -48,6 +48,7 @@ class CSettingsDlg : public QDialog, public Ui_SettingsDialog void OnCheckBoxOpenLastChanged(int state); void OnCheckBoxBrowserDefaultChanged(int state); void OnMountDirBrowse(); + void OnCustomizeEntryDetails(); private: virtual void paintEvent(QPaintEvent*); diff --git a/src/forms/AboutDlg.ui b/src/forms/AboutDlg.ui index 8e54db6..2ce6d81 100644 --- a/src/forms/AboutDlg.ui +++ b/src/forms/AboutDlg.ui @@ -1,7 +1,4 @@ - - - AboutDlg @@ -23,170 +20,198 @@ 419 - 211 + 268 - 211 + 419 268 About - - - - 0 - 0 - 420 - 50 - + + + 9 - - + + 6 - - true - - - - - - 10 - 60 - 401 - 201 - - - - - About - - - - - 20 - 20 - 351 - 17 - + + + + Qt::Vertical - - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">KeePassX</span> - Cross Platform Password Manager</p></body></html> + + QSizePolicy::Fixed - - - - - 30 - 110 - 341 - 51 - + + + 20 + 50 + - - Copyright (C) 2005 - 2006 Tarek Saidi + + + + + + 0 + + + + About + + + + 9 + + + 6 + + + + + <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">KeePassX</span> - Cross Platform Password Manager</p></body></html> + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + 0 + + + 12 + + + + + http://keepassx.sourceforge.net + + + + + + + + + + keepassx@gmail.com + + + + + + + Copyright (C) 2005 - 2006 Tarek Saidi KeePassX is distributed under the terms of the -General Public License (GPL) version 2. - +General Public License (GPL) version 2 or later. + + + + + + + + + + + + Credits + + + + 9 + + + 6 + + + + + true + + + + + + + + Translation + + + + 9 + + + 6 + + + + + true + + + + + + + + License + + + + 9 + + + 6 + + + + + true + + + + + - - - - 30 - 50 - 351 - 17 - - - - http://keepassx.sourceforge.net - - - - - - - - - 30 - 80 - 351 - 17 - - - - keepassx@gmail.com - - - - - - Credits - - - - - 3 - 3 - 390 - 166 - - - - true - - - - - - Translation - - - - - 3 - 3 - 390 - 167 - - - - true - - - - - - License - - - - - 3 - 3 - 391 - 167 - - - - true - - - - + + - LinkLabel QLabel
../../src/lib/UrlLabel.h
- 0 -
diff --git a/src/forms/CalendarDlg.ui b/src/forms/CalendarDlg.ui new file mode 100644 index 0000000..b47ffe8 --- /dev/null +++ b/src/forms/CalendarDlg.ui @@ -0,0 +1,72 @@ + + CalendarDialog + + + + 0 + 0 + 334 + 238 + + + + Calendar + + + + 9 + + + 6 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + CalendarDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + CalendarDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/forms/CustomizeDetailViewDlg.ui b/src/forms/CustomizeDetailViewDlg.ui new file mode 100644 index 0000000..d10362d --- /dev/null +++ b/src/forms/CustomizeDetailViewDlg.ui @@ -0,0 +1,368 @@ + + CustomizeDetailViewDialog + + + + 0 + 0 + 531 + 402 + + + + Dialog + + + + 9 + + + 6 + + + + + 0 + + + + Rich Text Editor + + + + 9 + + + 6 + + + + + 0 + + + 6 + + + + + Bold + + + B + + + + 16 + 16 + + + + true + + + + + + + Italic + + + I + + + true + + + + + + + Underlined + + + U + + + true + + + + + + + Left-Aligned + + + L + + + true + + + + + + + Centered + + + C + + + true + + + + + + + Right-Aligned + + + R + + + true + + + + + + + Justified + + + B + + + true + + + + + + + Text Color + + + C + + + + + + + Font Size + + + true + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 14 + + + + + 16 + + + + + 18 + + + + + 20 + + + + + 22 + + + + + 24 + + + + + 26 + + + + + 28 + + + + + 36 + + + + + 42 + + + + + 78 + + + + + + + + Templates + + + T + + + QToolButton::InstantPopup + + + Qt::NoArrow + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + HTML + + + + 9 + + + 6 + + + + + false + + + + + + + + + + + 0 + + + 6 + + + + + Restore Default + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save + + + false + + + + + + + Cancel + + + false + + + + + + + + + + diff --git a/src/forms/EditEntryDlg.ui b/src/forms/EditEntryDlg.ui index 5a93995..de0c272 100644 --- a/src/forms/EditEntryDlg.ui +++ b/src/forms/EditEntryDlg.ui @@ -361,6 +361,16 @@ + + + + ... + + + QToolButton::MenuButtonPopup + + + diff --git a/src/forms/ExpiredEntriesDlg.ui b/src/forms/ExpiredEntriesDlg.ui new file mode 100644 index 0000000..e9bb679 --- /dev/null +++ b/src/forms/ExpiredEntriesDlg.ui @@ -0,0 +1,131 @@ + + ExpiredEntriesDialog + + + + 0 + 0 + 588 + 408 + + + + Expired Entries + + + + 9 + + + 6 + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 50 + + + + + + + + Double click on an entry to jump to it. + + + + + + + false + + + true + + + false + + + true + + + true + + + + Group + + + + + Title + + + + + Username + + + + + Expired + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + ExpiredEntriesDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ExpiredEntriesDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/forms/MainWindow.ui b/src/forms/MainWindow.ui index 8402d6a..007a6c2 100644 --- a/src/forms/MainWindow.ui +++ b/src/forms/MainWindow.ui @@ -25,19 +25,65 @@ 6 - - - - 7 - 7 - 0 - 60 - - + - Qt::Horizontal + Qt::Vertical - + + + + 7 + 7 + 0 + 60 + + + + Qt::Horizontal + + + + false + + + + 7 + 7 + 30 + 0 + + + + true + + + true + + + false + + + + + false + + + + 7 + 7 + 70 + 0 + + + + QAbstractItemView::ExtendedSelection + + + false + + + + false @@ -45,63 +91,20 @@ 7 7 - 30 - 0 + 0 + 10 - + + + 0 + 30 + + + true - - true - - - false - - - - false - - - - 7 - 7 - 70 - 0 - - - - QAbstractItemView::ExtendedSelection - - - false - - - - - - - - false - - - - 7 - 4 - 0 - 10 - - - - - 16777215 - 60 - - - - true - @@ -123,13 +126,6 @@ - - - E&xtras - - - - &File @@ -220,6 +216,14 @@ + + + E&xtras + + + + + @@ -518,18 +522,29 @@ Group (search results only) + + + Show Expired Entries... + + + Show Expired Entries... + + + Show Expired Entries + + - - KeepassGroupView - QTreeWidget -
../../src/lib/GroupView.h
-
KeepassEntryView QTreeWidget
../../src/lib/EntryView.h
+ + KeepassGroupView + QTreeWidget +
../../src/lib/GroupView.h
+
diff --git a/src/forms/SearchDlg.ui b/src/forms/SearchDlg.ui index 438a705..5eba4e9 100644 --- a/src/forms/SearchDlg.ui +++ b/src/forms/SearchDlg.ui @@ -1,286 +1,285 @@ - - - - Search_Dlg - - - - 0 - 0 - 390 - 260 - - - - - 0 - 0 - 0 - 0 - - - + Search_Dlg + + + + 0 + 0 + 390 + 280 + + + + + 0 + 0 + 0 + 0 + + + + + 390 + 280 + + + + + 390 + 280 + + + + Search... + + + + 9 + + + 6 + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + - 390 - 260 + 20 + 50 - - - - 390 - 260 - - - - Search... - - - - - 10 - 60 - 90 - 20 - - - - Search For: - - - - - - 110 - 60 - 270 - 21 - - - - - - - 110 - 110 - 170 - 20 - - - - Regular E&xpression - - - Alt+X - - - - - - 110 - 90 - 250 - 20 - - - - &Case Sensitive - - - Alt+C - - - - - - 0 - 0 - 390 - 50 - - - - - - - true - - - - - - 10 - 150 - 370 - 70 - - - + + + + + + + 0 + + + 4 + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 40 + 20 + + + + + + + Include: - - - - - 20 - 20 - 110 - 20 - + + + + 9 - - &Titles - - - Alt+T + + 6 + + + + Pass&words + + + Alt+W + + + + + + + A&nhang + + + Alt+N + + + + + + + U&RLs + + + Alt+R + + + + + + + C&omments + + + Alt+O + + + + + + + &Usernames + + + Alt+U + + + + + + + &Titles + + + Alt+T + + + + - - - - 20 - 40 - 110 - 20 - - - - &Usernames - - - Alt+U - + + + + + 0 + + + 0 + + + + + &Case Sensitive + + + Alt+C + + + + + + + Regular E&xpression + + + Alt+X + + + + + + + Include Subgroups (recursive) + + + + + + + + + + + + Search For: + - - - - 140 - 40 - 120 - 20 - - - - C&omments - - - Alt+O - - - - - - 260 - 20 - 100 - 20 - - - - U&RLs - - - Alt+R - - - - - - 260 - 40 - 100 - 20 - - - - A&nhang - - - Alt+N - - - - - - 140 - 20 - 110 - 20 - - - - Pass&words - - - Alt+W - - - - - - - 170 - 230 - 97 - 23 - - - +
+ + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 - - + + Search - - - - - - 280 - 230 - 97 - 23 - - - + + + + + + Clo&se - - + + Alt+S - - - - - - 110 - 130 - 271 - 22 - - - - Include Subgroups (recursive) - - - - - - - Edit_Search - checkBox_Cs - checkBox_regExp - checkBox_Title - checkBox_Username - checkBox_Password - checkBox_Comment - checkBox_URL - checkBox_Attachment - Button_Search - Button_Close - - - + + + + + + + + + + Edit_Search + checkBox_Cs + checkBox_regExp + checkBox_Title + checkBox_Username + checkBox_Password + checkBox_Comment + checkBox_URL + checkBox_Attachment + Button_Search + Button_Close + + +
diff --git a/src/forms/SettingsDlg.ui b/src/forms/SettingsDlg.ui index 8628555..0739830 100644 --- a/src/forms/SettingsDlg.ui +++ b/src/forms/SettingsDlg.ui @@ -52,9 +52,6 @@ - - The integration plugins provide features like usage of the native file dialogs and message boxes of the particular desktop environments. - QTabWidget::North @@ -62,9 +59,12 @@ QTabWidget::Rounded - 4 + 0 + + The integration plugins provide features like usage of the native file dialogs and message boxes of the particular desktop environments. + General @@ -593,6 +593,43 @@ + + + + Unified Title and Toolbar + + + + + + + 0 + + + 6 + + + + + Customize Entry Detail View... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -894,12 +931,19 @@ - + + + The directory where storage devices like CDs and memory sticks are normally mounted. + + - Mounting Root: + Media Root: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -908,6 +952,9 @@ Browser Command: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -946,10 +993,87 @@ + + + + Auto-Type Fine Tuning + + + + 9 + + + 6 + + + + + Time between the activation of an auto-type action by the user and the first simulated key stroke. + + + ms + + + 10000 + + + + + + + Pre-Gap: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Key Stroke Delay: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Delay between two simulated key strokes. Increase this if Auto-Type is randomly skipping characters. + + + ms + + + 10000 + + + + + + + + Enable this if you want to use your bookmarks and the last opened file independet from their absolute paths. This is especially useful when using KeePassX portably and therefore with changing mount points in the file system. + - Save relative paths + Save relative paths (bookmarks and last file) diff --git a/src/lib/AutoType_X11.cpp b/src/lib/AutoType_X11.cpp index 97459bb..475c8c3 100644 --- a/src/lib/AutoType_X11.cpp +++ b/src/lib/AutoType_X11.cpp @@ -31,15 +31,15 @@ QWidget* AutoType::MainWin=NULL; int AutoType::getModifiers(Display *d,KeySym keysym, int keycode){ -int SymsPerKey; -KeySym* Syms=XGetKeyboardMapping(d,keycode,1,&SymsPerKey); -int c=-1; -for(int i=0;i<4;i++) - if(Syms[i]==keysym){ - c=i; break;} -Q_ASSERT(c!=-1); -XFree(Syms); -return c; + int SymsPerKey; + KeySym* Syms=XGetKeyboardMapping(d,keycode,1,&SymsPerKey); + int c=-1; + for(int i=0;i<4;i++) + if(Syms[i]==keysym){ + c=i; break;} + Q_ASSERT(c!=-1); + XFree(Syms); + return c; } void AutoType::releaseModifiers(Display* d,int mods){ @@ -47,310 +47,310 @@ pressModifiers(d,mods,False); } void AutoType::pressModifiers(Display* d,int mods,bool press){ -int keycode; -switch(mods){ - case 0: //no modifier - break; - case 1: //Shift - XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_Shift_L),press,2); - break; - case 2: //AltGr - XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_ISO_Level3_Shift),press,2); - break; - case 3: //Shift+AltGr - XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_Shift_L),press,2); - XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_ISO_Level3_Shift),press,2); - break; -} + int keycode; + switch(mods){ + case 0: //no modifier + break; + case 1: //Shift + XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_Shift_L),press,2); + break; + case 2: //AltGr + XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_ISO_Level3_Shift),press,2); + break; + case 3: //Shift+AltGr + XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_Shift_L),press,2); + XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_ISO_Level3_Shift),press,2); + break; + } } -void AutoType::perform(IEntryHandle* entry, QString& err){ -struct timespec timeOut,remains; -timeOut.tv_sec = 0; -timeOut.tv_nsec = 30000000; /* 300 milliseconds */ -for(int i=0;i<10;i++)nanosleep(&timeOut, &remains); - -QString str; -QString comment=entry->comment(); -int c=comment.count("Auto-Type:"); -if(c>1){ - err=tr("More than one 'Auto-Type:' key sequence found.\nAllowed is only one per entry."); - return;} -if(c==1){ - int start=comment.indexOf("Auto-Type:")+10; - int len; - if(comment.size()==10)return; - for(len=0;len Keys; -for(int i=0;i=str.size()){ - err=tr("Syntax Error in Auto-Type sequence near character %1\n\ - Found '{' without closing '}'").arg(i+10); - return; - } - templateToKeysyms(tmpl.toLower(),Keys,entry); - continue; + void AutoType::perform(IEntryHandle* entry, QString& err){ + struct timespec timeOut,remains; + timeOut.tv_sec = 0; + timeOut.tv_nsec = 30000000; /* 300 milliseconds */ + for(int i=0;i<10;i++)nanosleep(&timeOut, &remains); + + QString str; + QString comment=entry->comment(); + int c=comment.count("Auto-Type:"); + if(c>1){ + err=tr("More than one 'Auto-Type:' key sequence found.\nAllowed is only one per entry."); + return;} + if(c==1){ + int start=comment.indexOf("Auto-Type:")+10; + int len; + if(comment.size()==10)return; + for(len=0;lenhide(); -Display* pDisplay = XOpenDisplay( NULL ); -for(int i=0;ishow(); + str="{USERNAME}{TAB}{PASSWORD}{ENTER}"; + + QList Keys; + for(int i=0;i=str.size()){ + err=tr("Syntax Error in Auto-Type sequence near character %1\n\ + Found '{' without closing '}'").arg(i+10); + return; + } + templateToKeysyms(tmpl.toLower(),Keys,entry); + continue; + } + else + Keys << getKeysym(str[i]); + } + + MainWin->hide(); + Display* pDisplay = XOpenDisplay( NULL ); + for(int i=0;ishow(); } void AutoType::templateToKeysyms(const QString& tmpl, QList& keys,IEntryHandle* entry){ -//tmpl must be lower case!!! -if(!tmpl.compare("title")){ - stringToKeysyms(entry->title(),keys); - return;} -if(!tmpl.compare("username")){ - stringToKeysyms(entry->username(),keys); - return;} -if(!tmpl.compare("url")){ - stringToKeysyms(entry->url(),keys); - return;} -if(!tmpl.compare("password")){ - SecString password=entry->password(); - password.unlock(); - stringToKeysyms(password,keys); - return; -} -if(!tmpl.compare("space")){ - keys << getKeysym(' '); - return;} - -if(!tmpl.compare("backspace") || !tmpl.compare("bs") || !tmpl.compare("bksp")){ - keys << XK_BackSpace; - return;} - -if(!tmpl.compare("break")){ - keys << XK_Break; - return;} - -if(!tmpl.compare("capslock")){ - keys << XK_Caps_Lock; - return;} - -if(!tmpl.compare("del") || !tmpl.compare("delete")){ - keys << XK_Delete; - return;} - -if(!tmpl.compare("end")){ - keys << XK_End; - return;} - -if(!tmpl.compare("enter")){ - keys << XK_Return; - return;} - -if(!tmpl.compare("esc")){ - keys << XK_Escape; - return;} - -if(!tmpl.compare("help")){ - keys << XK_Help; - return;} - -if(!tmpl.compare("home")){ - keys << XK_Home; - return;} - -if(!tmpl.compare("ins")){ - keys << XK_Insert; - return;} - -if(!tmpl.compare("numlock")){ - keys << XK_Num_Lock; - return;} - -if(!tmpl.compare("scroll")){ - keys << XK_Scroll_Lock; - return;} - -if(!tmpl.compare("pgdn")){ - keys << XK_Page_Down; - return;} - -if(!tmpl.compare("pgup")){ - keys << XK_Page_Up; - return;} - -if(!tmpl.compare("prtsc")){ - keys << XK_3270_PrintScreen; - return;} - -if(!tmpl.compare("up")){ - keys << XK_Up; - return;} - -if(!tmpl.compare("down")){ - keys << XK_Down; - return;} - -if(!tmpl.compare("left")){ - keys << XK_Left; - return;} - -if(!tmpl.compare("right")){ - keys << XK_Right; - return;} - -if(!tmpl.compare("f1")){ - keys << XK_F1; - return;} - -if(!tmpl.compare("f2")){ - keys << XK_F2; - return;} - -if(!tmpl.compare("f3")){ - keys << XK_F3; - return;} - -if(!tmpl.compare("f4")){ - keys << XK_F4; - return;} - -if(!tmpl.compare("f5")){ - keys << XK_F5; - return;} - -if(!tmpl.compare("f6")){ - keys << XK_F6; - return;} - -if(!tmpl.compare("f7")){ - keys << XK_F7; - return;} - -if(!tmpl.compare("f8")){ - keys << XK_F8; - return;} - -if(!tmpl.compare("f9")){ - keys << XK_F9; - return;} - -if(!tmpl.compare("f10")){ - keys << XK_F10; - return;} - -if(!tmpl.compare("f11")){ - keys << XK_F11; - return;} - -if(!tmpl.compare("f12")){ - keys << XK_F12; - return;} - -if(!tmpl.compare("f13")){ - keys << XK_F13; - return;} - -if(!tmpl.compare("f14")){ - keys << XK_F14; - return;} - -if(!tmpl.compare("f15")){ - keys << XK_F15; - return;} - -if(!tmpl.compare("f16")){ - keys << XK_F16; - return;} - -if(!tmpl.compare("add") || !tmpl.compare("plus")){ - keys << getKeysym('+'); - return;} - -if(!tmpl.compare("subtract")){ - keys << getKeysym('-'); - return;} - -if(!tmpl.compare("multiply")){ - keys << getKeysym('+'); - return;} - -if(!tmpl.compare("divide")){ - keys << getKeysym('/'); - return;} - -if(!tmpl.compare("at")){ - keys << getKeysym('@'); - return;} - -if(!tmpl.compare("percent")){ - keys << getKeysym('%'); - return;} - -if(!tmpl.compare("caret")){ - keys << getKeysym('^'); - return;} - -if(!tmpl.compare("tilde")){ - keys << getKeysym('~'); - return;} - -if(!tmpl.compare("leftbrace")){ - keys << getKeysym('{'); - return;} - -if(!tmpl.compare("rightbrace")){ - keys << getKeysym('}'); - return;} - -if(!tmpl.compare("leftparen")){ - keys << getKeysym('('); - return;} - -if(!tmpl.compare("rightparen")){ - keys << getKeysym(')'); - return;} - -if(!tmpl.compare("winl")){ - keys << XK_Super_L; - return;} - -if(!tmpl.compare("winr")){ - keys << XK_Super_R; - return;} - -if(!tmpl.compare("win")){ - keys << XK_Super_L; - return;} - -if(!tmpl.compare("tab")){ - keys << XK_Tab; - return;} + //tmpl must be lower case!!! + if(!tmpl.compare("title")){ + stringToKeysyms(entry->title(),keys); + return;} + if(!tmpl.compare("username")){ + stringToKeysyms(entry->username(),keys); + return;} + if(!tmpl.compare("url")){ + stringToKeysyms(entry->url(),keys); + return;} + if(!tmpl.compare("password")){ + SecString password=entry->password(); + password.unlock(); + stringToKeysyms(password,keys); + return; + } + if(!tmpl.compare("space")){ + keys << getKeysym(' '); + return;} + + if(!tmpl.compare("backspace") || !tmpl.compare("bs") || !tmpl.compare("bksp")){ + keys << XK_BackSpace; + return;} + + if(!tmpl.compare("break")){ + keys << XK_Break; + return;} + + if(!tmpl.compare("capslock")){ + keys << XK_Caps_Lock; + return;} + + if(!tmpl.compare("del") || !tmpl.compare("delete")){ + keys << XK_Delete; + return;} + + if(!tmpl.compare("end")){ + keys << XK_End; + return;} + + if(!tmpl.compare("enter")){ + keys << XK_Return; + return;} + + if(!tmpl.compare("esc")){ + keys << XK_Escape; + return;} + + if(!tmpl.compare("help")){ + keys << XK_Help; + return;} + + if(!tmpl.compare("home")){ + keys << XK_Home; + return;} + + if(!tmpl.compare("ins")){ + keys << XK_Insert; + return;} + + if(!tmpl.compare("numlock")){ + keys << XK_Num_Lock; + return;} + + if(!tmpl.compare("scroll")){ + keys << XK_Scroll_Lock; + return;} + + if(!tmpl.compare("pgdn")){ + keys << XK_Page_Down; + return;} + + if(!tmpl.compare("pgup")){ + keys << XK_Page_Up; + return;} + + if(!tmpl.compare("prtsc")){ + keys << XK_3270_PrintScreen; + return;} + + if(!tmpl.compare("up")){ + keys << XK_Up; + return;} + + if(!tmpl.compare("down")){ + keys << XK_Down; + return;} + + if(!tmpl.compare("left")){ + keys << XK_Left; + return;} + + if(!tmpl.compare("right")){ + keys << XK_Right; + return;} + + if(!tmpl.compare("f1")){ + keys << XK_F1; + return;} + + if(!tmpl.compare("f2")){ + keys << XK_F2; + return;} + + if(!tmpl.compare("f3")){ + keys << XK_F3; + return;} + + if(!tmpl.compare("f4")){ + keys << XK_F4; + return;} + + if(!tmpl.compare("f5")){ + keys << XK_F5; + return;} + + if(!tmpl.compare("f6")){ + keys << XK_F6; + return;} + + if(!tmpl.compare("f7")){ + keys << XK_F7; + return;} + + if(!tmpl.compare("f8")){ + keys << XK_F8; + return;} + + if(!tmpl.compare("f9")){ + keys << XK_F9; + return;} + + if(!tmpl.compare("f10")){ + keys << XK_F10; + return;} + + if(!tmpl.compare("f11")){ + keys << XK_F11; + return;} + + if(!tmpl.compare("f12")){ + keys << XK_F12; + return;} + + if(!tmpl.compare("f13")){ + keys << XK_F13; + return;} + + if(!tmpl.compare("f14")){ + keys << XK_F14; + return;} + + if(!tmpl.compare("f15")){ + keys << XK_F15; + return;} + + if(!tmpl.compare("f16")){ + keys << XK_F16; + return;} + + if(!tmpl.compare("add") || !tmpl.compare("plus")){ + keys << getKeysym('+'); + return;} + + if(!tmpl.compare("subtract")){ + keys << getKeysym('-'); + return;} + + if(!tmpl.compare("multiply")){ + keys << getKeysym('+'); + return;} + + if(!tmpl.compare("divide")){ + keys << getKeysym('/'); + return;} + + if(!tmpl.compare("at")){ + keys << getKeysym('@'); + return;} + + if(!tmpl.compare("percent")){ + keys << getKeysym('%'); + return;} + + if(!tmpl.compare("caret")){ + keys << getKeysym('^'); + return;} + + if(!tmpl.compare("tilde")){ + keys << getKeysym('~'); + return;} + + if(!tmpl.compare("leftbrace")){ + keys << getKeysym('{'); + return;} + + if(!tmpl.compare("rightbrace")){ + keys << getKeysym('}'); + return;} + + if(!tmpl.compare("leftparen")){ + keys << getKeysym('('); + return;} + + if(!tmpl.compare("rightparen")){ + keys << getKeysym(')'); + return;} + + if(!tmpl.compare("winl")){ + keys << XK_Super_L; + return;} + + if(!tmpl.compare("winr")){ + keys << XK_Super_R; + return;} + + if(!tmpl.compare("win")){ + keys << XK_Super_L; + return;} + + if(!tmpl.compare("tab")){ + keys << XK_Tab; + return;} } diff --git a/src/lib/EntryView.cpp b/src/lib/EntryView.cpp index c767192..f1b1e93 100644 --- a/src/lib/EntryView.cpp +++ b/src/lib/EntryView.cpp @@ -461,6 +461,11 @@ void KeepassEntryView::updateColumns(){ resizeColumns(); } +void KeepassEntryView::refreshItems(){ + for (int i=0;icount();i++){ ColumnOrder[columnListIndex(header()->logicalIndex(i))]=i; @@ -643,3 +648,13 @@ bool EntryViewItem::operator<(const QTreeWidgetItem& other)const{ } return DateThis < DateOther; } + + +void KeepassEntryView::setCurrentEntry(IEntryHandle* entry){ + bool found=false; + int i=0; + for(i;iEntryHandle==entry){found=true; break;} + if(!found)return; + setCurrentItem(Items[i]); +} diff --git a/src/lib/EntryView.h b/src/lib/EntryView.h index b96e86d..9a3e797 100644 --- a/src/lib/EntryView.h +++ b/src/lib/EntryView.h @@ -43,12 +43,14 @@ class KeepassEntryView:public QTreeWidget{ void showSearchResults(); void showGroup(IGroupHandle* group); void updateColumns(); + void refreshItems(); int columnListIndex(int LogicalIndex); IDatabase* db; QListItems; QList SearchResults; QMenu *ContextMenu; - QVarLengthArrayColumns; + QVarLengthArrayColumns; + void setCurrentEntry(IEntryHandle* entry); private: void setEntry(IEntryHandle* entry); void updateEntry(EntryViewItem*); diff --git a/src/lib/GroupView.cpp b/src/lib/GroupView.cpp index 8451fac..84d08bd 100644 --- a/src/lib/GroupView.cpp +++ b/src/lib/GroupView.cpp @@ -172,8 +172,14 @@ void KeepassGroupView::OnCurrentGroupChanged(QTreeWidgetItem* cur,QTreeWidgetIte } - - +void KeepassGroupView::setCurrentGroup(IGroupHandle* group){ + bool found=false; + int i=0; + for(i;iGroupHandle==group){found=true; break;} + if(!found)return; + setCurrentItem(Items[i]); +} void KeepassGroupView::dragEnterEvent ( QDragEnterEvent * event ){ LastHoverItem=NULL; diff --git a/src/lib/GroupView.h b/src/lib/GroupView.h index 69bfc22..07b56b4 100644 --- a/src/lib/GroupView.h +++ b/src/lib/GroupView.h @@ -38,6 +38,7 @@ class KeepassGroupView:public QTreeWidget{ GroupViewItem* SearchResultItem; void createItems(); void showSearchResults(); + void setCurrentGroup(IGroupHandle* group); private: virtual void dragEnterEvent(QDragEnterEvent* event); diff --git a/src/main.cpp b/src/main.cpp index 9b9d491..240c532 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,37 +58,17 @@ using namespace std; #define CSTR(x)(x.toUtf8().data()) +QHashPixmapCache; +QHashIconCache; + CConfig config; QSettings* settings; QString AppDir; QString PluginLoadError; bool TrActive; -QPixmap *Icon_Key32x32; -QPixmap *Icon_Settings32x32; -QPixmap *Icon_Search32x32; -QPixmap *Icon_I18n32x32; -QPixmap *Icon_Ok16x16; -QPixmap *EntryIcons; -QIcon *Icon_FileNew; -QIcon *Icon_FileOpen; -QIcon *Icon_FileClose; -QIcon *Icon_FileSave; -QIcon *Icon_FileSaveAs; -QIcon *Icon_Exit; -QIcon *Icon_File_Export; -QIcon *Icon_EditDelete; -QIcon *Icon_EditAdd; -QIcon *Icon_EditEdit; -QIcon *Icon_EditUsernameToCb; -QIcon *Icon_EditPasswordToCb; -QIcon *Icon_EditClone; -QIcon *Icon_EditOpenUrl; -QIcon *Icon_EditSearch; -QIcon *Icon_Configure; -QIcon *Icon_Help; -QIcon *Icon_AutoType; -QIcon *Icon_Swap; -QIcon *Icon_FileSaveDisabled; +QString DetailViewTemplate; + +QPixmap* EntryIcons; inline void loadImages(); inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang); @@ -176,7 +156,7 @@ int main(int argc, char **argv) if(loadTranslation(translator,"keepass-",loc.name(),QStringList() << app->applicationDirPath()+"/../share/keepass/i18n/" - << QDir::homePath()+"/.keepass/" )) + << QDir::homePath()+"/.keepassx/" )) {app->installTranslator(translator); TrActive=true;} else{ @@ -201,6 +181,14 @@ int main(int argc, char **argv) delete qtTranslator; } + + QFile templ(QDir::homePath()+"/.keepassx/detailview-template.html"); ///FIXME ArgCfg + if(templ.open(QIODevice::ReadOnly)){ + DetailViewTemplate=QString::fromUtf8(templ.readAll()); + templ.close(); + } + else loadDefaultDetailViewTemplate(); + loadImages(); initYarrow(); //init random number generator SecString::generateSessionKey(); @@ -217,6 +205,15 @@ int main(int argc, char **argv) QObject::tr("Could not save configuration file.\nMake sure you have write access to '~/.keepass'."), QObject::tr("OK"),"","",0.0); + if(templ.open(QIODevice::WriteOnly)){ + templ.write(DetailViewTemplate.toUtf8()); + templ.close(); + } + else{ + qWarning("Failed to save detail view template: %s",decodeFileError(templ.error()).toUtf8().data()); + } + + fileDlgHistory.save(); delete app; delete settings; @@ -224,9 +221,25 @@ int main(int argc, char **argv) } +void loadDefaultDetailViewTemplate(){ + QFile templ(":/default-detailview.html"); + templ.open(QIODevice::ReadOnly); + DetailViewTemplate=QString::fromUtf8(templ.readAll()); + templ.close(); + DetailViewTemplate.replace("Group",QCoreApplication::translate("DetailViewTemplate","Group")); + DetailViewTemplate.replace("Title",QCoreApplication::translate("DetailViewTemplate","Title")); + DetailViewTemplate.replace("Username",QCoreApplication::translate("DetailViewTemplate","Username")); + DetailViewTemplate.replace("Password",QCoreApplication::translate("DetailViewTemplate","Password")); + DetailViewTemplate.replace("URL",QCoreApplication::translate("DetailViewTemplate","URL")); + DetailViewTemplate.replace("Creation",QCoreApplication::translate("DetailViewTemplate","Creation")); + DetailViewTemplate.replace("Last Access",QCoreApplication::translate("DetailViewTemplate","Last Access")); + DetailViewTemplate.replace("Last Modification",QCoreApplication::translate("DetailViewTemplate","Last Modification")); + DetailViewTemplate.replace("Expiration",QCoreApplication::translate("DetailViewTemplate","Expiration")); + DetailViewTemplate.replace("Comment",QCoreApplication::translate("DetailViewTemplate","Comment")); +} - -void createBanner(QLabel *Banner,QPixmap* symbol,QString text){ +//obsolete +void createBanner(QLabel *Banner,const QPixmap* symbol,QString text){ QPixmap Pixmap; createBanner(&Pixmap,symbol,text ,Banner->width() @@ -236,11 +249,11 @@ void createBanner(QLabel *Banner,QPixmap* symbol,QString text){ Banner->setPixmap(Pixmap); } -void createBanner(QPixmap* Pixmap, QPixmap* IconAlpha,const QString& Text,int Width){ +void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width){ createBanner(Pixmap,IconAlpha,Text,Width,config.BannerColor1,config.BannerColor2,config.BannerTextColor); } -void createBanner(QPixmap* Pixmap, QPixmap* IconAlpha,const QString& Text,int Width, QColor Color1, QColor Color2, QColor TextColor){ +void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width, QColor Color1, QColor Color2, QColor TextColor){ *Pixmap=QPixmap(Width,50); QPainter painter(Pixmap); QLinearGradient grad(0,0,Width,0); @@ -296,7 +309,7 @@ void openBrowser(QString UrlString){ } } - +///TODO 0.2.3 remove void loadImg(QString name,QPixmap& Img){ if(Img.load(AppDir+"/../share/keepass/icons/"+name)==false){ if(Img.load(AppDir+"/share/"+name)==false){ @@ -307,66 +320,44 @@ if(Img.load(AppDir+"/../share/keepass/icons/"+name)==false){ } - -#define _loadIcon(Icon,PATH)\ - Icon=new QIcon(ThemeDir+PATH); - - +///TODO 0.2.3 remove void loadImages(){ + bool small=true; + QString ThemeDir=AppDir+"/../share/keepass/icons/nuvola/32x32"; + QPixmap tmpImg; + loadImg("clientic.png",tmpImg); + EntryIcons=new QPixmap[BUILTIN_ICONS]; + for(int i=0;ipixmap(32,32,QIcon::Disabled)); +const QPixmap* getPixmap(const QString& name){ + QPixmap* CachedPixmap=PixmapCache.value(name); + if(CachedPixmap) + return CachedPixmap; + QImage img; + if(!img.load(AppDir+"/../share/keepass/icons/"+name+".png")){ + //ERROR + qWarning("%s",CSTR(name)); + } + QPixmap* NewPixmap=new QPixmap(QPixmap::fromImage(img)); + PixmapCache.insert(name,NewPixmap); + return NewPixmap; } diff --git a/src/main.h b/src/main.h index e5be136..66b1f8b 100644 --- a/src/main.h +++ b/src/main.h @@ -34,47 +34,25 @@ typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2}; class CConfig; -void createBanner(QLabel *Banner,QPixmap* symbol,QString text); -void createBanner(QPixmap* Pixmap, QPixmap* IconAlpha,const QString& Text,int Width); -void createBanner(QPixmap* Pixmap, QPixmap* IconAlpha,const QString& Text,int Width, QColor Color1, QColor Color2, QColor TextColor); +void createBanner(QLabel *Banner,const QPixmap* symbol,QString text); +void createBanner(QPixmap* Pixmap, const QPixmap* IconAlpha,const QString& Text,int Width); +void createBanner(QPixmap* Pixmap, const QPixmap* IconAlpha,const QString& Text,int Width, QColor Color1, QColor Color2, QColor TextColor); void openBrowser(QString url); void showErrMsg(const QString& msg,QWidget* parent=NULL); +const QIcon& getIcon(const QString& name); +const QPixmap* getPixmap(const QString& name); QString decodeFileError(QFile::FileError Code); QString findPlugin(const QString& filename); QString makePathRelative(const QString& Abs,const QString& Cur); +void loadDefaultDetailViewTemplate(); extern QString PluginLoadError; extern CConfig config; extern QSettings *settings; extern QString AppDir; extern bool TrActive; +extern QString DetailViewTemplate; extern QPixmap *EntryIcons; -extern QPixmap *Icon_Key32x32; -extern QPixmap *Icon_Settings32x32; -extern QPixmap *Icon_Search32x32; -extern QPixmap *Icon_I18n32x32; -extern QPixmap *Icon_Ok16x16; -extern QIcon *Icon_FileNew; -extern QIcon *Icon_FileOpen; -extern QIcon *Icon_FileClose; -extern QIcon *Icon_FileSave; -extern QIcon *Icon_FileSaveAs; -extern QIcon *Icon_Exit; -extern QIcon *Icon_File_Export; -extern QIcon *Icon_EditDelete; -extern QIcon *Icon_EditAdd; -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 QIcon *Icon_EditSearch; -extern QIcon *Icon_Configure; -extern QIcon *Icon_Help; -extern QIcon *Icon_AutoType; -extern QIcon *Icon_Swap; -extern QIcon *Icon_FileSaveDisabled; #endif diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 771466e..5f80a2d 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2006 by Tarek Saidi * + * Copyright (C) 2005-2007 by Tarek Saidi * * tarek.saidi@arcor.de * * * * This program is free software; you can redistribute it and/or modify * @@ -57,6 +57,8 @@ #include "dialogs/SimplePasswordDlg.h" #include "dialogs/PasswordGenDlg.h" #include "dialogs/CollectEntropyDlg.h" +#include "dialogs/CustomizeDetailViewDlg.h" +#include "dialogs/ExpiredEntriesDlg.h" #include #include @@ -77,7 +79,8 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt: setupUi(this); AutoType::MainWin=this; setGeometry(settings->value("Ui/MainWindowGeometry",QVariant(geometry())).toRect()); - splitter->restoreState(settings->value("Ui/SplitterPos").toByteArray()); + VSplitter->restoreState(settings->value("Ui/VSplitterPos").toByteArray()); + HSplitter->restoreState(settings->value("Ui/HSplitterPos").toByteArray()); SysTray=new QSystemTrayIcon(this); setupToolbar(); setupIcons(); @@ -89,6 +92,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt: statusBar()->addWidget(StatusBarSelection,85); statusBar()->setVisible(config.ShowStatusbar); setupConnections(); + FileOpen=false; if(ArgFile!=QString()) openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(ArgFile)),false); @@ -100,6 +104,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt: settings->setValue("LastFile",""); } + // DBus Server of Qt 4.2 does not work - 4.3 snapshot seems to work fine /* //dbusServer=new QDBusServer("unix:path=/tmp/KpxBus",this); //qDebug("DBUS: %s",dbusServer->lastError().message().toAscii().data()); @@ -155,6 +160,7 @@ void KeepassMainWindow::setupConnections(){ connect(ExtrasSettingsAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasSettings())); connect(ExtrasPasswordGenAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasPasswordGen())); + connect(ExtrasShowExpiredEntriesAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasShowExpiredEntries())); connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook())); connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout())); @@ -197,31 +203,34 @@ void KeepassMainWindow::setupToolbar(){ } void KeepassMainWindow::setupIcons(){ - setWindowIcon(QIcon(AppDir+"/../share/keepass/icons/keepassx.png")); - FileNewAction->setIcon(*Icon_FileNew); - FileOpenAction->setIcon(*Icon_FileOpen); - FileSaveAction->setIcon(*Icon_FileSave); - FileSaveAsAction->setIcon(*Icon_FileSaveAs); - FileCloseAction->setIcon(*Icon_FileClose); - FileSettingsAction->setIcon(*Icon_Configure); - FileExitAction->setIcon(*Icon_Exit); - EditNewEntryAction->setIcon(*Icon_EditAdd); - 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); - EditSearchAction->setIcon(*Icon_EditSearch); - EditGroupSearchAction->setIcon(*Icon_EditSearch); - ExtrasSettingsAction->setIcon(*Icon_Configure); - EditAutoTypeAction->setIcon(*Icon_AutoType); - HelpHandbookAction->setIcon(*Icon_Help); - SysTray->setIcon(QIcon(AppDir+"/../share/keepass/icons/keepassx_large.png")); + setWindowIcon(getIcon("keepassx")); + FileNewAction->setIcon(getIcon("filenew")); + FileOpenAction->setIcon(getIcon("fileopen")); + FileSaveAction->setIcon(getIcon("filesave")); + FileSaveAsAction->setIcon(getIcon("filesaveas")); + FileCloseAction->setIcon(getIcon("fileclose")); + FileSettingsAction->setIcon(getIcon("dbsettings")); + FileExitAction->setIcon(getIcon("exit")); + EditNewEntryAction->setIcon(getIcon("newentry")); + EditEditEntryAction->setIcon(getIcon("editentry")); + EditDeleteEntryAction->setIcon(getIcon("deleteentry")); + EditPasswordToClipboardAction->setIcon(getIcon("copypwd")); + EditUsernameToClipboardAction->setIcon(getIcon("copyusername")); + EditCloneEntryAction->setIcon(getIcon("cloneentry")); + EditOpenUrlAction->setIcon(getIcon("openurl")); + EditSaveAttachmentAction->setIcon(getIcon("filesave")); + EditNewGroupAction->setIcon(getIcon("newgroup")); + EditEditGroupAction->setIcon(getIcon("editgroup")); + EditDeleteGroupAction->setIcon(getIcon("deletegroup")); + EditSearchAction->setIcon(getIcon("dbsearch")); + EditGroupSearchAction->setIcon(getIcon("groupsearch")); + ExtrasSettingsAction->setIcon(getIcon("appsettings")); + ExtrasShowExpiredEntriesAction->setIcon(getIcon("expired")); + ExtrasPasswordGenAction->setIcon(getIcon("generator")); + EditAutoTypeAction->setIcon(getIcon("autotype")); + HelpHandbookAction->setIcon(getIcon("manual")); + HelpAboutAction->setIcon(getIcon("help")); + SysTray->setIcon(getIcon("keepassx_large")); if(config.ShowSysTrayIcon) SysTray->show(); } @@ -328,7 +337,7 @@ void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){ if(!IsAuto){ config.LastKeyLocation=QString(); config.LastKeyType=PASSWORD;} - db=dynamic_cast(new StandardDatabase()); + db=dynamic_cast(new Kdb3Database()); CPasswordDialog PasswordDlg(this,db,IsAuto,false); PasswordDlg.setWindowTitle(filename); switch(PasswordDlg.exec()){ @@ -392,7 +401,7 @@ bool KeepassMainWindow::closeDatabase(){ void KeepassMainWindow::OnFileNewKdb(){ - IDatabase* db_new=dynamic_cast(new StandardDatabase()); + IDatabase* db_new=dynamic_cast(new Kdb3Database()); db_new->create(); CPasswordDialog dlg(this,db_new,false,true); dlg.setWindowTitle(tr("New Database")); @@ -451,12 +460,13 @@ FileSaveAsAction->setEnabled(IsOpen); FileCloseAction->setEnabled(IsOpen); FileSettingsAction->setEnabled(IsOpen); FileChangeKeyAction->setEnabled(IsOpen); - EditSearchAction->setEnabled(IsOpen); GroupView->setEnabled(IsOpen); EntryView->setEnabled(IsOpen); DetailView->setEnabled(IsOpen); QuickSearchEdit->setEnabled(IsOpen); +ExtrasShowExpiredEntriesAction->setEnabled(IsOpen); + if(!IsOpen){ EditNewGroupAction->setEnabled(false); EditEditGroupAction->setEnabled(false); @@ -482,14 +492,14 @@ else{ void KeepassMainWindow::setStateFileModified(bool mod){ if(!FileOpen){ - FileSaveAction->setIcon(*Icon_FileSave); + FileSaveAction->setIcon(getIcon("filesave")); return; } ModFlag=mod; if(mod) - FileSaveAction->setIcon(*Icon_FileSave); + FileSaveAction->setIcon(getIcon("filesave")); else - FileSaveAction->setIcon(*Icon_FileSaveDisabled); + FileSaveAction->setIcon(getIcon("filesavedisabled")); } void KeepassMainWindow::setStateGroupSelected(SelectionState s){ @@ -526,28 +536,75 @@ void KeepassMainWindow::updateDetailView(){ return; } + QString templ=DetailViewTemplate; IEntryHandle* entry=((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle; - QString str=tr("Group: %1 Title: %2 Username: %3 URL: %4 Password: %5 Creation: %6 Last Change: %7 LastAccess: %8 Expires: %9"); - - str=str.arg(entry->group()->title()).arg(entry->title()); - - if(!config.ListView_HideUsernames) str=str.arg(entry->username()); - else str=str.arg("****"); - - str=str.arg(entry->url()); + templ.replace("%group%",entry->group()->title()); + templ.replace("%title%",entry->title()); + if(config.ListView_HideUsernames)templ.replace("%username%","****"); + else templ.replace("%username%",entry->username()); if(!config.ListView_HidePasswords){ SecString password=entry->password(); password.unlock(); - str=str.arg(password.string()); + templ.replace("%password%",password.string()); } - else str=str.arg("****"); + else templ.replace("%password%","****"); + templ.replace("%url%",entry->url()); + templ.replace("%creation%",entry->creation().toString(Qt::LocalDate)); + templ.replace("%lastmod%",entry->lastMod().toString(Qt::LocalDate)); + templ.replace("%lastaccess%",entry->lastAccess().toString(Qt::LocalDate)); + templ.replace("%expire%",entry->expire().toString(Qt::LocalDate)); + templ.replace("%comment%",entry->comment()); + templ.replace("%attachment%",entry->binaryDesc()); - str=str .arg(entry->creation().toString(Qt::LocalDate)) - .arg(entry->lastMod().toString(Qt::LocalDate)) - .arg(entry->lastAccess().toString(Qt::LocalDate)) - .arg(entry->expire().toString(Qt::LocalDate)); - DetailView->setHtml(str); + if(entry->expire()!=Date_Never){ + int secs=QDateTime::currentDateTime().secsTo(entry->expire()); + if(secs < 0) + templ.replace("%expire-timeleft%",tr("expired")); + else{ + int years=0; + int months=0; + int days=0; + years=secs/(86400*365); + secs-=years*(86400*365); + months=secs/(86400*30); + secs-=months*(86400*30); + days=secs/86400; + + QString out; + + if(months==1) + out=tr("1 Month"); + if(months>1) + out=tr("%1 Months").arg(months); + + if(years){ + if(out!=QString()) + out.prepend(tr(", ")); + if(years==1) + out.prepend(tr("1 Year")); + if(years>1) + out.prepend(tr("%1 Years").arg(years)); + } + else if(days){ + if(out!=QString()) + out.append(tr(", ")); + if(days==1) + out.append(tr("1 Day")); + if(days>1) + out.append(tr("%1 Days").arg(days)); + } + + if(!days && !years && !months) + out=tr("less than 1 day"); + + templ.replace("%expire-timeleft%",out); + } + } + else + templ.replace("%expire-timeleft%","-"); + + DetailView->setHtml(templ); } @@ -688,7 +745,7 @@ void KeepassMainWindow::OnExport(QAction* action){ void KeepassMainWindow::OnImport(QAction* action){ if(FileOpen) if(!closeDatabase())return; - IDatabase* tmpdb=dynamic_cast(new StandardDatabase()); + IDatabase* tmpdb=dynamic_cast(new Kdb3Database()); tmpdb->create(); if(dynamic_cast(action->data().value())->importDatabase(this,tmpdb)){ CPasswordDialog dlg(this,tmpdb,false,true); @@ -726,7 +783,7 @@ for(int i=0; iSearchResults=dlg.Result; GroupView->showSearchResults(); @@ -766,7 +823,7 @@ void KeepassMainWindow::OnColumnVisibilityChanged(QAction* action){ void KeepassMainWindow::OnUsernPasswVisibilityChanged(bool value){ config.ListView_HidePasswords=ViewHidePasswordsAction->isChecked(); config.ListView_HideUsernames=ViewHideUsernamesAction->isChecked(); -//EntryView->refreshItems(); + EntryView->refreshItems(); } void KeepassMainWindow::OnFileModified(){ @@ -781,7 +838,8 @@ void KeepassMainWindow::closeEvent(QCloseEvent* e){ } settings->setValue("Ui/MainWindowGeometry",QVariant(geometry())); - settings->setValue("Ui/SplitterPos",splitter->saveState()); + settings->setValue("Ui/VSplitterPos",VSplitter->saveState()); + settings->setValue("Ui/HSplitterPos",HSplitter->saveState()); config.ShowStatusbar=statusBar()->isVisible(); if(FileOpen){ @@ -800,14 +858,14 @@ void KeepassMainWindow::closeEvent(QCloseEvent* e){ void KeepassMainWindow::OnExtrasSettings(){ CSettingsDlg dlg(this); - if(dlg.exec()==1){ + if(dlg.exec()==QDialog::Accepted){ EntryView->setAlternatingRowColors(config.AlternatingRowColors); SysTray->setVisible(config.ShowSysTrayIcon); } } void KeepassMainWindow::OnHelpAbout(){ -CAboutDialog dlg(this); +AboutDialog dlg(this); dlg.exec(); } @@ -896,4 +954,13 @@ void KeepassMainWindow::saveLastFilename(const QString& filename){ else settings->setValue("LastFile",filename); } -} \ No newline at end of file +} + +void KeepassMainWindow::OnExtrasShowExpiredEntries(){ + ExpiredEntriesDialog dlg(this,db,db->expiredEntries()); + if(dlg.exec()==QDialog::Accepted){ + GroupView->setCurrentGroup(dlg.SelectedEntry->group()); + EntryView->setCurrentEntry(dlg.SelectedEntry); + } + +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 7f6349c..c121e36 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -81,6 +81,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{ void OnFileModified(); void OnExtrasSettings(); void OnExtrasPasswordGen(); + void OnExtrasShowExpiredEntries(); void OnHelpAbout(); void OnHelpHandbook(); void OnItemExpanded(QTreeWidgetItem*); diff --git a/src/src.pro b/src/src.pro index 152d007..6c0b6ff 100755 --- a/src/src.pro +++ b/src/src.pro @@ -8,7 +8,8 @@ DEPENDPATH += "crypto \ forms \ import \ lib \ - translations" + translations \ + res" INSTALLS += target data data.files += ../share/keepass/* TARGET = ../bin/keepassx @@ -47,7 +48,10 @@ FORMS += forms/EditGroupDlg.ui \ forms/EditEntryDlg.ui \ forms/PasswordGenDlg.ui \ forms/SelectIconDlg.ui \ - forms/CollectEntropyDlg.ui + forms/CollectEntropyDlg.ui \ + forms/CustomizeDetailViewDlg.ui \ + forms/CalendarDlg.ui \ + forms/ExpiredEntriesDlg.ui TRANSLATIONS += translations/keepass-de_DE.ts \ translations/keepass-ru_RU.ts \ translations/keepass-es_ES.ts \ @@ -80,6 +84,9 @@ HEADERS += lib/IniReader.h \ dialogs/PasswordGenDlg.h \ dialogs/SelectIconDlg.h \ dialogs/CollectEntropyDlg.h \ + dialogs/CustomizeDetailViewDlg.h \ + dialogs/CalendarDlg.h \ + dialogs/ExpiredEntriesDlg.h \ lib/random.h \ Database.h \ lib/KdePlugin.h \ @@ -135,6 +142,9 @@ SOURCES += lib/IniReader.cpp \ dialogs/PasswordGenDlg.cpp \ dialogs/SelectIconDlg.cpp \ dialogs/CollectEntropyDlg.cpp \ + dialogs/CustomizeDetailViewDlg.cpp \ + dialogs/CalendarDlg.cpp \ + dialogs/ExpiredEntriesDlg.cpp \ lib/random.cpp \ Database.cpp \ lib/KdePlugin.cpp \ @@ -151,9 +161,11 @@ SOURCES += lib/IniReader.cpp \ crypto/yarrow.cpp \ lib/WaitAnimationWidget.cpp \ KpxFirefox.cpp +RESOURCES += res/resources.qrc MOC_DIR = ../build/moc UI_DIR = ../build/ui OBJECTS_DIR = ../build/ +RCC_DIR = ../build/rcc CONFIG += debug \ qt \ thread \