most changes are details

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@147 b624d157-de02-0410-bad0-e51aec6abb33
master
myxelf 17 years ago
parent 65e5da4649
commit 961268a67d
  1. BIN
      share/keepass/icons/bookmark.png
  2. BIN
      share/keepass/icons/bookmark_add.png
  3. BIN
      share/keepass/icons/bookmark_del.png
  4. BIN
      share/keepass/icons/bookmark_edit.png
  5. BIN
      share/keepass/icons/bookmark_this.png
  6. 109
      src/Database.h
  7. 43
      src/Kdb3Database.cpp
  8. 35
      src/Kdb3Database.h
  9. 14
      src/dialogs/AboutDlg.cpp
  10. 4
      src/dialogs/AboutDlg.h
  11. 20
      src/dialogs/AddBookmarkDlg.cpp
  12. 13
      src/dialogs/AddBookmarkDlg.h
  13. 11
      src/dialogs/CollectEntropyDlg.cpp
  14. 7
      src/dialogs/CollectEntropyDlg.h
  15. 44
      src/dialogs/EditEntryDlg.cpp
  16. 98
      src/dialogs/ManageBookmarksDlg.cpp
  17. 13
      src/dialogs/ManageBookmarksDlg.h
  18. 48
      src/forms/AboutDlg.ui
  19. 47
      src/forms/AddBookmarkDlg.ui
  20. 2
      src/forms/MainWindow.ui
  21. 85
      src/forms/ManageBookmarksDlg.ui
  22. 16
      src/main.cpp
  23. 13
      src/main.h
  24. 40
      src/mainwindow.cpp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef _DATABASE_H_ #ifndef _DATABASE_H_
