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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _DATABASE_H_
#define _DATABASE_H_
@ -75,7 +75,7 @@ class KpxDateTime:public QDateTime{
};
//! 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{
public:
CEntry();
@ -97,7 +97,7 @@ public:
};
//! 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{
public:
CGroup();
@ -147,15 +147,16 @@ public:
virtual KpxDateTime expire()=0;
virtual QByteArray binary()=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.
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.
\param index The new visual index.
*/
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!
This function is optimal to avoid readjustion overhead when sorting items.
\param index The new visual index.
@ -170,7 +171,7 @@ public:
};
//! Custom Icon Interface
/*!
/*!
This class provides an interface for the management of custom icons. The implementation is optional and not necessarily needed.
*/
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.
*/
virtual void addIcon(const QPixmap& icon)=0;
/*! 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.
*/
*/
virtual void removeIcon(int index)=0;
/*! 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 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().
*/
void iconsModified();
};
//! 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{
public:
virtual void setTitle(const QString& Title)=0;
virtual void setImage(const quint32& ImageID)=0;
virtual QString title()=0;
virtual quint32 image()=0;
//! \return a pointer to the handle of the parent group or NULL if the group has no parent.
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.
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.
virtual int index()=0;
/*! 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.
\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;
/*! 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.*/
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. */
virtual int level()=0;
virtual bool expanded()=0;
virtual void setExpanded(bool)=0;
@ -240,7 +241,7 @@ public:
//! 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{
public:
@ -254,9 +255,9 @@ public:
virtual bool load(QString identifier)=0;
//! 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.
*/
*/
virtual bool save()=0;
//! Closes the current database.
@ -264,33 +265,33 @@ public:
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.
* \return TRUE if closing was successfull, otherwise FALSE.
*/
*/
virtual bool close()=0;
//! Creates a new database.
/*! It is not allowed to call this function if a database is already loaded.
\return TRUE if saving was successfull, otherwise FALSE.
*/
*/
virtual void create()=0;
virtual bool changeFile(const QString& filename)=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.
virtual QList<IEntryHandle*> entries()=0;
//! \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<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.
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.
virtual QList<IGroupHandle*> groups()=0;
/*!
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.*/
@ -298,7 +299,7 @@ public:
/*! \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.
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.
*/
virtual void deleteEntry(IEntryHandle* entry)=0;
/*! 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.*/
virtual void deleteLastEntry()=0;
/*! Deletes multiple given entries.
Calling this function can be faster then calling deleteEntry(..) several times - depending on the implementation.
Important: All entries must belong to the same group!
@ -328,7 +329,7 @@ public:
/*! Creates a new blank entry.
\param Group The group to which the entry should be added.
\return the handle of the new entry.
*/
*/
virtual IEntryHandle* newEntry(IGroupHandle* Group)=0;
/*! Adds a Entry object to the database.
@ -337,7 +338,7 @@ public:
\return a pointer to the handle of the added entry.
*/
virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* Group)=0;
/*! Moves an entry to another group.
\param entry The entry which should be moved.
\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.
\param group The group which should be deleted.*/
virtual void deleteGroup(IGroupHandle* group)=0;
/*! Adds a group to the database.
\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.
\return a pointer to the handle of the added group.*/
virtual IGroupHandle* addGroup(const CGroup* Group,IGroupHandle* Parent)=0;
/*! Moves a group.
\param Group The group which should be moved.
\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.*/
virtual void moveGroup(IGroupHandle* Group,IGroupHandle* NewParent,int Position)=0;
/*! Checks two given groups if one is the parent of the other.
\param Child The child group.
\param Parent The parent group.
\return TRUE if Parent is the parent of child, otherwise FALSE.*/
virtual bool isParent(IGroupHandle* parent, IGroupHandle* child)=0;
/*! \param index Index 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.
Make sure that there are no pointers to those handles which are still in use before calling this function.*/
virtual void cleanUpHandles()=0;
/*! \return the number of groups in the database.*/
virtual int numGroups()=0;
/*! \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. */
virtual int builtinIcons()=0;
/*! 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 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.
@ -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.
\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;
//! Moves an entry to the recycle bin.
virtual void moveToTrash(IEntryHandle* entry)=0;
//! \returns all entries of the recycle bin.
virtual QList<IEntryHandle*> trashEntries()=0;
//! Empty the recycle bin.
virtual void emptyTrash()=0;
};
@ -430,7 +431,7 @@ class IKdbSettings{
virtual void setCryptAlgorithm(CryptAlgorithm algo)=0;
virtual CryptAlgorithm cryptAlgorithm()=0;
virtual unsigned int keyTransfRounds()=0;
virtual void setKeyTransfRounds(unsigned int rounds)=0;
virtual void setKeyTransfRounds(unsigned int rounds)=0;
};
#endif

@ -843,7 +843,7 @@ QList<IEntryHandle*> Kdb3Database::entries(IGroupHandle* group){
handles.append(&EntryHandles[i]);
}
qSort(handles.begin(),handles.end(),EntryHandleLessThan);
return handles;
}
@ -962,6 +962,43 @@ 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();}
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;}
void Kdb3Database::EntryHandle::setVisualIndexDirectly(int i){Entry->Index=i;}
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){
StdGroup* Parent;
StdGroup* Parent;
StdGroup* Group=((GroupHandle*)groupHandle)->Group;
if(NewParent)
Parent=((GroupHandle*)NewParent)->Group;
@ -1686,7 +1723,7 @@ void Kdb3Database::moveToTrash(IEntryHandle* entry){
TrashEntries.append(trash);
TrashHandles.append(EntryHandle(this));
TrashHandles.back().Entry=&TrashEntries.back();
TrashEntries.back().Handle=&TrashHandles.back();
TrashEntries.back().Handle=&TrashHandles.back();
}
void Kdb3Database::emptyTrash(){

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

@ -18,20 +18,20 @@
***************************************************************************/
#include <qmessagebox.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qfile.h>
#include <QPainter>
#include "main.h"
#include "AboutDlg.h"
AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
{
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();
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");
if(TrActive){
AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR"));
@ -51,9 +51,9 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
str+="<br>";
str+="<u>"+tr("Eugen Gorschenin")+"</u><br>"+tr("Web Designer")+"<br>"+tr("geugen@users.sf.de")+"<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+="<b>"+tr("Thanks To")+"</b>";
str+="<b>"+tr("Thanks To")+"</b><br>";
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+="<br>";

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

@ -18,10 +18,13 @@
***************************************************************************/
#include <QFileInfo>
#include "AddBookmarkDlg.h"
#include <QPainter>
#include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
#include "AddBookmarkDlg.h"
AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _ItemID):QDialog(parent)
{
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::Cancel),SIGNAL(clicked()),this,SLOT(reject()));
if(ItemID==-1){
createBanner(&BannerPixmap,getPixmap("bookmark_add"),tr("Add Bookmark"),width());
if(DefaultFilename==QString())
OnButtonBrowse();
else
Edit_Filename->setText(DefaultFilename);
}
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));
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(){
QString path=KpxFileDialogs::openExistingFile(this,"AddBookmarkDlg", tr("Add Bookmark"),
QStringList() << tr("KeePass Databases (*.kdb)") << tr("All Files (*)"));
@ -54,5 +68,5 @@ void AddBookmarkDlg::OnButtonOk(){
ItemID=KpxBookmarks::add(Edit_Title->text(),Edit_Filename->text());
else
KpxBookmarks::edit(Edit_Title->text(),Edit_Filename->text(),ItemID);
accept();
accept();
}

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

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

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

@ -131,16 +131,9 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
ButtonDeleteAttachment->setDisabled(true);
Label_AttachmentSize->setText("");
}
else{
QString unit;
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);
}
else
Label_AttachmentSize->setText(entry->friendlySize());
if(entry->expire()==Date_Never){
DateTime_Expire->setDisabled(true);
CheckBox_ExpiresNever->setChecked(true);
@ -344,36 +337,7 @@ void CEditEntryDlg::OnNewAttachment()
QFileInfo info(filename);
entry->setBinaryDesc(info.fileName());
Edit_Attachment->setText(entry->binaryDesc());
QString unit;
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);
Label_AttachmentSize->setText(entry->friendlySize());
ButtonOpenAttachment->setEnabled(true);
ButtonSaveAttachment->setEnabled(true);
ButtonDeleteAttachment->setEnabled(true);