#define _DATABASE_H_ #define _DATABASE_H_
@ -75,7 +75,7 @@ class KpxDateTime:public QDateTime{
}; };
//! Entry Data Structure //! Entry Data Structure
/*! This class holds the data of a normal database entry. It is used by some interface functions to process predefined entries and can be used for internal data handling.*/ /*! This class holds the data of a normal database entry. It is used by some interface functions to process predefined entries and can be used for internal data handling.*/
class CEntry{ class CEntry{
public: public:
CEntry(); CEntry();
@ -97,7 +97,7 @@ public:
}; };
//! Group Data Structure //! Group Data Structure
/*! This class holds the data of a normal database group. It is used by some interface functions to process predefined groups and can be used for internal data handling.*/ /*! This class holds the data of a normal database group. It is used by some interface functions to process predefined groups and can be used for internal data handling.*/
class CGroup{ class CGroup{
public: public:
CGroup(); CGroup();
@ -147,15 +147,16 @@ public:
virtual KpxDateTime expire()=0; virtual KpxDateTime expire()=0;
virtual QByteArray binary()=0; virtual QByteArray binary()=0;
virtual quint32 binarySize()=0; virtual quint32 binarySize()=0;
virtual QString friendlySize()=0;
//! \return the index of the entry amongst the entries of its group. The index of the first entry is 0. //! \return the index of the entry amongst the entries of its group. The index of the first entry is 0.
virtual int visualIndex()const=0; virtual int visualIndex()const=0;
/*! Sets the visual index of an entry. The indices of all other entries in the same group get automaticly readjusted by this function. /*! Sets the visual index of an entry. The indices of all other entries in the same group get automaticly readjusted by this function.
\param index The new visual index. \param index The new visual index.
*/ */
virtual void setVisualIndex(int index)=0; virtual void setVisualIndex(int index)=0;
/*! Sets the visual index of an entry. The indices of all other entries in the same group need to be adjusted manually! /*! Sets the visual index of an entry. The indices of all other entries in the same group need to be adjusted manually!
This function is optimal to avoid readjustion overhead when sorting items. This function is optimal to avoid readjustion overhead when sorting items.
\param index The new visual index. \param index The new visual index.
@ -170,7 +171,7 @@ public:
}; };
//! Custom Icon Interface //! Custom Icon Interface
/*! /*!
This class provides an interface for the management of custom icons. The implementation is optional and not necessarily needed. This class provides an interface for the management of custom icons. The implementation is optional and not necessarily needed.
*/ */
class ICustomIcons:public QObject{ class ICustomIcons:public QObject{
@ -180,12 +181,12 @@ class ICustomIcons:public QObject{
\param icon The pixmap which contains the new icon. This function makes a copy of the given pixmap. \param icon The pixmap which contains the new icon. This function makes a copy of the given pixmap.
*/ */
virtual void addIcon(const QPixmap& icon)=0; virtual void addIcon(const QPixmap& icon)=0;
/*! Removes an icon. /*! Removes an icon.
\param index The index of the icon which should be removed. Built-in icons cannot be removed so make sure that index is not the index of an Built-in icon before calling this function. \param index The index of the icon which should be removed. Built-in icons cannot be removed so make sure that index is not the index of an Built-in icon before calling this function.
*/ */
virtual void removeIcon(int index)=0; virtual void removeIcon(int index)=0;
/*! Replaces one icon with another one. /*! Replaces one icon with another one.
\param index The index of the icon which should be replaced. Built-in icons cannot be replaced so make sure that index is not the index of an Built-in icon before calling this function. \param index The index of the icon which should be replaced. Built-in icons cannot be replaced so make sure that index is not the index of an Built-in icon before calling this function.
\param icon The pixmap which contains the new icon. \param icon The pixmap which contains the new icon.
@ -196,43 +197,43 @@ class ICustomIcons:public QObject{
That means it is emitted after every call off addIcon(), removeIcon() and replaceIcon(). That means it is emitted after every call off addIcon(), removeIcon() and replaceIcon().
*/ */
void iconsModified(); void iconsModified();
}; };
//! Handle class interface for accessing groups //! Handle class interface for accessing groups
/*! /*!
The IGroupHandle interface provides access to CGroup data structures without using direct references. Every entry handle class must implement this interface necessarily. The IGroupHandle interface provides access to CGroup data structures without using direct references. Every entry handle class must implement this interface necessarily.
*/ */
class IGroupHandle{ class IGroupHandle{
public: public:
virtual void setTitle(const QString& Title)=0; virtual void setTitle(const QString& Title)=0;
virtual void setImage(const quint32& ImageID)=0; virtual void setImage(const quint32& ImageID)=0;
virtual QString title()=0; virtual QString title()=0;
virtual quint32 image()=0; virtual quint32 image()=0;
//! \return a pointer to the handle of the parent group or NULL if the group has no parent. //! \return a pointer to the handle of the parent group or NULL if the group has no parent.
virtual IGroupHandle* parent()=0; virtual IGroupHandle* parent()=0;
//! \return a List of pointers to the handles of all childs of the group and an empty list if the group has no childs. The list is sorted and starts with the first child. //! \return a List of pointers to the handles of all childs of the group and an empty list if the group has no childs. The list is sorted and starts with the first child.
virtual QList<IGroupHandle*> childs()=0; virtual QList<IGroupHandle*> childs()=0;
//! \return the index of the group amongst the childs of its parent. The index of the first child is 0. //! \return the index of the group amongst the childs of its parent. The index of the first child is 0.
virtual int index()=0; virtual int index()=0;
/*! Sets the index of a group amongst the childs of its parent. /*! Sets the index of a group amongst the childs of its parent.
This function can be used to sort the groups of the database in a specific order. This function can be used to sort the groups of the database in a specific order.
\param index The new index of the group. The indices of the other groups which are affected by this operation will be automatically adjusted.*/ \param index The new index of the group. The indices of the other groups which are affected by this operation will be automatically adjusted.*/
virtual void setIndex(int index)=0; virtual void setIndex(int index)=0;
/*! Tests the validity of the handle. /*! Tests the validity of the handle.
\return TRUE if the handle is valid and FALSE if the handle is invalid e.g. because the associated group was deleted.*/ \return TRUE if the handle is valid and FALSE if the handle is invalid e.g. because the associated group was deleted.*/
virtual bool isValid()=0; virtual bool isValid()=0;
/*! \return the level of the group in the group tree. This level is tantamount to the number of parents that the group has. */ /*! \return the level of the group in the group tree. This level is tantamount to the number of parents that the group has. */
virtual int level()=0; virtual int level()=0;
virtual bool expanded()=0; virtual bool expanded()=0;
virtual void setExpanded(bool)=0; virtual void setExpanded(bool)=0;
@ -240,7 +241,7 @@ public:
//! Common Database Interface. //! Common Database Interface.
/*! /*!
This is the common base interface for databases. Every database class must implement this interface necessarily. This is the common base interface for databases. Every database class must implement this interface necessarily.
*/ */
class IDatabase:public QObject{ class IDatabase:public QObject{
public: public:
@ -254,9 +255,9 @@ public:
virtual bool load(QString identifier)=0; virtual bool load(QString identifier)=0;
//! Saves the current database. //! Saves the current database.
/*! It is not allowed to call this function if no database is loaded. /*! It is not allowed to call this function if no database is loaded.
\return TRUE if saving was successfull, otherwise FALSE. \return TRUE if saving was successfull, otherwise FALSE.
*/ */
virtual bool save()=0; virtual bool save()=0;
//! Closes the current database. //! Closes the current database.
@ -264,33 +265,33 @@ public:
It is not allowed to call this function if no database is loaded. It is not allowed to call this function if no database is loaded.
Please note: The database will be closed without saving it in before. Please note: The database will be closed without saving it in before.
* \return TRUE if closing was successfull, otherwise FALSE. * \return TRUE if closing was successfull, otherwise FALSE.
*/ */
virtual bool close()=0; virtual bool close()=0;
//! Creates a new database. //! Creates a new database.
/*! It is not allowed to call this function if a database is already loaded. /*! It is not allowed to call this function if a database is already loaded.
\return TRUE if saving was successfull, otherwise FALSE. \return TRUE if saving was successfull, otherwise FALSE.
*/ */
virtual void create()=0; virtual void create()=0;
virtual bool changeFile(const QString& filename)=0; virtual bool changeFile(const QString& filename)=0;
virtual QFile* file()=0; virtual QFile* file()=0;
//! \return a list with the pointers to the handles of all entries of the database. The list contains only valid handles. The list is not sorted. //! \return a list with the pointers to the handles of all entries of the database. The list contains only valid handles. The list is not sorted.
virtual QList<IEntryHandle*> entries()=0; virtual QList<IEntryHandle*> entries()=0;
//! \param Group The group which contains the wanted entries. //! \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. //! \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<IEntryHandle*> entries(IGroupHandle* Group)=0; virtual QList<IEntryHandle*> 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. //! \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<IEntryHandle*> expiredEntries()=0; virtual QList<IEntryHandle*> 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. //! \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<IGroupHandle*> groups()=0; virtual QList<IGroupHandle*> groups()=0;
/*! /*!
This function might be slower than groups() - denpending on the implementation. This function might be slower than groups() - denpending on the implementation.
\return a list with the pointers to the handles of all entries of the database. The list ist sorted and contains only valid handles.*/ \return a list with the pointers to the handles of all entries of the database. The list ist sorted and contains only valid handles.*/
@ -298,7 +299,7 @@ public:
/*! \return the last error message or an empty QString() object if no error occured.*/ /*! \return the last error message or an empty QString() object if no error occured.*/
virtual QString getError()=0; virtual QString getError()=0;
/*! Creates a clone of a given entry. /*! Creates a clone of a given entry.
All attributes besides the UUID are copied, even the creation date. All attributes besides the UUID are copied, even the creation date.
@ -311,13 +312,13 @@ public:
\param entry The handle of the entry which should be deleted. \param entry The handle of the entry which should be deleted.
*/ */
virtual void deleteEntry(IEntryHandle* entry)=0; virtual void deleteEntry(IEntryHandle* entry)=0;
/*! Deletes the last added entry. /*! Deletes the last added entry.
This function should only be called immediately after an addEntry() call, otherwise the behavior is undefined. Immediately means that there are no other add/move/delete operations between the two function calls.*/ This function should only be called immediately after an addEntry() call, otherwise the behavior is undefined. Immediately means that there are no other add/move/delete operations between the two function calls.*/
virtual void deleteLastEntry()=0; virtual void deleteLastEntry()=0;
/*! Deletes multiple given entries. /*! Deletes multiple given entries.
Calling this function can be faster then calling deleteEntry(..) several times - depending on the implementation. Calling this function can be faster then calling deleteEntry(..) several times - depending on the implementation.
Important: All entries must belong to the same group! Important: All entries must belong to the same group!
@ -328,7 +329,7 @@ public:
/*! Creates a new blank entry. /*! Creates a new blank entry.
\param Group The group to which the entry should be added. \param Group The group to which the entry should be added.
\return the handle of the new entry. \return the handle of the new entry.
*/ */
virtual IEntryHandle* newEntry(IGroupHandle* Group)=0; virtual IEntryHandle* newEntry(IGroupHandle* Group)=0;
/*! Adds a Entry object to the database. /*! Adds a Entry object to the database.
@ -337,7 +338,7 @@ public:
\return a pointer to the handle of the added entry. \return a pointer to the handle of the added entry.
*/ */
virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* Group)=0; virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* Group)=0;
/*! Moves an entry to another group. /*! Moves an entry to another group.
\param entry The entry which should be moved. \param entry The entry which should be moved.
\param group The new group of the entry.*/ \param group The new group of the entry.*/
@ -348,25 +349,25 @@ public:
Deletes the group, all it's entries and child groups and their entries as well. Deletes the group, all it's entries and child groups and their entries as well.
\param group The group which should be deleted.*/ \param group The group which should be deleted.*/
virtual void deleteGroup(IGroupHandle* group)=0; virtual void deleteGroup(IGroupHandle* group)=0;
/*! Adds a group to the database. /*! Adds a group to the database.
\param Group A pointer to a CGroup object. Id and ParentId of the object are ignored. \param Group A pointer to a CGroup object. Id and ParentId of the object are ignored.
\param Parent A pointer to the handle of parent of the group. Can be NULL if the group is a top-level group. \param Parent A pointer to the handle of parent of the group. Can be NULL if the group is a top-level group.
\return a pointer to the handle of the added group.*/ \return a pointer to the handle of the added group.*/
virtual IGroupHandle* addGroup(const CGroup* Group,IGroupHandle* Parent)=0; virtual IGroupHandle* addGroup(const CGroup* Group,IGroupHandle* Parent)=0;
/*! Moves a group. /*! Moves a group.
\param Group The group which should be moved. \param Group The group which should be moved.
\param NewParent The new parent of the group. \param NewParent The new parent of the group.
\param Position The position of the group amongst it's new siblings. If Position is 0 the group will be prepended if it is -1 the group will be appended.*/ \param Position The position of the group amongst it's new siblings. If Position is 0 the group will be prepended if it is -1 the group will be appended.*/
virtual void moveGroup(IGroupHandle* Group,IGroupHandle* NewParent,int Position)=0; virtual void moveGroup(IGroupHandle* Group,IGroupHandle* NewParent,int Position)=0;
/*! Checks two given groups if one is the parent of the other. /*! Checks two given groups if one is the parent of the other.
\param Child The child group. \param Child The child group.
\param Parent The parent group. \param Parent The parent group.
\return TRUE if Parent is the parent of child, otherwise FALSE.*/ \return TRUE if Parent is the parent of child, otherwise FALSE.*/
virtual bool isParent(IGroupHandle* parent, IGroupHandle* child)=0; virtual bool isParent(IGroupHandle* parent, IGroupHandle* child)=0;
/*! \param index Index of the requested icon. /*! \param index Index of the requested icon.
\return a reference to the pixmap of the requested icon. \return a reference to the pixmap of the requested icon.
*/ */
@ -377,18 +378,18 @@ public:
/*! Deletes all old invalid handles of the database. /*! Deletes all old invalid handles of the database.
Make sure that there are no pointers to those handles which are still in use before calling this function.*/ Make sure that there are no pointers to those handles which are still in use before calling this function.*/
virtual void cleanUpHandles()=0; virtual void cleanUpHandles()=0;
/*! \return the number of groups in the database.*/ /*! \return the number of groups in the database.*/
virtual int numGroups()=0; virtual int numGroups()=0;
/*! \return the number of entires in the database.*/ /*! \return the number of entires in the database.*/
virtual int numEntries()=0; virtual int numEntries()=0;
/*! \return the number of built-in icons of the database. Each database must contain at least one built-in icon. */ /*! \return the number of built-in icons of the database. Each database must contain at least one built-in icon. */
virtual int builtinIcons()=0; virtual int builtinIcons()=0;
/*! Searches in the database for a string or regular expression. /*! Searches in the database for a string or regular expression.
\param Group The group where the search should be performed in. If Group is NULL the search will be performed in the whole database. \param Group The group where the search should be performed in. If Group is NULL the search will be performed in the whole database.
\param SearchString The searched string or a regular expression. \param SearchString The searched string or a regular expression.
\param CaseSensitvie If this parameter is true the search will be case sensitive. \param CaseSensitvie If this parameter is true the search will be case sensitive.
\param RegExp The SearchString parameter will be handled as regular expression if this parameter is true. \param RegExp The SearchString parameter will be handled as regular expression if this parameter is true.
@ -396,16 +397,16 @@ public:
\param Fields A pointer to a six element bool array. It defines which fields are included into the search. The order is: title, username, url, password, comment, attachment description. The pointer can also be NULL, than the default pattern is used instead. \param Fields A pointer to a six element bool array. It defines which fields are included into the search. The order is: title, username, url, password, comment, attachment description. The pointer can also be NULL, than the default pattern is used instead.
\return the search results as a list of pointers to the entry handles.*/ \return the search results as a list of pointers to the entry handles.*/
virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields)=0; virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields)=0;
//! Moves an entry to the recycle bin. //! Moves an entry to the recycle bin.
virtual void moveToTrash(IEntryHandle* entry)=0; virtual void moveToTrash(IEntryHandle* entry)=0;
//! \returns all entries of the recycle bin. //! \returns all entries of the recycle bin.
virtual QList<IEntryHandle*> trashEntries()=0; virtual QList<IEntryHandle*> trashEntries()=0;
//! Empty the recycle bin. //! Empty the recycle bin.
virtual void emptyTrash()=0; virtual void emptyTrash()=0;
}; };
@ -430,7 +431,7 @@ class IKdbSettings{
virtual void setCryptAlgorithm(CryptAlgorithm algo)=0; virtual void setCryptAlgorithm(CryptAlgorithm algo)=0;
virtual CryptAlgorithm cryptAlgorithm()=0; virtual CryptAlgorithm cryptAlgorithm()=0;
virtual unsigned int keyTransfRounds()=0; virtual unsigned int keyTransfRounds()=0;
virtual void setKeyTransfRounds(unsigned int rounds)=0; virtual void setKeyTransfRounds(unsigned int rounds)=0;
}; };
#endif #endif

@ -843,7 +843,7 @@ QList<IEntryHandle*> Kdb3Database::entries(IGroupHandle* group){
handles.append(&EntryHandles[i]); handles.append(&EntryHandles[i]);
} }
qSort(handles.begin(),handles.end(),EntryHandleLessThan); qSort(handles.begin(),handles.end(),EntryHandleLessThan);
return handles; return handles;
} }
@ -962,6 +962,43 @@ KpxDateTime Kdb3Database::EntryHandle::lastAccess(){return Entry->LastAccess;}
KpxDateTime Kdb3Database::EntryHandle::expire(){return Entry->Expire;} KpxDateTime Kdb3Database::EntryHandle::expire(){return Entry->Expire;}
QByteArray Kdb3Database::EntryHandle::binary(){return Entry->Binary;} QByteArray Kdb3Database::EntryHandle::binary(){return Entry->Binary;}
quint32 Kdb3Database::EntryHandle::binarySize(){return Entry->Binary.size();} quint32 Kdb3Database::EntryHandle::binarySize(){return Entry->Binary.size();}
QString Kdb3Database::EntryHandle::friendlySize()
{
quint32 binsize = binarySize();
QString unit;
uint faktor;
int prec;
if (binsize < 1024)
{
unit = tr("Bytes");
faktor = 1;
prec = 0;
}
else
{
if (binsize < 1048576)
{
unit = tr("KiB");
faktor = 1024;
}
else
if (binsize < 1073741824)
{
unit = tr("MiB");
faktor = 1048576;
}
else
{
unit = tr("GiB");
faktor = 1073741824;
}
prec = 1;
}
return (QString::number((float)binsize / (float)faktor, 'f', prec) + " " + unit);
}
int Kdb3Database::EntryHandle::visualIndex()const{return Entry->Index;} int Kdb3Database::EntryHandle::visualIndex()const{return Entry->Index;}
void Kdb3Database::EntryHandle::setVisualIndexDirectly(int i){Entry->Index=i;} void Kdb3Database::EntryHandle::setVisualIndexDirectly(int i){Entry->Index=i;}
bool Kdb3Database::EntryHandle::isValid()const{return valid;} bool Kdb3Database::EntryHandle::isValid()const{return valid;}
@ -1637,7 +1674,7 @@ bool Kdb3Database::createKeyFile(const QString& filename,int length, bool Hex){
void Kdb3Database::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,int Pos){ void Kdb3Database::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,int Pos){
StdGroup* Parent; StdGroup* Parent;
StdGroup* Group=((GroupHandle*)groupHandle)->Group; StdGroup* Group=((GroupHandle*)groupHandle)->Group;
if(NewParent) if(NewParent)
Parent=((GroupHandle*)NewParent)->Group; Parent=((GroupHandle*)NewParent)->Group;
@ -1686,7 +1723,7 @@ void Kdb3Database::moveToTrash(IEntryHandle* entry){
TrashEntries.append(trash); TrashEntries.append(trash);
TrashHandles.append(EntryHandle(this)); TrashHandles.append(EntryHandle(this));
TrashHandles.back().Entry=&TrashEntries.back(); TrashHandles.back().Entry=&TrashEntries.back();
TrashEntries.back().Handle=&TrashHandles.back(); TrashEntries.back().Handle=&TrashHandles.back();
} }
void Kdb3Database::emptyTrash(){ void Kdb3Database::emptyTrash(){

@ -16,7 +16,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef _STD_DATABASE_H_ #ifndef _STD_DATABASE_H_
#define _STD_DATABASE_H_ #define _STD_DATABASE_H_
@ -55,7 +55,7 @@ public:
class StdGroup; class StdGroup;
class StdEntry; class StdEntry;
class EntryHandle:public IEntryHandle{ class EntryHandle:public IEntryHandle{
friend class Kdb3Database; friend class Kdb3Database;
public: public:
EntryHandle(Kdb3Database* db); EntryHandle(Kdb3Database* db);
@ -91,6 +91,7 @@ public:
virtual KpxDateTime expire(); virtual KpxDateTime expire();
virtual QByteArray binary(); virtual QByteArray binary();
virtual quint32 binarySize(); virtual quint32 binarySize();
virtual QString friendlySize();
virtual bool isValid() const; virtual bool isValid() const;
private: private:
void invalidate(){valid=false;} void invalidate(){valid=false;}
@ -99,14 +100,14 @@ public:
Kdb3Database* pDB; Kdb3Database* pDB;
StdEntry* Entry; StdEntry* Entry;
}; };
class GroupHandle:public IGroupHandle{ class GroupHandle:public IGroupHandle{
friend class Kdb3Database; friend class Kdb3Database;
GroupHandle(Kdb3Database* db); GroupHandle(Kdb3Database* db);
public: public:
virtual void setTitle(const QString& Title); virtual void setTitle(const QString& Title);
virtual void setImage(const quint32& ImageId); virtual void setImage(const quint32& ImageId);
void setOldImage(const quint32& ImageId); void setOldImage(const quint32& ImageId);
virtual QString title(); virtual QString title();
virtual quint32 image(); virtual quint32 image();
quint32 oldImage(); quint32 oldImage();
@ -124,10 +125,10 @@ public:
StdGroup* Group; StdGroup* Group;
Kdb3Database* pDB; Kdb3Database* pDB;
}; };
friend class EntryHandle; friend class EntryHandle;
friend class GroupHandle; friend class GroupHandle;
class StdEntry:public CEntry{ class StdEntry:public CEntry{
public: public:
quint32 OldImage; quint32 OldImage;
@ -135,7 +136,7 @@ public:
EntryHandle* Handle; EntryHandle* Handle;
StdGroup* Group; StdGroup* Group;
}; };
class StdGroup:public CGroup{ class StdGroup:public CGroup{
public: public:
StdGroup():CGroup(){}; StdGroup():CGroup(){};
@ -147,12 +148,12 @@ public:
QList<StdGroup*> Childs; QList<StdGroup*> Childs;
QList<StdEntry*> Entries; QList<StdEntry*> Entries;
}; };
class TrashEntry: public StdEntry{ class TrashEntry: public StdEntry{
public: public:
QStringList GroupPath; QStringList GroupPath;
}; };
virtual ~Kdb3Database(){}; virtual ~Kdb3Database(){};
virtual bool load(QString identifier); virtual bool load(QString identifier);
virtual bool save(); virtual bool save();
@ -179,12 +180,12 @@ public:
virtual void setCryptAlgorithm(CryptAlgorithm algo){Algorithm=algo;} virtual void setCryptAlgorithm(CryptAlgorithm algo){Algorithm=algo;}
virtual CryptAlgorithm cryptAlgorithm(){return Algorithm;} virtual CryptAlgorithm cryptAlgorithm(){return Algorithm;}
virtual unsigned int keyTransfRounds(){return KeyTransfRounds;} virtual unsigned int keyTransfRounds(){return KeyTransfRounds;}
virtual void setKeyTransfRounds(unsigned int rounds){KeyTransfRounds=rounds;} virtual void setKeyTransfRounds(unsigned int rounds){KeyTransfRounds=rounds;}
virtual QList<IEntryHandle*> entries(); virtual QList<IEntryHandle*> entries();
virtual QList<IEntryHandle*> entries(IGroupHandle* Group); virtual QList<IEntryHandle*> entries(IGroupHandle* Group);
virtual QList<IEntryHandle*> expiredEntries(); virtual QList<IEntryHandle*> expiredEntries();
virtual IEntryHandle* cloneEntry(const IEntryHandle* entry); virtual IEntryHandle* cloneEntry(const IEntryHandle* entry);
virtual void deleteEntry(IEntryHandle* entry); virtual void deleteEntry(IEntryHandle* entry);
virtual void deleteEntries(QList<IEntryHandle*> entries); virtual void deleteEntries(QList<IEntryHandle*> entries);
@ -196,7 +197,7 @@ public:
virtual QList<IEntryHandle*> trashEntries(); virtual QList<IEntryHandle*> trashEntries();
virtual void emptyTrash(); virtual void emptyTrash();
virtual QList<IGroupHandle*> groups(); virtual QList<IGroupHandle*> groups();
virtual QList<IGroupHandle*> sortedGroups(); virtual QList<IGroupHandle*> sortedGroups();
virtual void deleteGroup(IGroupHandle* group); virtual void deleteGroup(IGroupHandle* group);
@ -204,9 +205,9 @@ public:
virtual IGroupHandle* addGroup(const CGroup* Group,IGroupHandle* Parent); virtual IGroupHandle* addGroup(const CGroup* Group,IGroupHandle* Parent);
virtual bool isParent(IGroupHandle* parent, IGroupHandle* child); virtual bool isParent(IGroupHandle* parent, IGroupHandle* child);
private: private:
QDateTime dateFromPackedStruct5(const unsigned char* pBytes); QDateTime dateFromPackedStruct5(const unsigned char* pBytes);
void dateToPackedStruct5(const QDateTime& datetime, unsigned char* dst); void dateToPackedStruct5(const QDateTime& datetime, unsigned char* dst);
@ -239,7 +240,7 @@ private:
StdEntry* getEntry(EntryHandle* handle); StdEntry* getEntry(EntryHandle* handle);
int getEntryListIndex(EntryHandle* handle); int getEntryListIndex(EntryHandle* handle);
EntryHandle* getHandle(StdEntry* entry); EntryHandle* getHandle(StdEntry* entry);
StdGroup* getGroup(quint32 Id); StdGroup* getGroup(quint32 Id);
void deleteGroup(StdGroup* group); void deleteGroup(StdGroup* group);

@ -18,20 +18,20 @@
***************************************************************************/ ***************************************************************************/
#include <qmessagebox.h> #include <qmessagebox.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qfile.h>
#include <QPainter> #include <QPainter>
#include "main.h"
#include "AboutDlg.h" #include "AboutDlg.h"
AboutDialog::AboutDialog(QWidget* parent):QDialog(parent) AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
{ {
setupUi(this); setupUi(this);
createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("KeePassX %1").arg(KEEPASS_VERSION),width()); createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("%1 %2").arg(APP_DISPLAY_NAME, APP_VERSION),width());
loadLicFromFile(); loadLicFromFile();
labelAppName->setText(tr(APP_DISPLAY_NAME));
labelAppFunc->setText(tr(" - %1").arg(APP_LONG_FUNC));
QString AboutTr=tr("<b>Current Translation: None</b><br><br>","Please replace 'None' with the language of your translation"); QString AboutTr=tr("<b>Current Translation: None</b><br><br>","Please replace 'None' with the language of your translation");
if(TrActive){ if(TrActive){
AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR")); AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR"));
@ -51,9 +51,9 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
str+="<br>"; str+="<br>";
str+="<u>"+tr("Eugen Gorschenin")+"</u><br>"+tr("Web Designer")+"<br>"+tr("geugen@users.sf.de")+"<br>"; str+="<u>"+tr("Eugen Gorschenin")+"</u><br>"+tr("Web Designer")+"<br>"+tr("geugen@users.sf.de")+"<br>";
str+="<br>"; str+="<br>";
str+="<u>"+tr("Jota Jota")+"</u><br>"+tr("Developer")+"<br>"+tr("myxself@users.sf.de")+"<br>"; str+="<u>"+tr("Juan J Gonz&aacute;lez C&aacute;rdenas [Jota Jota]")+"</u><br>"+tr("Developer")+"<br>"+tr("myxelf@users.sf.net")+"<br>";
str+="</div><br><div style='margin-left:0px;'>"; str+="</div><br><div style='margin-left:0px;'>";
str+="<b>"+tr("Thanks To")+"</b>"; str+="<b>"+tr("Thanks To")+"</b><br>";
str+="</div><div style='margin-left:10px;'>"; str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("Matthias Miller")+"</u><br>"+tr("Patches for better MacOS X support")+"<br>"+tr("www.outofhanwell.com")+"<br></div>"; str+="<u>"+tr("Matthias Miller")+"</u><br>"+tr("Patches for better MacOS X support")+"<br>"+tr("www.outofhanwell.com")+"<br></div>";
str+="<br>"; str+="<br>";

@ -21,9 +21,9 @@
#define _ABOUTDIALOG_H_ #define _ABOUTDIALOG_H_
#include <QPaintEvent> #include <QPaintEvent>
#include <QPixmap>
#include "ui_AboutDlg.h" #include "ui_AboutDlg.h"
#include "lib/UrlLabel.h" #include "lib/UrlLabel.h"
#include "main.h" #include "main.h"
@ -42,7 +42,7 @@ public slots:
private: private:
QPixmap BannerPixmap; QPixmap BannerPixmap;
inline void loadLicFromFile(); inline void loadLicFromFile();
virtual void paintEvent(QPaintEvent*); virtual void paintEvent(QPaintEvent*);
}; };
#endif #endif