@ -18,7 +18,7 @@
***************************************************************************/
#include <QListWidget>
#include "main.h"
#include <QPainter>
#include "ManageBookmarksDlg.h"
#include "lib/bookmarks.h"
#include "dialogs/AddBookmarkDlg.h"
@ -26,24 +26,65 @@
ManageBookmarksDlg::ManageBookmarksDlg(QWidget* parent):QDialog(parent)
{
setupUi(this);
createBanner(&BannerPixmap,getPixmap("bookmark"),tr("Manage Bookmarks"),width());
for(int i=0;i<KpxBookmarks::count();i++){
QListWidgetItem* item=new QListWidgetItem(ListWidget);
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_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(buttonBox->button(QDialogButtonBox::Close),SIGNAL(clicked()),this,SLOT(close()));
Button_Up->setIcon(getIcon("up"));
Button_Down->setIcon(getIcon("down"));
Button_Delete->setIcon(getIcon("delete"));
Button_Add->setIcon(getIcon("bookmark_add"));
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->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){
int i=item->data(Qt::UserRole).toInt();
AddBookmarkDlg dlg(this,QString(),i);
dlg.exec();
item->setText(KpxBookmarks::title(i));
dlg.exec();
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){
QList<int> Order;
@ -112,6 +126,6 @@ void ManageBookmarksDlg::closeEvent(QCloseEvent * event){
for(int i=0;i<KpxBookmarks::count();i++){
Order<<ListWidget->item(i)->data(Qt::UserRole).toInt();
}
KpxBookmarks::resort(Order);
KpxBookmarks::resort(Order);
event->accept();
}

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

@ -88,11 +88,49 @@
<number>9</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<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>
</property>
</widget>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="labelAppName" >
<property name="sizePolicy" >
<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>
<layout class="QHBoxLayout" >

@ -1,18 +1,53 @@
<ui version="4.0" >
<author>Tarek Saidi</author>
<class>AddBookmarkDlg</class>
<widget class="QWidget" name="AddBookmarkDlg" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>497</width>
<height>148</height>
<width>500</width>
<height>180</height>
</rect>
</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" >
<string>Add Bookmark</string>
</property>
<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>
<layout class="QGridLayout" >
<item row="0" column="0" >
@ -44,6 +79,13 @@
</item>
</layout>
</item>
<item>
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" >
@ -53,6 +95,7 @@
</item>
</layout>
</widget>
<includes/>
<resources/>
<connections/>
</ui>

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

@ -5,14 +5,36 @@
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<width>280</width>
<height>360</height>
</rect>
</property>
<property name="minimumSize" >
<size>
<width>280</width>
<height>300</height>
</size>
</property>
<property name="windowTitle" >
<string>Manage Bookmarks</string>
</property>
<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>
<layout class="QHBoxLayout" >
<item>
@ -21,19 +43,70 @@
<item>
<layout class="QVBoxLayout" >
<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>
<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>
<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>
<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>
<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>
<spacer>

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

@ -16,7 +16,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _MAIN_H_
#define _MAIN_H_
@ -27,9 +27,14 @@
#include <QIcon>
#include <QFile>
#define APP_NAME "KeePassX"
#define APP_FUNC "Password Manager"
#define KEEPASS_VERSION "0.2.3"
#define APP_DISPLAY_NAME "KeePassX"
#define APP_CODE_NAME "keepassx"
#define APP_SHORT_FUNC "Password Manager"
#define APP_LONG_FUNC "Cross Platform Password Manager"
#define APP_VERSION "0.2.3"
#define BUILTIN_ICONS 65
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->setArguments(QStringList()<< "-profile" << "/home/tarek/Documents/KeePassX/share/keepass/doc/keepassx.adp");
createBookmarkActions();
}
@ -240,9 +240,9 @@ void KeepassMainWindow::setupIcons(){
HelpHandbookAction->setIcon(getIcon("manual"));
HelpAboutAction->setIcon(getIcon("help"));
menuBookmarks->menuAction()->setIcon(getIcon("bookmark_folder"));
AddThisAsBookmarkAction->setIcon(getIcon("bookmark"));
AddThisAsBookmarkAction->setIcon(getIcon("bookmark_this"));
AddBookmarkAction->setIcon(getIcon("bookmark_add"));
ManageBookmarksAction->setIcon(getIcon("bookmark_edit"));
ManageBookmarksAction->setIcon(getIcon("bookmark"));
SysTray->setIcon(getIcon("keepassx_large"));
if(config->showSysTrayIcon())
SysTray->show();
@ -294,12 +294,12 @@ void KeepassMainWindow::setupMenus(){
case 28: ViewToolButtonSize28Action->setChecked(true); break;
}
SysTrayMenu = new QMenu(tr("KeePassX"),this);
SysTrayMenu = new QMenu(tr(APP_DISPLAY_NAME),this);
SysTrayMenu->addAction(FileUnLockWorkspaceAction);
SysTrayMenu->addSeparator();
SysTrayMenu->addAction(FileExitAction);
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){\
QAction* import=new QAction(this);\
@ -323,7 +323,7 @@ void KeepassMainWindow::setupMenus(){
FileOpenAction->setShortcut(tr("Ctrl+O"));
FileSaveAction->setShortcut(tr("Ctrl+S"));
FileUnLockWorkspaceAction->setShortcut(tr("Ctrl+L"));
FileExitAction->setShortcut(tr("Ctrl+X"));
FileExitAction->setShortcut(tr("Ctrl+Q"));
EditNewGroupAction->setShortcut(tr("Ctrl+G"));
EditPasswordToClipboardAction->setShortcut(tr("Ctrl+C"));
EditUsernameToClipboardAction->setShortcut(tr("Ctrl+B"));
@ -1011,7 +1011,7 @@ void KeepassMainWindow::OnUnLockWorkspace(){
setCentralWidget(NormalCentralWidget);
NormalCentralWidget->setVisible(true);
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"));
IsLocked=false;
} else {
@ -1020,7 +1020,7 @@ void KeepassMainWindow::OnUnLockWorkspace(){
setCentralWidget(LockedCentralWidget);
LockedCentralWidget->setVisible(true);
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"));
IsLocked=true;
}
@ -1030,38 +1030,38 @@ void KeepassMainWindow::OnBookmarkTriggered(QAction* action){
if(action==AddBookmarkAction){
AddBookmarkDlg dlg(this);
if(dlg.exec()){
int id=dlg.ItemID;
int id=dlg.ItemID;
QAction* action=new QAction(this);
action->setData(id);
action->setText(KpxBookmarks::title(id));
action->setIcon(getIcon("document"));
menuBookmarks->addAction(action);
menuBookmarks->addAction(action);
}
return;
}
if(action==ManageBookmarksAction){
ManageBookmarksDlg dlg(this);
dlg.exec();
menuBookmarks->clear();
createBookmarkActions();
return;
return;
}
if(action==AddThisAsBookmarkAction){
AddBookmarkDlg dlg(this,db->file()->fileName());
if(dlg.exec()){
int id=dlg.ItemID;
int id=dlg.ItemID;
QAction* action=new QAction(this);
action->setData(id);
action->setText(KpxBookmarks::title(id));
action->setIcon(getIcon("document"));
menuBookmarks->addAction(action);
}
menuBookmarks->addAction(action);
}
return;
}
}
openDatabase(KpxBookmarks::path(action->data().toInt()));
}
void KeepassMainWindow::createBookmarkActions(){
@ -1074,6 +1074,6 @@ void KeepassMainWindow::createBookmarkActions(){
action->setData(i);
action->setText(KpxBookmarks::title(i));
action->setIcon(getIcon("document"));
menuBookmarks->addAction(action);
}
menuBookmarks->addAction(action);
}
}