@ -18,10 +18,13 @@
***************************************************************************/ ***************************************************************************/
#include <QFileInfo> #include <QFileInfo>
#include "AddBookmarkDlg.h" #include <QPainter>
#include "lib/FileDialogs.h" #include "lib/FileDialogs.h"
#include "lib/bookmarks.h" #include "lib/bookmarks.h"
#include "AddBookmarkDlg.h"
AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _ItemID):QDialog(parent) AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _ItemID):QDialog(parent)
{ {
setupUi(this); setupUi(this);
@ -30,18 +33,29 @@ AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _It
connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnButtonOk())); connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnButtonOk()));
connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(reject())); connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(reject()));
if(ItemID==-1){ if(ItemID==-1){
createBanner(&BannerPixmap,getPixmap("bookmark_add"),tr("Add Bookmark"),width());
if(DefaultFilename==QString()) if(DefaultFilename==QString())
OnButtonBrowse(); OnButtonBrowse();
else else
Edit_Filename->setText(DefaultFilename); Edit_Filename->setText(DefaultFilename);
} }
else { else {
Edit_Title->setText(KpxBookmarks::title(ItemID)); createBanner(&BannerPixmap,getPixmap("bookmark_edit"),tr("Edit Bookmark"),width());
Edit_Title->setText(KpxBookmarks::title(ItemID));
Edit_Filename->setText(KpxBookmarks::path(ItemID)); Edit_Filename->setText(KpxBookmarks::path(ItemID));
setWindowTitle(tr("Edit Bookmark")); setWindowTitle(tr("Edit Bookmark"));
} }
} }
void AddBookmarkDlg::paintEvent(QPaintEvent *event){
QDialog::paintEvent(event);
QPainter painter(this);
painter.setClipRegion(event->region());
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void AddBookmarkDlg::OnButtonBrowse(){ void AddBookmarkDlg::OnButtonBrowse(){
QString path=KpxFileDialogs::openExistingFile(this,"AddBookmarkDlg", tr("Add Bookmark"), QString path=KpxFileDialogs::openExistingFile(this,"AddBookmarkDlg", tr("Add Bookmark"),
QStringList() << tr("KeePass Databases (*.kdb)") << tr("All Files (*)")); QStringList() << tr("KeePass Databases (*.kdb)") << tr("All Files (*)"));
@ -54,5 +68,5 @@ void AddBookmarkDlg::OnButtonOk(){
ItemID=KpxBookmarks::add(Edit_Title->text(),Edit_Filename->text()); ItemID=KpxBookmarks::add(Edit_Title->text(),Edit_Filename->text());
else else
KpxBookmarks::edit(Edit_Title->text(),Edit_Filename->text(),ItemID); KpxBookmarks::edit(Edit_Title->text(),Edit_Filename->text(),ItemID);
accept(); accept();
} }

@ -21,8 +21,11 @@
#define _ADDBOOKMARKDLG_H_ #define _ADDBOOKMARKDLG_H_
#include <QDialog> #include <QDialog>
#include <QPaintEvent>
#include "ui_AddBookmarkDlg.h" #include "ui_AddBookmarkDlg.h"
#include "main.h"
class AddBookmarkDlg : public QDialog, private Ui::AddBookmarkDlg class AddBookmarkDlg : public QDialog, private Ui::AddBookmarkDlg
{ {
Q_OBJECT Q_OBJECT
@ -30,11 +33,15 @@ class AddBookmarkDlg : public QDialog, private Ui::AddBookmarkDlg
public: public:
AddBookmarkDlg (QWidget* parent=0, QString DefaultFilename=QString(), int ItemID=-1); AddBookmarkDlg (QWidget* parent=0, QString DefaultFilename=QString(), int ItemID=-1);
int ItemID; int ItemID;
private slots: private:
QPixmap BannerPixmap;
virtual void paintEvent(QPaintEvent*);
private slots:
void OnButtonOk(); void OnButtonOk();
void OnButtonBrowse(); void OnButtonBrowse();
}; };
#endif #endif

@ -21,8 +21,9 @@
#include <QPainter> #include <QPainter>
#include <QCursor> #include <QCursor>
#include "crypto/yarrow.h" #include "crypto/yarrow.h"
#include "CollectEntropyDlg.h" #include "CollectEntropyDlg.h"
#include "main.h"
CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){ CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){
setupUi(this); setupUi(this);
@ -81,12 +82,12 @@ void CollectEntropyDlg::updateProgress(){
stackedWidget->setCurrentIndex(1); stackedWidget->setCurrentIndex(1);
} }
else else
progressBar->setValue(4*KeyCounter+4*MouseCounter); progressBar->setValue(4*KeyCounter+4*MouseCounter);
} }
void CollectEntropyDlg::showEvent(QShowEvent* event){ void CollectEntropyDlg::showEvent(QShowEvent* event){
if(!event->spontaneous()){ if(!event->spontaneous()){
Animation->start(); Animation->start();
} }
} }

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef _COLLECT_ENTROPY_DLG_H_ #ifndef _COLLECT_ENTROPY_DLG_H_
#define _COLLECT_ENTROPY_DLG_H_ #define _COLLECT_ENTROPY_DLG_H_
@ -26,12 +26,15 @@
#include <QPaintEvent> #include <QPaintEvent>
#include <QShowEvent> #include <QShowEvent>
#include "main.h"
class CollectEntropyDlg: public QDialog, public Ui_CollectEntropyDlg{ class CollectEntropyDlg: public QDialog, public Ui_CollectEntropyDlg{
Q_OBJECT Q_OBJECT
public: public:
CollectEntropyDlg(QWidget* parent); CollectEntropyDlg(QWidget* parent);
~CollectEntropyDlg(); ~CollectEntropyDlg();
private: private:
QPixmap BannerPixmap; QPixmap BannerPixmap;
virtual void paintEvent(QPaintEvent* event); virtual void paintEvent(QPaintEvent* event);

@ -131,16 +131,9 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
ButtonDeleteAttachment->setDisabled(true); ButtonDeleteAttachment->setDisabled(true);
Label_AttachmentSize->setText(""); Label_AttachmentSize->setText("");
} }
else{ else
QString unit; Label_AttachmentSize->setText(entry->friendlySize());
int faktor;
int prec;
if(entry->binarySize()<1000){unit=" Byte";faktor=1;prec=0;}
else
if(entry->binarySize()<1000000){unit=" kB";faktor=1000;prec=1;}
else{unit=" MB";faktor=1000000;prec=1;}
Label_AttachmentSize->setText(QString::number((float)entry->binarySize()/(float)faktor,'f',prec)+unit);
}
if(entry->expire()==Date_Never){ if(entry->expire()==Date_Never){
DateTime_Expire->setDisabled(true); DateTime_Expire->setDisabled(true);
CheckBox_ExpiresNever->setChecked(true); CheckBox_ExpiresNever->setChecked(true);
@ -344,36 +337,7 @@ void CEditEntryDlg::OnNewAttachment()
QFileInfo info(filename); QFileInfo info(filename);
entry->setBinaryDesc(info.fileName()); entry->setBinaryDesc(info.fileName());
Edit_Attachment->setText(entry->binaryDesc()); Edit_Attachment->setText(entry->binaryDesc());
QString unit; Label_AttachmentSize->setText(entry->friendlySize());
uint faktor;
int prec;
if (entry->binarySize() < 1024)
{
unit = tr("Bytes");
faktor = 1;
prec = 0;
}
else
{
if (entry->binarySize() < pow(2,20))
{
unit = tr("kiB");
faktor = 1024;
}
else
if (entry->binarySize() < pow(2,30))
{
unit = tr("MiB");
faktor = pow(2,20);
}
else
{
unit = tr("GiB");
faktor = pow(2,30);
}
prec = 1;
}
Label_AttachmentSize->setText(QString::number((float)entry->binarySize()/(float)faktor,'f',prec) + " " + unit);
ButtonOpenAttachment->setEnabled(true); ButtonOpenAttachment->setEnabled(true);
ButtonSaveAttachment->setEnabled(true); ButtonSaveAttachment->setEnabled(true);
ButtonDeleteAttachment->setEnabled(true); ButtonDeleteAttachment->setEnabled(true);

@ -18,7 +18,7 @@
***************************************************************************/ ***************************************************************************/
#include <QListWidget> #include <QListWidget>
#include "main.h" #include <QPainter>
#include "ManageBookmarksDlg.h" #include "ManageBookmarksDlg.h"
#include "lib/bookmarks.h" #include "lib/bookmarks.h"
#include "dialogs/AddBookmarkDlg.h" #include "dialogs/AddBookmarkDlg.h"
@ -26,24 +26,65 @@
ManageBookmarksDlg::ManageBookmarksDlg(QWidget* parent):QDialog(parent) ManageBookmarksDlg::ManageBookmarksDlg(QWidget* parent):QDialog(parent)
{ {
setupUi(this); setupUi(this);
createBanner(&BannerPixmap,getPixmap("bookmark"),tr("Manage Bookmarks"),width());
for(int i=0;i<KpxBookmarks::count();i++){ for(int i=0;i<KpxBookmarks::count();i++){
QListWidgetItem* item=new QListWidgetItem(ListWidget); QListWidgetItem* item=new QListWidgetItem(ListWidget);
item->setData(Qt::UserRole,i); item->setData(Qt::UserRole,i);
item->setText(KpxBookmarks::title(i)); item->setText(KpxBookmarks::title(i));
} }
connect(Button_Up,SIGNAL(clicked()),this,SLOT(OnButtonUp())); connect(Button_Add,SIGNAL(clicked()),this,SLOT(OnButtonAdd()));
connect(Button_Edit,SIGNAL(clicked()),this,SLOT(OnButtonEdit()));
connect(Button_Delete,SIGNAL(clicked()),this,SLOT(OnButtonDelete()));
connect(Button_Up,SIGNAL(clicked()),this,SLOT(OnButtonUp()));
connect(Button_Down,SIGNAL(clicked()),this,SLOT(OnButtonDown())); connect(Button_Down,SIGNAL(clicked()),this,SLOT(OnButtonDown()));
connect(Button_Delete,SIGNAL(clicked()),this,SLOT(OnButtonDelete()));
connect(Button_Add,SIGNAL(clicked()),this,SLOT(OnButtonAdd()));
connect(Button_Edit,SIGNAL(clicked()),this,SLOT(OnButtonEdit()));
connect(ListWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(edit(QListWidgetItem*))); connect(ListWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(edit(QListWidgetItem*)));
connect(buttonBox->button(QDialogButtonBox::Close),SIGNAL(clicked()),this,SLOT(close())); connect(buttonBox->button(QDialogButtonBox::Close),SIGNAL(clicked()),this,SLOT(close()));
Button_Up->setIcon(getIcon("up")); Button_Add->setIcon(getIcon("bookmark_add"));
Button_Down->setIcon(getIcon("down"));
Button_Delete->setIcon(getIcon("delete"));
Button_Edit->setIcon(getIcon("bookmark_edit")); Button_Edit->setIcon(getIcon("bookmark_edit"));
Button_Add->setIcon(getIcon("bookmark_add")); Button_Delete->setIcon(getIcon("bookmark_del"));
Button_Up->setIcon(getIcon("up"));
Button_Down->setIcon(getIcon("down"));
}
void ManageBookmarksDlg::paintEvent(QPaintEvent *event){
QDialog::paintEvent(event);
QPainter painter(this);
painter.setClipRegion(event->region());
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void ManageBookmarksDlg::OnButtonAdd(){
AddBookmarkDlg dlg(this);
if(dlg.exec()){
int i=dlg.ItemID;
QListWidgetItem* item=new QListWidgetItem(ListWidget);
item->setData(Qt::UserRole,i);
item->setText(KpxBookmarks::title(i));
}
return;
}
void ManageBookmarksDlg::OnButtonEdit(){
QListWidgetItem* item=ListWidget->currentItem();
if(!item)return;
edit(item);
}
void ManageBookmarksDlg::OnButtonDelete(){
QListWidgetItem* item=ListWidget->currentItem();
if(!item)return;
int index=item->data(Qt::UserRole).toInt();
KpxBookmarks::remove(index);
delete item;
for(int i=0;i<ListWidget->count();i++){
int itemindex=ListWidget->item(i)->data(Qt::UserRole).toInt();
if(itemindex>index)
ListWidget->item(i)->setData(Qt::UserRole,itemindex-1);
}
} }
@ -66,44 +107,17 @@ void ManageBookmarksDlg::OnButtonDown(){
ListWidget->insertItem(row,item); ListWidget->insertItem(row,item);
ListWidget->setCurrentRow(row); ListWidget->setCurrentRow(row);
} }
void ManageBookmarksDlg::OnButtonDelete(){
QListWidgetItem* item=ListWidget->currentItem();
if(!item)return;
int index=item->data(Qt::UserRole).toInt();
KpxBookmarks::remove(index);
delete item;
for(int i=0;i<ListWidget->count();i++){
int itemindex=ListWidget->item(i)->data(Qt::UserRole).toInt();
if(itemindex>index)
ListWidget->item(i)->setData(Qt::UserRole,itemindex-1);
}
}
void ManageBookmarksDlg::OnButtonEdit(){
QListWidgetItem* item=ListWidget->currentItem();
if(!item)return;
edit(item);
}
void ManageBookmarksDlg::edit(QListWidgetItem* item){ void ManageBookmarksDlg::edit(QListWidgetItem* item){
int i=item->data(Qt::UserRole).toInt(); int i=item->data(Qt::UserRole).toInt();
AddBookmarkDlg dlg(this,QString(),i); AddBookmarkDlg dlg(this,QString(),i);
dlg.exec(); dlg.exec();
item->setText(KpxBookmarks::title(i)); item->setText(KpxBookmarks::title(i));
} }
void ManageBookmarksDlg::OnButtonAdd(){
AddBookmarkDlg dlg(this);
if(dlg.exec()){
int i=dlg.ItemID;
QListWidgetItem* item=new QListWidgetItem(ListWidget);
item->setData(Qt::UserRole,i);
item->setText(KpxBookmarks::title(i));
}
return;
}
void ManageBookmarksDlg::closeEvent(QCloseEvent * event){ void ManageBookmarksDlg::closeEvent(QCloseEvent * event){
QList<int> Order; QList<int> Order;
@ -112,6 +126,6 @@ void ManageBookmarksDlg::closeEvent(QCloseEvent * event){
for(int i=0;i<KpxBookmarks::count();i++){ for(int i=0;i<KpxBookmarks::count();i++){
Order<<ListWidget->item(i)->data(Qt::UserRole).toInt(); Order<<ListWidget->item(i)->data(Qt::UserRole).toInt();
} }
KpxBookmarks::resort(Order); KpxBookmarks::resort(Order);
event->accept(); event->accept();
} }

@ -22,21 +22,26 @@
#include <QDialog> #include <QDialog>
#include <QCloseEvent> #include <QCloseEvent>
#include <QPaintEvent>
#include "ui_ManageBookmarksDlg.h" #include "ui_ManageBookmarksDlg.h"
#include "main.h"
class ManageBookmarksDlg : public QDialog, private Ui::ManageBookmarksDlg class ManageBookmarksDlg : public QDialog, private Ui::ManageBookmarksDlg
{ {
Q_OBJECT Q_OBJECT
public: public:
ManageBookmarksDlg(QWidget* parent=0); ManageBookmarksDlg(QWidget* parent=0);
private: private:
QPixmap BannerPixmap;
virtual void paintEvent(QPaintEvent*);
virtual void closeEvent(QCloseEvent* event); virtual void closeEvent(QCloseEvent* event);
private slots: private slots:
void OnButtonUp(); void OnButtonAdd();
void OnButtonEdit();
void OnButtonDelete();
void OnButtonUp();
void OnButtonDown(); void OnButtonDown();
void OnButtonDelete();
void OnButtonAdd();
void OnButtonEdit();
void edit(QListWidgetItem*); void edit(QListWidgetItem*);
}; };

@ -88,11 +88,49 @@
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label" > <layout class="QHBoxLayout" >
<property name="text" > <item>
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:12pt; font-weight:600;">KeePassX&lt;/span> - Cross Platform Password Manager&lt;/p>&lt;/body>&lt;/html></string> <widget class="QLabel" name="labelAppName" >
</property> <property name="sizePolicy" >
</widget> <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>AppName</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelAppFunc" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text" >
<string>AppFunc</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >

@ -1,18 +1,53 @@
<ui version="4.0" > <ui version="4.0" >
<author>Tarek Saidi</author>
<class>AddBookmarkDlg</class> <class>AddBookmarkDlg</class>
<widget class="QWidget" name="AddBookmarkDlg" > <widget class="QWidget" name="AddBookmarkDlg" >
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>497</width> <width>500</width>
<height>148</height> <height>180</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>500</width>
<height>180</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>500</width>
<height>180</height>
</size>
</property>
<property name="windowTitle" > <property name="windowTitle" >
<string>Add Bookmark</string> <string>Add Bookmark</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
@ -44,6 +79,13 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox" > <widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" > <property name="standardButtons" >
@ -53,6 +95,7 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<includes/>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

@ -285,7 +285,7 @@
</action> </action>
<action name="FileExitAction" > <action name="FileExitAction" >
<property name="text" > <property name="text" >
<string>E&amp;xit</string> <string>Q&amp;uit</string>
</property> </property>
</action> </action>
<action name="EditNewGroupAction" > <action name="EditNewGroupAction" >

@ -5,14 +5,36 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>452</width> <width>280</width>
<height>360</height> <height>360</height>
</rect> </rect>
</property> </property>
<property name="minimumSize" >
<size>
<width>280</width>
<height>300</height>
</size>
</property>
<property name="windowTitle" > <property name="windowTitle" >
<string>Manage Bookmarks</string> <string>Manage Bookmarks</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<item> <item>
@ -21,19 +43,70 @@
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<item> <item>
<widget class="QToolButton" name="Button_Add" /> <widget class="QToolButton" name="Button_Add" >
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="Button_Delete" /> <widget class="QToolButton" name="Button_Edit" >
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="Button_Edit" /> <widget class="QToolButton" name="Button_Delete" >
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="Button_Up" /> <spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="Button_Down" /> <widget class="QToolButton" name="Button_Up" >
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="Button_Down" >
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item> </item>
<item> <item>
<spacer> <spacer>

@ -93,9 +93,9 @@ void test_getAllWindowTitles(){
qDebug("%i %i: %s",i,p,XGetAtomName(pDisplay,atom[p])); qDebug("%i %i: %s",i,p,XGetAtomName(pDisplay,atom[p]));
} }
XFree(atom); XFree(atom);
} }
#endif #endif
} }
int main(int argc, char **_argv) int main(int argc, char **_argv)
@ -138,12 +138,12 @@ int main(int argc, char **_argv)
qWarning("Could not load desktop integration plugin:"); qWarning("Could not load desktop integration plugin:");
qWarning(CSTR(PluginLoadError)); qWarning(CSTR(PluginLoadError));
} }
else{ else{
QObject *plugininstance=plugin.instance(); QObject *plugininstance=plugin.instance();
IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugininstance); IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugininstance);
IconLoader=qobject_cast<IIconTheme*>(plugininstance); IconLoader=qobject_cast<IIconTheme*>(plugininstance);
if(IconLoader==NULL){ if(IconLoader==NULL){
qWarning("Error: Integration Plugin: Could not initialize IconTheme interface."); qWarning("Error: Integration Plugin: Could not initialize IconTheme interface.");
} }
KpxFileDialogs::setPlugin(fdlg); KpxFileDialogs::setPlugin(fdlg);
if(config->integrPlugin()==KpxConfig::KDE){ if(config->integrPlugin()==KpxConfig::KDE){
@ -365,7 +365,7 @@ const QIcon& getIcon(const QString& name){
NewIcon=new QIcon(IconLoader->getIcon(name)); NewIcon=new QIcon(IconLoader->getIcon(name));
if(NewIcon->isNull()){ if(NewIcon->isNull()){
delete NewIcon; delete NewIcon;
NewIcon=NULL; NewIcon=NULL;
} }
else else
IconCache.insert(name,NewIcon); IconCache.insert(name,NewIcon);
@ -379,7 +379,7 @@ const QIcon& getIcon(const QString& name){
} }
NewIcon=new QIcon(AppDir+"/../share/keepass/icons/"+name+".png"); NewIcon=new QIcon(AppDir+"/../share/keepass/icons/"+name+".png");
IconCache.insert(name,NewIcon); IconCache.insert(name,NewIcon);
} }
return *NewIcon; return *NewIcon;
} }
@ -423,7 +423,7 @@ int i=1;
i++; } i++; }
for(i; i<argc;i++){ for(i; i<argc;i++){
if(QString(argv[i])=="-help"){ if(QString(argv[i])=="-help"){
cout << "KeePassX" << KEEPASS_VERSION << endl; cout << "KeePassX" << APP_VERSION << endl;
cout << "Usage: keepass [Filename] [Options]" << endl; cout << "Usage: keepass [Filename] [Options]" << endl;
cout << " -help This Help" << endl; cout << " -help This Help" << endl;
cout << " -cfg <CONFIG> Use specified file for loading/saving the configuration." << endl; cout << " -cfg <CONFIG> Use specified file for loading/saving the configuration." << endl;
@ -485,7 +485,7 @@ QString makePathRelative(const QString& AbsDir,const QString& CurDir){
QString applicationDirPath(){ QString applicationDirPath(){
QString filepath=applicationFilePath(); QString filepath=applicationFilePath();
filepath.truncate(filepath.lastIndexOf("/")); filepath.truncate(filepath.lastIndexOf("/"));
return filepath; return filepath;
} }

@ -16,7 +16,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef _MAIN_H_ #ifndef _MAIN_H_
#define _MAIN_H_ #define _MAIN_H_
@ -27,9 +27,14 @@
#include <QIcon> #include <QIcon>
#include <QFile> #include <QFile>
#define APP_NAME "KeePassX" #define APP_DISPLAY_NAME "KeePassX"
#define APP_FUNC "Password Manager" #define APP_CODE_NAME "keepassx"
#define KEEPASS_VERSION "0.2.3"
#define APP_SHORT_FUNC "Password Manager"
#define APP_LONG_FUNC "Cross Platform Password Manager"
#define APP_VERSION "0.2.3"
#define BUILTIN_ICONS 65 #define BUILTIN_ICONS 65
typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2}; typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2};

@ -115,7 +115,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
} }
HelpBrowser = new QAssistantClient(QString(),this); HelpBrowser = new QAssistantClient(QString(),this);
HelpBrowser->setArguments(QStringList()<< "-profile" << "/home/tarek/Documents/KeePassX/share/keepass/doc/keepassx.adp"); HelpBrowser->setArguments(QStringList()<< "-profile" << "/home/tarek/Documents/KeePassX/share/keepass/doc/keepassx.adp");
createBookmarkActions(); createBookmarkActions();
} }
@ -240,9 +240,9 @@ void KeepassMainWindow::setupIcons(){
HelpHandbookAction->setIcon(getIcon("manual")); HelpHandbookAction->setIcon(getIcon("manual"));
HelpAboutAction->setIcon(getIcon("help")); HelpAboutAction->setIcon(getIcon("help"));
menuBookmarks->menuAction()->setIcon(getIcon("bookmark_folder")); menuBookmarks->menuAction()->setIcon(getIcon("bookmark_folder"));
AddThisAsBookmarkAction->setIcon(getIcon("bookmark")); AddThisAsBookmarkAction->setIcon(getIcon("bookmark_this"));
AddBookmarkAction->setIcon(getIcon("bookmark_add")); AddBookmarkAction->setIcon(getIcon("bookmark_add"));
ManageBookmarksAction->setIcon(getIcon("bookmark_edit")); ManageBookmarksAction->setIcon(getIcon("bookmark"));
SysTray->setIcon(getIcon("keepassx_large")); SysTray->setIcon(getIcon("keepassx_large"));
if(config->showSysTrayIcon()) if(config->showSysTrayIcon())
SysTray->show(); SysTray->show();
@ -294,12 +294,12 @@ void KeepassMainWindow::setupMenus(){
case 28: ViewToolButtonSize28Action->setChecked(true); break; case 28: ViewToolButtonSize28Action->setChecked(true); break;
} }
SysTrayMenu = new QMenu(tr("KeePassX"),this); SysTrayMenu = new QMenu(tr(APP_DISPLAY_NAME),this);
SysTrayMenu->addAction(FileUnLockWorkspaceAction); SysTrayMenu->addAction(FileUnLockWorkspaceAction);
SysTrayMenu->addSeparator(); SysTrayMenu->addSeparator();
SysTrayMenu->addAction(FileExitAction); SysTrayMenu->addAction(FileExitAction);
SysTray->setContextMenu(SysTrayMenu); SysTray->setContextMenu(SysTrayMenu);
SysTray->setToolTip(tr("%1 %2").arg(APP_NAME, APP_FUNC) + " - " + tr((IsLocked) ? "Locked" : "Unlocked")); SysTray->setToolTip(tr("%1 %2").arg(APP_DISPLAY_NAME, APP_SHORT_FUNC) + " - " + tr((IsLocked) ? "Locked" : "Unlocked"));
#define _add_import(name){\ #define _add_import(name){\
QAction* import=new QAction(this);\ QAction* import=new QAction(this);\
@ -323,7 +323,7 @@ void KeepassMainWindow::setupMenus(){
FileOpenAction->setShortcut(tr("Ctrl+O")); FileOpenAction->setShortcut(tr("Ctrl+O"));
FileSaveAction->setShortcut(tr("Ctrl+S")); FileSaveAction->setShortcut(tr("Ctrl+S"));
FileUnLockWorkspaceAction->setShortcut(tr("Ctrl+L")); FileUnLockWorkspaceAction->setShortcut(tr("Ctrl+L"));
FileExitAction->setShortcut(tr("Ctrl+X")); FileExitAction->setShortcut(tr("Ctrl+Q"));
EditNewGroupAction->setShortcut(tr("Ctrl+G")); EditNewGroupAction->setShortcut(tr("Ctrl+G"));
EditPasswordToClipboardAction->setShortcut(tr("Ctrl+C")); EditPasswordToClipboardAction->setShortcut(tr("Ctrl+C"));
EditUsernameToClipboardAction->setShortcut(tr("Ctrl+B")); EditUsernameToClipboardAction->setShortcut(tr("Ctrl+B"));
@ -1011,7 +1011,7 @@ void KeepassMainWindow::OnUnLockWorkspace(){
setCentralWidget(NormalCentralWidget); setCentralWidget(NormalCentralWidget);
NormalCentralWidget->setVisible(true); NormalCentralWidget->setVisible(true);
SysTray->setIcon(getIcon("keepassx_large")); SysTray->setIcon(getIcon("keepassx_large"));
SysTray->setToolTip(tr("%1 %2").arg(APP_NAME, APP_FUNC) + " - " + tr("Unlocked")); SysTray->setToolTip(tr("%1 %2").arg(APP_DISPLAY_NAME, APP_SHORT_FUNC) + " - " + tr("Unlocked"));
FileUnLockWorkspaceAction->setText(tr("&Lock Workspace")); FileUnLockWorkspaceAction->setText(tr("&Lock Workspace"));
IsLocked=false; IsLocked=false;
} else { } else {
@ -1020,7 +1020,7 @@ void KeepassMainWindow::OnUnLockWorkspace(){
setCentralWidget(LockedCentralWidget); setCentralWidget(LockedCentralWidget);
LockedCentralWidget->setVisible(true); LockedCentralWidget->setVisible(true);
SysTray->setIcon(getIcon("keepassx_locked")); SysTray->setIcon(getIcon("keepassx_locked"));
SysTray->setToolTip(tr("%1 %2").arg(APP_NAME, APP_FUNC) + " - " + tr("Locked")); SysTray->setToolTip(tr("%1 %2").arg(APP_DISPLAY_NAME, APP_SHORT_FUNC) + " - " + tr("Locked"));
FileUnLockWorkspaceAction->setText(tr("Un&lock Workspace")); FileUnLockWorkspaceAction->setText(tr("Un&lock Workspace"));
IsLocked=true; IsLocked=true;
} }
@ -1030,38 +1030,38 @@ void KeepassMainWindow::OnBookmarkTriggered(QAction* action){
if(action==AddBookmarkAction){ if(action==AddBookmarkAction){
AddBookmarkDlg dlg(this); AddBookmarkDlg dlg(this);
if(dlg.exec()){ if(dlg.exec()){
int id=dlg.ItemID; int id=dlg.ItemID;
QAction* action=new QAction(this); QAction* action=new QAction(this);
action->setData(id); action->setData(id);
action->setText(KpxBookmarks::title(id)); action->setText(KpxBookmarks::title(id));
action->setIcon(getIcon("document")); action->setIcon(getIcon("document"));
menuBookmarks->addAction(action); menuBookmarks->addAction(action);
} }
return; return;
} }
if(action==ManageBookmarksAction){ if(action==ManageBookmarksAction){
ManageBookmarksDlg dlg(this); ManageBookmarksDlg dlg(this);
dlg.exec(); dlg.exec();
menuBookmarks->clear(); menuBookmarks->clear();
createBookmarkActions(); createBookmarkActions();
return; return;
} }
if(action==AddThisAsBookmarkAction){ if(action==AddThisAsBookmarkAction){
AddBookmarkDlg dlg(this,db->file()->fileName()); AddBookmarkDlg dlg(this,db->file()->fileName());
if(dlg.exec()){ if(dlg.exec()){
int id=dlg.ItemID; int id=dlg.ItemID;
QAction* action=new QAction(this); QAction* action=new QAction(this);
action->setData(id); action->setData(id);
action->setText(KpxBookmarks::title(id)); action->setText(KpxBookmarks::title(id));
action->setIcon(getIcon("document")); action->setIcon(getIcon("document"));
menuBookmarks->addAction(action); menuBookmarks->addAction(action);
} }
return; return;
} }
openDatabase(KpxBookmarks::path(action->data().toInt())); openDatabase(KpxBookmarks::path(action->data().toInt()));
} }
void KeepassMainWindow::createBookmarkActions(){ void KeepassMainWindow::createBookmarkActions(){
@ -1074,6 +1074,6 @@ void KeepassMainWindow::createBookmarkActions(){
action->setData(i); action->setData(i);
action->setText(KpxBookmarks::title(i)); action->setText(KpxBookmarks::title(i));
action->setIcon(getIcon("document")); action->setIcon(getIcon("document"));
menuBookmarks->addAction(action); menuBookmarks->addAction(action);
} }
} }