git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@146 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 18 years ago
parent 13c5615698
commit 65e5da4649
  1. BIN
      share/keepass/icons/bookmark.png
  2. BIN
      share/keepass/icons/bookmark_add.png
  3. BIN
      share/keepass/icons/bookmark_edit.png
  4. BIN
      share/keepass/icons/bookmark_folder.png
  5. BIN
      share/keepass/icons/document.png
  6. BIN
      share/keepass/icons/down.png
  7. BIN
      share/keepass/icons/up.png
  8. 5
      src/Kdb3Database.cpp
  9. 4
      src/KpxConfig.h
  10. 1
      src/crypto/arcfour.cpp
  11. 11
      src/dialogs/AboutDlg.cpp
  12. 58
      src/dialogs/AddBookmarkDlg.cpp
  13. 41
      src/dialogs/AddBookmarkDlg.h
  14. 17
      src/dialogs/EditEntryDlg.cpp
  15. 117
      src/dialogs/ManageBookmarksDlg.cpp
  16. 44
      src/dialogs/ManageBookmarksDlg.h
  17. 85
      src/dialogs/PasswordDlg.cpp
  18. 9
      src/dialogs/PasswordDlg.h
  19. 7
      src/dialogs/SettingsDlg.cpp
  20. 113
      src/forms/AboutDlg.ui
  21. 58
      src/forms/AddBookmarkDlg.ui
  22. 21
      src/forms/MainWindow.ui
  23. 69
      src/forms/ManageBookmarksDlg.ui
  24. 538
      src/forms/PasswordDlg.ui
  25. 2
      src/forms/SettingsDlg.ui
  26. 1
      src/lib/EntryView.cpp
  27. 127
      src/lib/bookmarks.cpp
  28. 49
      src/lib/bookmarks.h
  29. 2
      src/main.cpp
  30. 96
      src/mainwindow.cpp
  31. 2
      src/mainwindow.h
  32. 27
      src/src.pro

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -103,7 +103,7 @@ int Kdb3Database::numIcons(){
bool Kdb3Database::parseMetaStream(const StdEntry& entry){ bool Kdb3Database::parseMetaStream(const StdEntry& entry){
qDebug("%s",entry.Comment.toUtf8().data()); qDebug("Found Metastream: %s",entry.Comment.toUtf8().data());
if(entry.Comment=="KPX_GROUP_TREE_STATE"){ if(entry.Comment=="KPX_GROUP_TREE_STATE"){
parseGroupTreeStateMetaStream(entry.Binary); parseGroupTreeStateMetaStream(entry.Binary);
@ -843,8 +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);
foreach(IEntryHandle* h,handles){qDebug("+ %s (%i)",h->title().toUtf8().data(),(int)h->isValid());}
return handles; return handles;
} }

@ -56,7 +56,6 @@ public:
QBitArray columns(){return stringToBitArray(settings.value("UI/Columns","11111000000").toString(),11);} QBitArray columns(){return stringToBitArray(settings.value("UI/Columns","11111000000").toString(),11);}
QList<int> columnOrder(){return stringToIntArray(settings.value("UI/ColumnOrder","100,100,100,100,100,100,100,100,100,100,100").toString(),11);} QList<int> columnOrder(){return stringToIntArray(settings.value("UI/ColumnOrder","100,100,100,100,100,100,100,100,100,100,100").toString(),11);}
QList<int> columnSizes(){return stringToIntArray(settings.value("UI/ColumnSizes","15,10,10,10,10,10,10,10,10,10,10").toString(),11);} QList<int> columnSizes(){return stringToIntArray(settings.value("UI/ColumnSizes","15,10,10,10,10,10,10,10,10,10,10").toString(),11);}
bool enableBookmarkMenu(){return settings.value("Options/EnableBookmarkMenu",true).toBool();}
QStringList fileDlgHistory(unsigned index){return settings.value(QString("FileDlgHistory/ENTRY%1").arg(index)).toStringList();} QStringList fileDlgHistory(unsigned index){return settings.value(QString("FileDlgHistory/ENTRY%1").arg(index)).toStringList();}
GrpTreeState groupTreeState(){return stringToGrpTreeState(settings.value("Options/GroupTreeState").toString());} GrpTreeState groupTreeState(){return stringToGrpTreeState(settings.value("Options/GroupTreeState").toString());}
bool hidePasswords(){return settings.value("UI/HidePasswords",true).toBool();} bool hidePasswords(){return settings.value("UI/HidePasswords",true).toBool();}
@ -90,6 +89,7 @@ public:
bool askBeforeDelete(){return settings.value("Options/AskBeforeDelete",true).toBool();} bool askBeforeDelete(){return settings.value("Options/AskBeforeDelete",true).toBool();}
int autoTypePreGap(){return settings.value("Options/AutoTypePreGap",500).toInt();} int autoTypePreGap(){return settings.value("Options/AutoTypePreGap",500).toInt();}
int autoTypeKeyStrokeDelay(){return settings.value("Options/AutoTypeKeyStrokeDelay",0).toInt();} int autoTypeKeyStrokeDelay(){return settings.value("Options/AutoTypeKeyStrokeDelay",0).toInt();}
bool featureBookmarks(){return settings.value("Features/Bookmarks",true).toBool();}
void setAlternatingRowColors(bool value){settings.setValue("Options/AlternatingRowColors",value);} void setAlternatingRowColors(bool value){settings.setValue("Options/AlternatingRowColors",value);}
void setBannerColor1(const QColor& value){settings.setValue("Options/BannerColor1",colorToString(value));} void setBannerColor1(const QColor& value){settings.setValue("Options/BannerColor1",colorToString(value));}
@ -99,7 +99,6 @@ public:
void setColumns(const QBitArray& value){settings.setValue("UI/Columns",bitArrayToString(value));} void setColumns(const QBitArray& value){settings.setValue("UI/Columns",bitArrayToString(value));}
void setColumnOrder(const QList<int>& value){settings.setValue("UI/ColumnOrder",intArrayToString(value));} void setColumnOrder(const QList<int>& value){settings.setValue("UI/ColumnOrder",intArrayToString(value));}
void setColumnSizes(const QList<int>& value){settings.setValue("UI/ColumnSizes",intArrayToString(value));} void setColumnSizes(const QList<int>& value){settings.setValue("UI/ColumnSizes",intArrayToString(value));}
void setEnableBookmarkMenu(bool value){settings.setValue("Options/EnableBookmarkMenu",value);}
void setFileDlgHistory(unsigned index,const QStringList& value){settings.setValue(QString("FileDlgHistory/ENTRY%1").arg(index), value);} void setFileDlgHistory(unsigned index,const QStringList& value){settings.setValue(QString("FileDlgHistory/ENTRY%1").arg(index), value);}
void setGroupTreeState(GrpTreeState value){settings.setValue("Options/GroupTreeState",grpTreeStateToString(value));} void setGroupTreeState(GrpTreeState value){settings.setValue("Options/GroupTreeState",grpTreeStateToString(value));}
void setHidePasswords(bool value){settings.setValue("UI/HidePasswords",value);} void setHidePasswords(bool value){settings.setValue("UI/HidePasswords",value);}
@ -133,6 +132,7 @@ public:
void setAskBeforeDelete(bool value){settings.setValue("Options/AskBeforeDelete",value);} void setAskBeforeDelete(bool value){settings.setValue("Options/AskBeforeDelete",value);}
void setAutoTypePreGap(int value){settings.setValue("Options/AutoTypePreGap",value);} void setAutoTypePreGap(int value){settings.setValue("Options/AutoTypePreGap",value);}
void setAutoTypeKeyStrokeDelay(int value){settings.setValue("Options/AutoTypeKeyStrokeDelay",value);} void setAutoTypeKeyStrokeDelay(int value){settings.setValue("Options/AutoTypeKeyStrokeDelay",value);}
void setFeatureBookmarks(bool value){settings.setValue("Features/Bookmarks",value);}
unsigned fileDlgHistorySize(); unsigned fileDlgHistorySize();
void clearFileDlgHistory(){settings.remove("FileDlgHistory");}; void clearFileDlgHistory(){settings.remove("FileDlgHistory");};

@ -58,7 +58,6 @@ void CArcFour::prepareKey(){
} }
void CArcFour::encrypt(const byte* src, byte* dst,int length){ void CArcFour::encrypt(const byte* src, byte* dst,int length){
//qDebug("Key:%s",RawKey.data());
prepareKey(); prepareKey();
unsigned char x; unsigned char x;
unsigned char y; unsigned char y;

@ -1,11 +1,10 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2005-2006 by Tarek Saidi * * Copyright (C) 2005-2007 by Tarek Saidi *
* tarek.saidi@arcor.de * * tarek.saidi@arcor.de *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. * * the Free Software Foundation; version 2 of the License. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
@ -48,18 +47,18 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
QString str; QString str;
str+="<b>"+tr("Team")+"</b><br>"; str+="<b>"+tr("Team")+"</b><br>";
str+="<div style='margin-left:10px;'>"; str+="<div style='margin-left:10px;'>";
str+="<u>"+tr("Tarek Saidi")+"</u><br>"+tr("Developer, Project Admin")+"<br>"+tr("tariq@users.berlios.de")+"<br>"; str+="<u>"+tr("Tarek Saidi")+"</u><br>"+tr("Developer, Project Admin")+"<br>"+tr("tarek_saidi@users.sf.net")+"<br>";
str+="<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("Eugen Gorschenin")+"</u><br>"+tr("Web Designer")+"<br>"+tr("geugen@users.berlios.de")+"<br>"; str+="<u>"+tr("Jota Jota")+"</u><br>"+tr("Developer")+"<br>"+tr("myxself@users.sf.de")+"<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>";
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>";
str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("James Nicholls")+"</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br></div>"; str+="<u>"+tr("James Nicholls")+"</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br></div>";
str+="<br>"; str+="<br>";
str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("Constantin Makshin")+"</u><br>"+tr("Various fixes and improvements")+"<br>"+tr("dinosaur-rus@users.sourceforge.net")+"<br></div>"; str+="<u>"+tr("Constantin Makshin")+"</u><br>"+tr("Various fixes and improvements")+"<br>"+tr("dinosaur-rus@users.sourceforge.net")+"<br></div>";
Edit_Thanks->setHtml(str); Edit_Thanks->setHtml(str);
} }

@ -0,0 +1,58 @@
/***************************************************************************
* Copyright (C) 2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QFileInfo>
#include "AddBookmarkDlg.h"
#include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _ItemID):QDialog(parent)
{
setupUi(this);
ItemID=_ItemID;
connect(Button_Browse,SIGNAL(clicked()),this,SLOT(OnButtonBrowse()));
connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnButtonOk()));
connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(reject()));
if(ItemID==-1){
if(DefaultFilename==QString())
OnButtonBrowse();
else
Edit_Filename->setText(DefaultFilename);
}
else {
Edit_Title->setText(KpxBookmarks::title(ItemID));
Edit_Filename->setText(KpxBookmarks::path(ItemID));
setWindowTitle(tr("Edit Bookmark"));
}
}
void AddBookmarkDlg::OnButtonBrowse(){
QString path=KpxFileDialogs::openExistingFile(this,"AddBookmarkDlg", tr("Add Bookmark"),
QStringList() << tr("KeePass Databases (*.kdb)") << tr("All Files (*)"));
if(path!=QString())
Edit_Filename->setText(path);
}
void AddBookmarkDlg::OnButtonOk(){
if(ItemID==-1)
ItemID=KpxBookmarks::add(Edit_Title->text(),Edit_Filename->text());
else
KpxBookmarks::edit(Edit_Title->text(),Edit_Filename->text(),ItemID);
accept();
}

@ -0,0 +1,41 @@
/***************************************************************************
* Copyright (C) 2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _ADDBOOKMARKDLG_H_
#define _ADDBOOKMARKDLG_H_
#include <QDialog>
#include "ui_AddBookmarkDlg.h"
class AddBookmarkDlg : public QDialog, private Ui::AddBookmarkDlg
{
Q_OBJECT
public:
AddBookmarkDlg (QWidget* parent=0, QString DefaultFilename=QString(), int ItemID=-1);
int ItemID;
private slots:
void OnButtonOk();
void OnButtonBrowse();
};
#endif

@ -37,6 +37,7 @@
#include <qtoolbutton.h> #include <qtoolbutton.h>
#include <QShowEvent> #include <QShowEvent>
#include <QResizeEvent> #include <QResizeEvent>
#include <math.h>
#include "SelectIconDlg.h" #include "SelectIconDlg.h"
#include "PasswordGenDlg.h" #include "PasswordGenDlg.h"
@ -348,27 +349,27 @@ void CEditEntryDlg::OnNewAttachment()
int prec; int prec;
if (entry->binarySize() < 1024) if (entry->binarySize() < 1024)
{ {
unit = "Bytes"; unit = tr("Bytes");
faktor = 1; faktor = 1;
prec = 0; prec = 0;
} }
else else
{ {
if (entry->binarySize() < 1048576) if (entry->binarySize() < pow(2,20))
{ {
unit = "kB"; unit = tr("kiB");
faktor = 1024; faktor = 1024;
} }
else else
if (entry->binarySize() < 1073741824) if (entry->binarySize() < pow(2,30))
{ {
unit = "MB"; unit = tr("MiB");
faktor = 1048576; faktor = pow(2,20);
} }
else else
{ {
unit = "GB"; unit = tr("GiB");
faktor = 1073741824; faktor = pow(2,30);
} }
prec = 1; prec = 1;
} }

@ -0,0 +1,117 @@
/***************************************************************************
* Copyright (C) 2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QListWidget>
#include "main.h"
#include "ManageBookmarksDlg.h"
#include "lib/bookmarks.h"
#include "dialogs/AddBookmarkDlg.h"
ManageBookmarksDlg::ManageBookmarksDlg(QWidget* parent):QDialog(parent)
{
setupUi(this);
for(int i=0;i<KpxBookmarks::count();i++){
QListWidgetItem* item=new QListWidgetItem(ListWidget);
item->setData(Qt::UserRole,i);
item->setText(KpxBookmarks::title(i));
}
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_Edit->setIcon(getIcon("bookmark_edit"));
Button_Add->setIcon(getIcon("bookmark_add"));
}
void ManageBookmarksDlg::OnButtonUp(){
int row=ListWidget->currentRow();
QListWidgetItem* item=ListWidget->currentItem();
if(row==-1 || !item || row==0)return;
ListWidget->takeItem(row);
row--;
ListWidget->insertItem(row,item);
ListWidget->setCurrentRow(row);
}
void ManageBookmarksDlg::OnButtonDown(){
int row=ListWidget->currentRow();
QListWidgetItem* item=ListWidget->currentItem();
if(row==-1 || !item || row==ListWidget->count()-1)return;
ListWidget->takeItem(row);
row++;
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));
}
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;
// Creating a list with the new indices
// Order[OldIndex]==NewIndex
for(int i=0;i<KpxBookmarks::count();i++){
Order<<ListWidget->item(i)->data(Qt::UserRole).toInt();
}
KpxBookmarks::resort(Order);
event->accept();
}

@ -0,0 +1,44 @@
/***************************************************************************
* Copyright (C) 2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef MANAGEBOOKMARKSDLG_H
#define MANAGEBOOKMARKSDLG_H
#include <QDialog>
#include <QCloseEvent>
#include "ui_ManageBookmarksDlg.h"
class ManageBookmarksDlg : public QDialog, private Ui::ManageBookmarksDlg
{
Q_OBJECT
public:
ManageBookmarksDlg(QWidget* parent=0);
private:
virtual void closeEvent(QCloseEvent* event);
private slots:
void OnButtonUp();
void OnButtonDown();
void OnButtonDelete();
void OnButtonAdd();
void OnButtonEdit();
void edit(QListWidgetItem*);
};
#endif

@ -1,11 +1,10 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2005-2006 by Tarek Saidi * * Copyright (C) 2005-2007 by Tarek Saidi *
* tarek.saidi@arcor.de * * tarek.saidi@arcor.de *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. * * the Free Software Foundation; version 2 of the License. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
@ -27,26 +26,31 @@
#include <QPushButton> #include <QPushButton>
#include <QMessageBox> #include <QMessageBox>
#include <QStringList> #include <QStringList>
#include <QPainter>
#include <QPalette>
#include <QMenu>
#include "main.h" #include "main.h"
#include "KpxConfig.h" #include "KpxConfig.h"
#include "PasswordDlg.h" #include "PasswordDlg.h"
#include "lib/FileDialogs.h" #include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButton,bool ChangeKeyMode) CPasswordDialog::CPasswordDialog(QWidget* parent,QString filename,IDatabase* DB,bool IsAuto,bool ChangeKeyMode)
: QDialog(parent) : QDialog(parent)
{ {
setupUi(this); setupUi(this);
createBanner(Banner,getPixmap("key"),tr("Database Key")); createBanner(&BannerPixmap,getPixmap("key"),tr("Database Key"),width());
Button_Bookmarks->setIcon(getIcon("bookmark"));
db=DB; db=DB;
LastFile=filename;
setWindowTitle(LastFile);
QString mountDir=config->mountDir(); QString mountDir=config->mountDir();
QDir media(mountDir); QDir media(mountDir);
if(media.exists()){ if(media.exists()){
QStringList Paths; QStringList Paths;
Paths=media.entryList(QStringList()<<"*",QDir::Dirs); Paths=media.entryList(QStringList()<<"*",QDir::Dirs | QDir::NoDotAndDotDot);
Paths.erase(Paths.begin()); // delete "."
Paths.erase(Paths.begin()); // delete ".."
for(int i=0;i<Paths.count();i++) for(int i=0;i<Paths.count();i++)
Combo_Dirs->addItem(mountDir+Paths[i]); Combo_Dirs->addItem(mountDir+Paths[i]);
} }
@ -66,17 +70,47 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
} }
// if(LastKeyType==Password){... is not required because it is already the default state. // if(LastKeyType==Password){... is not required because it is already the default state.
} }
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&))); // Bookmarks //
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) ); QPalette palette=Button_Bookmarks->palette();
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) ); palette.setColor(QPalette::Active,QPalette::Button,config->bannerColor1());
connect( CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBox_BothChanged(int) ) ); palette.setColor(QPalette::Active,QPalette::Window,config->bannerColor2());
connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoModeDatabaseKey() ) ); Button_Bookmarks->setPalette(palette);
connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) ); palette=Label_Bookmark->palette();
connect( Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) ); palette.setColor(QPalette::Active,QPalette::WindowText,config->bannerTextColor());
connect( ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit())); Label_Bookmark->setPalette(palette);
ButtonExit->setVisible(ShowExitButton); QMenu* BookmarkMenu=new QMenu(this);
QAction* action=new QAction(this);
action->setData(QString());
action->setText(tr("Last File"));
action->setIcon(getIcon("document"));
BookmarkMenu->addAction(action);
BookmarkMenu->addSeparator();
for(int i=0;i<KpxBookmarks::count();i++){
QAction* action=new QAction(this);
action->setData(KpxBookmarks::path(i));
action->setText(KpxBookmarks::title(i));
action->setIcon(getIcon("document"));
BookmarkMenu->addAction(action);
}
Button_Bookmarks->setMenu(BookmarkMenu);
if(!IsAuto || !config->featureBookmarks()){
Button_Bookmarks->hide();
Label_Bookmark->hide();
}
connect(Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
connect(ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
connect(Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
connect(CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBox_BothChanged(int) ) );
connect(ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoModeDatabaseKey() ) );
connect(Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
connect(Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
connect(ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit()));
connect(BookmarkMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnBookmarkTriggered(QAction*)));
ButtonExit->setVisible(IsAuto);
Mode_Set=ChangeKeyMode; Mode_Set=ChangeKeyMode;
if(!ChangeKeyMode){ if(!ChangeKeyMode){
Edit_PasswordRep->hide(); Edit_PasswordRep->hide();
@ -342,3 +376,18 @@ void CPasswordDialog::OnButtonExit(){
done(2); done(2);
} }
void CPasswordDialog::paintEvent(QPaintEvent* event){
QDialog::paintEvent(event);
QPainter painter(this);
painter.setClipRegion(event->region());
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void CPasswordDialog::OnBookmarkTriggered(QAction* action){
BookmarkFilename=action->data().toString();
if(action->data().toString()==QString())
setWindowTitle(LastFile);
else
setWindowTitle(action->data().toString());
Label_Bookmark->setText(action->text());
}

@ -23,6 +23,8 @@
#include "main.h" #include "main.h"
#include "lib/UrlLabel.h" #include "lib/UrlLabel.h"
#include "Database.h" #include "Database.h"
#include <QPixmap>
#include <QPaintEvent>
class CPasswordDialog : public QDialog, public Ui_PasswordDlg class CPasswordDialog : public QDialog, public Ui_PasswordDlg
@ -32,17 +34,21 @@ class CPasswordDialog : public QDialog, public Ui_PasswordDlg
private: private:
bool Mode_Set; //true = Set, false = Get bool Mode_Set; //true = Set, false = Get
IDatabase* db; IDatabase* db;
QPixmap BannerPixmap;
void setStatePasswordOnly(); void setStatePasswordOnly();
void setStateKeyFileOnly(); void setStateKeyFileOnly();
void setStateBoth(); void setStateBoth();
bool doAuth(); bool doAuth();
virtual void paintEvent(QPaintEvent*);
QString LastFile;
public: public:
QString keyfile; QString keyfile;
QString password; QString password;
QString BookmarkFilename;
tKeyType KeyType; tKeyType KeyType;
bool OverwriteKeyFile; bool OverwriteKeyFile;
CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButton = false, bool KeyMode_Set=false); CPasswordDialog(QWidget* parent,QString filename,IDatabase* DB,bool ShowExitButton = false, bool KeyMode_Set=false);
public slots: public slots:
void OnOK(); void OnOK();
@ -55,6 +61,7 @@ class CPasswordDialog : public QDialog, public Ui_PasswordDlg
void OnCheckBox_BothChanged(int state); void OnCheckBox_BothChanged(int state);
void ChangeEchoModeDatabaseKey(); void ChangeEchoModeDatabaseKey();
void OnComboTextChanged(const QString&); void OnComboTextChanged(const QString&);
void OnBookmarkTriggered(QAction* action);
}; };
#endif #endif

@ -103,6 +103,9 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
SpinBox_ClipboardTime->setValue(config->clipboardTimeOut()); SpinBox_ClipboardTime->setValue(config->clipboardTimeOut());
CheckBox_ShowPasswords->setChecked(config->showPasswords()); CheckBox_ShowPasswords->setChecked(config->showPasswords());
CheckBox_ShowPasswords_PasswordDlg->setChecked(config->showPasswordsPasswordDlg()); CheckBox_ShowPasswords_PasswordDlg->setChecked(config->showPasswordsPasswordDlg());
//Features
CheckBox_FeatureBookmarks->setChecked(config->featureBookmarks());
//Desktop Integration //Desktop Integration
@ -186,7 +189,6 @@ void CSettingsDlg::apply(){
config->setShowSysTrayIcon(checkBox_ShowSysTrayIcon->isChecked()); config->setShowSysTrayIcon(checkBox_ShowSysTrayIcon->isChecked());
config->setMinimizeToTray(checkBox_MinimizeToTray->isChecked()); config->setMinimizeToTray(checkBox_MinimizeToTray->isChecked());
config->setSaveFileDlgHistory(checkBox_SaveFileDlgHistory->isChecked()); config->setSaveFileDlgHistory(checkBox_SaveFileDlgHistory->isChecked());
config->setEnableBookmarkMenu(checkBox_EnableBookmarkMenu->isChecked());
if(Radio_GroupTreeRestore->isChecked())config->setGroupTreeState(KpxConfig::RestoreLast); if(Radio_GroupTreeRestore->isChecked())config->setGroupTreeState(KpxConfig::RestoreLast);
else if(Radio_GroupTreeExpand->isChecked())config->setGroupTreeState(KpxConfig::ExpandAll); else if(Radio_GroupTreeExpand->isChecked())config->setGroupTreeState(KpxConfig::ExpandAll);
else config->setGroupTreeState(KpxConfig::DoNothing); else config->setGroupTreeState(KpxConfig::DoNothing);
@ -204,6 +206,9 @@ void CSettingsDlg::apply(){
config->setClipboardTimeOut(SpinBox_ClipboardTime->value()); config->setClipboardTimeOut(SpinBox_ClipboardTime->value());
config->setShowPasswords(CheckBox_ShowPasswords->isChecked()); config->setShowPasswords(CheckBox_ShowPasswords->isChecked());
config->setShowPasswordsPasswordDlg(CheckBox_ShowPasswords_PasswordDlg->isChecked()); config->setShowPasswordsPasswordDlg(CheckBox_ShowPasswords_PasswordDlg->isChecked());
//Features
config->setFeatureBookmarks(CheckBox_FeatureBookmarks->isChecked());
//Desktop Integration //Desktop Integration
PluginsModified=Label_IntPlugin_Info->isVisible(); PluginsModified=Label_IntPlugin_Info->isVisible();

@ -10,9 +10,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -33,12 +31,21 @@
<string>About</string> <string>About</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -65,12 +72,21 @@
<string>About</string> <string>About</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QLabel" name="label" > <widget class="QLabel" name="label" >
<property name="text" > <property name="text" >
@ -80,12 +96,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -104,12 +129,21 @@
</item> </item>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>12</number> <number>12</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="LinkLabel" name="label_2" > <widget class="LinkLabel" name="label_2" >
<property name="text" > <property name="text" >
@ -130,9 +164,9 @@
<item> <item>
<widget class="QLabel" name="label_4" > <widget class="QLabel" name="label_4" >
<property name="text" > <property name="text" >
<string>Copyright (C) 2005 - 2006 Tarek Saidi <string>Copyright (C) 2005 - 2007 KeePassX Team
KeePassX is distributed under the terms of the KeePassX is distributed under the terms of the
General Public License (GPL) version 2 or later.</string> General Public License (GPL) version 2.</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -147,12 +181,21 @@ General Public License (GPL) version 2 or later.</string>
<string>Credits</string> <string>Credits</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QTextEdit" name="Edit_Thanks" > <widget class="QTextEdit" name="Edit_Thanks" >
<property name="readOnly" > <property name="readOnly" >
@ -167,12 +210,21 @@ General Public License (GPL) version 2 or later.</string>
<string>Translation</string> <string>Translation</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QTextEdit" name="Edit_Translation" > <widget class="QTextEdit" name="Edit_Translation" >
<property name="readOnly" > <property name="readOnly" >
@ -187,12 +239,21 @@ General Public License (GPL) version 2 or later.</string>
<string>License</string> <string>License</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QTextEdit" name="Edit_License" > <widget class="QTextEdit" name="Edit_License" >
<property name="readOnly" > <property name="readOnly" >

@ -0,0 +1,58 @@
<ui version="4.0" >
<class>AddBookmarkDlg</class>
<widget class="QWidget" name="AddBookmarkDlg" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>497</width>
<height>148</height>
</rect>
</property>
<property name="windowTitle" >
<string>Add Bookmark</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Title:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="Edit_Title" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>File:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="Edit_Filename" />
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="Button_Browse" >
<property name="text" >
<string>Browse...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -143,9 +143,15 @@
<property name="title" > <property name="title" >
<string>&amp;Import from...</string> <string>&amp;Import from...</string>
</property> </property>
</widget>
<widget class="QMenu" name="menuBookmarks" >
<property name="title" >
<string>Bookmarks</string>
</property>
</widget> </widget>
<addaction name="FileNewAction" /> <addaction name="FileNewAction" />
<addaction name="FileOpenAction" /> <addaction name="FileOpenAction" />
<addaction name="menuBookmarks" />
<addaction name="FileCloseAction" /> <addaction name="FileCloseAction" />
<addaction name="separator" /> <addaction name="separator" />
<addaction name="FileSaveAction" /> <addaction name="FileSaveAction" />
@ -237,6 +243,11 @@
<addaction name="menuExtras" /> <addaction name="menuExtras" />
<addaction name="menuHilfe" /> <addaction name="menuHilfe" />
</widget> </widget>
<action name="ManageBookmarksAction" >
<property name="text" >
<string>Manage Bookmarks...</string>
</property>
</action>
<action name="FileOpenAction" > <action name="FileOpenAction" >
<property name="text" > <property name="text" >
<string>&amp;Open Database...</string> <string>&amp;Open Database...</string>
@ -544,6 +555,16 @@
<string>Recycle Bin...</string> <string>Recycle Bin...</string>
</property> </property>
</action> </action>
<action name="AddBookmarkAction" >
<property name="text" >
<string>Add Bookmark...</string>
</property>
</action>
<action name="AddThisAsBookmarkAction" >
<property name="text" >
<string>Bookmark this Database...</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

@ -0,0 +1,69 @@
<ui version="4.0" >
<class>ManageBookmarksDlg</class>
<widget class="QDialog" name="ManageBookmarksDlg" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<height>360</height>
</rect>
</property>
<property name="windowTitle" >
<string>Manage Bookmarks</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QListWidget" name="ListWidget" />
</item>
<item>
<layout class="QVBoxLayout" >
<item>
<widget class="QToolButton" name="Button_Add" />
</item>
<item>
<widget class="QToolButton" name="Button_Delete" />
</item>
<item>
<widget class="QToolButton" name="Button_Edit" />
</item>
<item>
<widget class="QToolButton" name="Button_Up" />
</item>
<item>
<widget class="QToolButton" name="Button_Down" />
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>161</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -1,7 +1,4 @@
<ui version="4.0" > <ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>PasswordDlg</class> <class>PasswordDlg</class>
<widget class="QDialog" name="PasswordDlg" > <widget class="QDialog" name="PasswordDlg" >
<property name="geometry" > <property name="geometry" >
@ -13,9 +10,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -41,293 +36,342 @@
<property name="modal" > <property name="modal" >
<bool>true</bool> <bool>true</bool>
</property> </property>
<widget class="QLabel" name="Banner" > <layout class="QVBoxLayout" >
<property name="geometry" > <item>
<rect> <layout class="QHBoxLayout" >
<x>0</x>
<y>0</y>
<width>578</width>
<height>50</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>10</x>
<y>240</y>
<width>561</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>351</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ButtonOK" >
<property name="text" >
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ButtonCancel" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ButtonExit" >
<property name="text" >
<string>Exit</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupframe" >
<property name="geometry" >
<rect>
<x>10</x>
<y>80</y>
<width>561</width>
<height>151</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Key</string>
</property>
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>10</x>
<y>20</y>
<width>541</width>
<height>123</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item> <item>
<layout class="QGridLayout" > <spacer>
<property name="margin" > <property name="orientation" >
<number>0</number> <enum>Qt::Vertical</enum>
</property> </property>
<property name="spacing" > <property name="sizeType" >
<number>6</number> <enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property> </property>
<item row="1" column="0" > <property name="sizeHint" >
<widget class="QLabel" name="Label_PasswordRep" > <size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="Label_Bookmark" >
<property name="text" > <property name="text" >
<string>Password Repet.:</string> <string>Last File</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item>
<widget class="QLineEdit" name="Edit_Password" /> <widget class="QToolButton" name="Button_Bookmarks" >
</item> <property name="popupMode" >
<item row="0" column="0" > <enum>QToolButton::InstantPopup</enum>
<widget class="QLabel" name="Label_Password" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text" > <property name="arrowType" >
<string>Password:</string> <enum>Qt::NoArrow</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2" >
<widget class="QToolButton" name="ButtonChangeEchoMode" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="Edit_PasswordRep" />
</item>
</layout> </layout>
</item> </item>
<item> </layout>
<layout class="QHBoxLayout" > </item>
<property name="margin" > <item>
<number>0</number> <widget class="QLabel" name="textLabel1" >
</property> <property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Enter a Password and/or choose a key file.</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupframe" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Key</string>
</property>
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>10</x>
<y>20</y>
<width>541</width>
<height>124</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="Label_KeyFile" > <layout class="QGridLayout" >
<property name="sizePolicy" > <property name="leftMargin" >
<sizepolicy> <number>0</number>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text" > <property name="topMargin" >
<string>Key file or directory:</string> <number>0</number>
</property> </property>
</widget> <property name="rightMargin" >
</item> <number>0</number>
<item>
<widget class="QComboBox" name="Combo_Dirs" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="editable" > <property name="bottomMargin" >
<bool>true</bool> <number>0</number>
</property> </property>
</widget> <property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="QLabel" name="Label_PasswordRep" >
<property name="text" >
<string>Password Repet.:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="Edit_Password" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="Label_Password" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Password:</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QToolButton" name="ButtonChangeEchoMode" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="Edit_PasswordRep" />
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QPushButton" name="ButtonBrowse" > <layout class="QHBoxLayout" >
<property name="sizePolicy" > <property name="spacing" >
<sizepolicy> <number>6</number>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text" > <property name="leftMargin" >
<string>&amp;Browse...</string> <number>0</number>
</property> </property>
<property name="shortcut" > <property name="topMargin" >
<string>Alt+B</string> <number>0</number>
</property> </property>
</widget> <property name="rightMargin" >
</item> <number>0</number>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="CheckBox_Both" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text" > <property name="bottomMargin" >
<string>Use Password AND Key File</string> <number>0</number>
</property> </property>
</widget> <item>
<widget class="QLabel" name="Label_KeyFile" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Key file or directory:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="Combo_Dirs" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ButtonBrowse" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&amp;Browse...</string>
</property>
<property name="shortcut" >
<string>Alt+B</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<spacer> <layout class="QHBoxLayout" >
<property name="orientation" > <property name="spacing" >
<enum>Qt::Horizontal</enum> <number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property> </property>
<property name="sizeHint" > <property name="rightMargin" >
<size> <number>0</number>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</spacer> <property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="CheckBox_Both" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Use Password AND Key File</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>351</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ButtonOK" >
<property name="text" >
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ButtonCancel" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ButtonExit" >
<property name="text" >
<string>Exit</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </item>
</widget> </layout>
<widget class="QLabel" name="textLabel1" >
<property name="geometry" >
<rect>
<x>10</x>
<y>60</y>
<width>459</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>4</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Enter a Password and/or choose a key file.</string>
</property>
</widget>
</widget> </widget>
<layoutdefault spacing="6" margin="11" /> <layoutdefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<tabstops> <tabstops>
<tabstop>Edit_Password</tabstop> <tabstop>Edit_Password</tabstop>
<tabstop>Edit_PasswordRep</tabstop> <tabstop>Edit_PasswordRep</tabstop>
<tabstop>Combo_Dirs</tabstop> <tabstop>Combo_Dirs</tabstop>
<tabstop>CheckBox_Both</tabstop>
<tabstop>ButtonChangeEchoMode</tabstop>
<tabstop>ButtonBrowse</tabstop> <tabstop>ButtonBrowse</tabstop>
<tabstop>CheckBox_Both</tabstop>
<tabstop>ButtonOK</tabstop> <tabstop>ButtonOK</tabstop>
<tabstop>ButtonCancel</tabstop> <tabstop>ButtonCancel</tabstop>
<tabstop>ButtonExit</tabstop> <tabstop>ButtonExit</tabstop>
<tabstop>Button_Bookmarks</tabstop>
<tabstop>ButtonChangeEchoMode</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

@ -846,7 +846,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkBox_EnableBookmarkMenu" > <widget class="QCheckBox" name="CheckBox_FeatureBookmarks" >
<property name="text" > <property name="text" >
<string>Bookmarks</string> <string>Bookmarks</string>
</property> </property>

@ -462,7 +462,6 @@ void KeepassEntryView::OnColumnMoved(int LogIndex,int OldVisIndex,int NewVisInde
} }
int KeepassEntryView::logicalColIndex(int LstIndex){ int KeepassEntryView::logicalColIndex(int LstIndex){
qDebug("%i",LstIndex);
int c=-1; int c=-1;
for(int i=0;i<NUM_COLUMNS;i++){ for(int i=0;i<NUM_COLUMNS;i++){
if(Columns.at(i))c++; if(Columns.at(i))c++;

@ -0,0 +1,127 @@
/***************************************************************************
* Copyright (C) 2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QFile>
#include "bookmarks.h"
#include "main.h"
#define CSTR(x)(x.toUtf8().data())
QList<KpxBookmarks::BookmarkEntry> KpxBookmarks::Bookmarks;
QString KpxBookmarks::filename;
bool KpxBookmarks::load(const QString& _filename){
/*
Fileformat:
"Title1" "Path1"\n
"Title2" "Path2"\n
...
*/
filename=_filename;
QFile file(filename);
if(!file.exists()){
return true;
}
if(!file.open(QIODevice::ReadOnly)){
qWarning("Reading bookmarks failed: %s",CSTR(decodeFileError(file.error())));
return false;
}
QString content=QString::fromUtf8(file.readAll());
file.close();
content.replace("\r","");
QStringList lines=content.split("\n");
for(int i=0;i<lines.size();i++){
if(lines[i].simplified()==QString()) continue; //skip empty line
if(lines[i].count("\"")!=4){
qWarning("Bookmark parsing error: Skipping line %i.",i);
continue;
}
int a_title=lines[i].indexOf("\"");
int b_title=lines[i].indexOf("\"",a_title+1);
int a_path=lines[i].indexOf("\"",b_title+1);
int b_path=lines[i].indexOf("\"",a_path+1);
BookmarkEntry entry;
entry.Title=lines[i].mid(a_title+1,b_title-a_title-1);
entry.Path=lines[i].mid(a_path+1,b_path-a_path-1);
Bookmarks << entry;
}
return true;
}
int KpxBookmarks::count(){
return Bookmarks.size();
}
QString KpxBookmarks::title(int i){
return Bookmarks[i].Title;
}
QString KpxBookmarks::path(int i){
return Bookmarks[i].Path;
}
int KpxBookmarks::add(const QString& Title,const QString& Path){
BookmarkEntry entry;
entry.Title=Title;
entry.Path=Path;
entry.Index=Bookmarks.size();
Bookmarks<<entry;
save();
return Bookmarks.size()-1;
}
bool KpxBookmarks::save(){
QFile file(filename);
if(!file.exists()){
return false;
}
if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate)){
qWarning("Writing bookmarks failed: %s",CSTR(decodeFileError(file.error())));
return false;
}
QString data;
for(int i=0;i<Bookmarks.size();i++){
data+=QString("\"%1\" \"%2\"\n").arg(Bookmarks[i].Title)
.arg(Bookmarks[i].Path);
}
file.write(data.toUtf8());
file.close();
}
void KpxBookmarks::remove(int index){
Bookmarks.removeAt(index);
save();
}
void KpxBookmarks::edit(const QString& Title,const QString& Path,int i){
Bookmarks[i].Title=Title;
Bookmarks[i].Path=Path;
save();
}
void KpxBookmarks::resort(QList<int> order){
QList<BookmarkEntry> NewList;
for(int i=0;i<order.size();i++){
NewList << Bookmarks[order[i]];
}
Bookmarks=NewList;
save();
}

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (C) 2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _BOOKMARKS_H_
#define _BOOKMARKS_H_
#include <QString>
#include <QList>
class KpxBookmarks {
public:
static bool load(const QString& file);
static int add(const QString& Title,const QString& Path);
static void remove(int id);
static void edit(const QString& Title,const QString& Path, int Index);
static int count();
static void resort(QList<int> order);
static QString title(int Index);
static QString path(int Index);
private:
static bool save();
class BookmarkEntry {
public:
QString Title;
QString Path;
int Index;
};
static QList<BookmarkEntry> Bookmarks;
static QString filename;
};
#endif

@ -43,6 +43,7 @@
#include "main.h" #include "main.h"
#include "lib/FileDialogs.h" #include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
#include "KpxConfig.h" #include "KpxConfig.h"
#include "Kdb3Database.h" #include "Kdb3Database.h"
#include "mainwindow.h" #include "mainwindow.h"
@ -216,6 +217,7 @@ int main(int argc, char **_argv)
else loadDefaultDetailViewTemplate(); else loadDefaultDetailViewTemplate();
loadImages(); loadImages();
KpxBookmarks::load(QDir::homePath()+"/.keepassx/bookmarks");
initYarrow(); //init random number generator initYarrow(); //init random number generator
SecString::generateSessionKey(); SecString::generateSessionKey();

@ -42,6 +42,7 @@
#include "lib/random.h" #include "lib/random.h"
#include "lib/AutoType.h" #include "lib/AutoType.h"
#include "lib/FileDialogs.h" #include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
#include "import/Import_PwManager.h" #include "import/Import_PwManager.h"
#include "import/Import_KWalletXml.h" #include "import/Import_KWalletXml.h"
#include "import/Import_KeePassX_Xml.h" #include "import/Import_KeePassX_Xml.h"
@ -59,13 +60,11 @@
#include "dialogs/CustomizeDetailViewDlg.h" #include "dialogs/CustomizeDetailViewDlg.h"
#include "dialogs/ExpiredEntriesDlg.h" #include "dialogs/ExpiredEntriesDlg.h"
#include "dialogs/TrashCanDlg.h" #include "dialogs/TrashCanDlg.h"
#include "dialogs/AddBookmarkDlg.h"
#include "dialogs/ManageBookmarksDlg.h"
//#include <QtDBus/QtDBus>
#include <iostream> #include <iostream>
//QDBusServer* dbusServer;
//QDBusConnection* dbusCon;
Import_KeePassX_Xml import_KeePassX_Xml; Import_KeePassX_Xml import_KeePassX_Xml;
Import_PwManager import_PwManager; Import_PwManager import_PwManager;
Import_KWalletXml import_KWalletXml; Import_KWalletXml import_KWalletXml;
@ -116,21 +115,8 @@ 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");
// DBus Server of Qt 4.2 does not work - 4.3 snapshot seems to work fine createBookmarkActions();
/*
//dbusServer=new QDBusServer("unix:path=/tmp/KpxBus",this);
//qDebug("DBUS: %s",dbusServer->lastError().message().toAscii().data());
//QDBusConnection::connectToBus("unix:path=/tmp/KpxBus","MyKpxConnection");
//qDebug("DBUS: %s",dbusCon->lastError().message().toAscii().data());
KpxFirefox* fox=new KpxFirefox(NULL);
new KpxFirefoxAdaptor(fox);
QDBusConnection::sessionBus().registerService("org.keepassx.firefoxservice");
QDBusConnection::sessionBus().registerObject("/KpxFirefox",fox);
qDebug("DBUS: %s",QDBusConnection::sessionBus().lastError().message().toAscii().data());
*/
} }
void KeepassMainWindow::setupConnections(){ void KeepassMainWindow::setupConnections(){
@ -145,6 +131,7 @@ void KeepassMainWindow::setupConnections(){
connect(FileUnLockWorkspaceAction,SIGNAL(triggered()), this, SLOT(OnUnLockWorkspace())); connect(FileUnLockWorkspaceAction,SIGNAL(triggered()), this, SLOT(OnUnLockWorkspace()));
connect(menuImport,SIGNAL(triggered(QAction*)),this,SLOT(OnImport(QAction*))); connect(menuImport,SIGNAL(triggered(QAction*)),this,SLOT(OnImport(QAction*)));
connect(menuExport,SIGNAL(triggered(QAction*)),this,SLOT(OnExport(QAction*))); connect(menuExport,SIGNAL(triggered(QAction*)),this,SLOT(OnExport(QAction*)));
connect(menuBookmarks,SIGNAL(triggered(QAction*)),this,SLOT(OnBookmarkTriggered(QAction*)));
connect(EditNewGroupAction, SIGNAL(triggered()), GroupView, SLOT(OnNewGroup())); connect(EditNewGroupAction, SIGNAL(triggered()), GroupView, SLOT(OnNewGroup()));
connect(EditEditGroupAction, SIGNAL(triggered()), GroupView, SLOT(OnEditGroup())); connect(EditEditGroupAction, SIGNAL(triggered()), GroupView, SLOT(OnEditGroup()));
@ -252,6 +239,10 @@ void KeepassMainWindow::setupIcons(){
EditAutoTypeAction->setIcon(getIcon("autotype")); EditAutoTypeAction->setIcon(getIcon("autotype"));
HelpHandbookAction->setIcon(getIcon("manual")); HelpHandbookAction->setIcon(getIcon("manual"));
HelpAboutAction->setIcon(getIcon("help")); HelpAboutAction->setIcon(getIcon("help"));
menuBookmarks->menuAction()->setIcon(getIcon("bookmark_folder"));
AddThisAsBookmarkAction->setIcon(getIcon("bookmark"));
AddBookmarkAction->setIcon(getIcon("bookmark_add"));
ManageBookmarksAction->setIcon(getIcon("bookmark_edit"));
SysTray->setIcon(getIcon("keepassx_large")); SysTray->setIcon(getIcon("keepassx_large"));
if(config->showSysTrayIcon()) if(config->showSysTrayIcon())
SysTray->show(); SysTray->show();
@ -350,6 +341,7 @@ void KeepassMainWindow::setupMenus(){
#endif #endif
ExtrasTrashCanAction->setVisible(false); //For KP 2.x only ExtrasTrashCanAction->setVisible(false); //For KP 2.x only
menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
} }
void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){ void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
@ -367,12 +359,14 @@ void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
config->setLastKeyLocation(QString()); config->setLastKeyLocation(QString());
config->setLastKeyType(PASSWORD);} config->setLastKeyType(PASSWORD);}
db=dynamic_cast<IDatabase*>(new Kdb3Database()); db=dynamic_cast<IDatabase*>(new Kdb3Database());
CPasswordDialog PasswordDlg(this,db,IsAuto,false); CPasswordDialog PasswordDlg(this,filename,db,IsAuto,false);
PasswordDlg.setWindowTitle(filename);
switch(PasswordDlg.exec()){ switch(PasswordDlg.exec()){
case 0: return; case 0: return;
case 2: Start=false; return; case 2: Start=false; return;
} }
if(PasswordDlg.BookmarkFilename!=QString())
filename=PasswordDlg.BookmarkFilename;
GroupView->db=db; GroupView->db=db;
EntryView->db=db; EntryView->db=db;
setupDatabaseConnections(db); setupDatabaseConnections(db);
@ -432,7 +426,7 @@ bool KeepassMainWindow::closeDatabase(){
void KeepassMainWindow::OnFileNewKdb(){ void KeepassMainWindow::OnFileNewKdb(){
IDatabase* db_new=dynamic_cast<IDatabase*>(new Kdb3Database()); IDatabase* db_new=dynamic_cast<IDatabase*>(new Kdb3Database());
db_new->create(); db_new->create();
CPasswordDialog dlg(this,db_new,false,true); CPasswordDialog dlg(this,QString(),db_new,false,true);
dlg.setWindowTitle(tr("New Database")); dlg.setWindowTitle(tr("New Database"));
if(dlg.exec()==1){ if(dlg.exec()==1){
if(FileOpen) if(FileOpen)
@ -495,6 +489,7 @@ EntryView->setEnabled(IsOpen);
DetailView->setEnabled(IsOpen); DetailView->setEnabled(IsOpen);
QuickSearchEdit->setEnabled(IsOpen); QuickSearchEdit->setEnabled(IsOpen);
ExtrasShowExpiredEntriesAction->setEnabled(IsOpen); ExtrasShowExpiredEntriesAction->setEnabled(IsOpen);
AddThisAsBookmarkAction->setEnabled(IsOpen);
if(!IsOpen){ if(!IsOpen){
EditNewGroupAction->setEnabled(false); EditNewGroupAction->setEnabled(false);
@ -756,7 +751,7 @@ if(dlg.exec())setStateFileModified(true);
} }
void KeepassMainWindow::OnFileChangeKey(){ void KeepassMainWindow::OnFileChangeKey(){
CPasswordDialog dlg(this,db,false,true); CPasswordDialog dlg(this,QString(),db,false,true);
if(dlg.exec()) if(dlg.exec())
setStateFileModified(true); setStateFileModified(true);
} }
@ -777,7 +772,7 @@ void KeepassMainWindow::OnImport(QAction* action){
IDatabase* tmpdb=dynamic_cast<IDatabase*>(new Kdb3Database()); IDatabase* tmpdb=dynamic_cast<IDatabase*>(new Kdb3Database());
tmpdb->create(); tmpdb->create();
if(dynamic_cast<IImport*>(action->data().value<QObject*>())->importDatabase(this,tmpdb)){ if(dynamic_cast<IImport*>(action->data().value<QObject*>())->importDatabase(this,tmpdb)){
CPasswordDialog dlg(this,tmpdb,false,true); CPasswordDialog dlg(this,QString(),tmpdb,false,true);
dlg.setWindowTitle(tr("Set Master Key")); dlg.setWindowTitle(tr("Set Master Key"));
if(!dlg.exec()){ if(!dlg.exec()){
delete tmpdb; delete tmpdb;
@ -890,6 +885,7 @@ void KeepassMainWindow::OnExtrasSettings(){
if(dlg.exec()==QDialog::Accepted){ if(dlg.exec()==QDialog::Accepted){
EntryView->setAlternatingRowColors(config->alternatingRowColors()); EntryView->setAlternatingRowColors(config->alternatingRowColors());
SysTray->setVisible(config->showSysTrayIcon()); SysTray->setVisible(config->showSysTrayIcon());
menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
} }
} }
@ -1029,3 +1025,55 @@ void KeepassMainWindow::OnUnLockWorkspace(){
IsLocked=true; IsLocked=true;
} }
} }
void KeepassMainWindow::OnBookmarkTriggered(QAction* action){
if(action==AddBookmarkAction){
AddBookmarkDlg dlg(this);
if(dlg.exec()){
int id=dlg.ItemID;
QAction* action=new QAction(this);
action->setData(id);
action->setText(KpxBookmarks::title(id));
action->setIcon(getIcon("document"));
menuBookmarks->addAction(action);
}
return;
}
if(action==ManageBookmarksAction){
ManageBookmarksDlg dlg(this);
dlg.exec();
menuBookmarks->clear();
createBookmarkActions();
return;
}
if(action==AddThisAsBookmarkAction){
AddBookmarkDlg dlg(this,db->file()->fileName());
if(dlg.exec()){
int id=dlg.ItemID;
QAction* action=new QAction(this);
action->setData(id);
action->setText(KpxBookmarks::title(id));
action->setIcon(getIcon("document"));
menuBookmarks->addAction(action);
}
return;
}
openDatabase(KpxBookmarks::path(action->data().toInt()));
}
void KeepassMainWindow::createBookmarkActions(){
menuBookmarks->addAction(AddBookmarkAction);
menuBookmarks->addAction(AddThisAsBookmarkAction);
menuBookmarks->addAction(ManageBookmarksAction);
menuBookmarks->addSeparator();
for(int i=0;i<KpxBookmarks::count();i++){
QAction* action=new QAction(this);
action->setData(i);
action->setText(KpxBookmarks::title(i));
action->setIcon(getIcon("document"));
menuBookmarks->addAction(action);
}
}

@ -69,6 +69,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void OnFileSettings(); void OnFileSettings();
void OnFileChangeKey(); void OnFileChangeKey();
void OnFileExit(); void OnFileExit();
void OnBookmarkTriggered(QAction* action);
void OnSearch(); void OnSearch();
void OnGroupSearch(); void OnGroupSearch();
void OnViewShowToolbar(bool); void OnViewShowToolbar(bool);
@ -120,6 +121,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void updateDetailView(); void updateDetailView();
void exportDatabase(IExport* exporter,QStringList filters); void exportDatabase(IExport* exporter,QStringList filters);
void saveLastFilename(const QString& filename); void saveLastFilename(const QString& filename);
void createBookmarkActions();
QLineEdit* QuickSearchEdit; QLineEdit* QuickSearchEdit;
QLabel* StatusBarGeneral; QLabel* StatusBarGeneral;
QLabel* StatusBarSelection; QLabel* StatusBarSelection;

@ -14,20 +14,24 @@ INSTALLS += target data
data.files += ../share/keepass/* data.files += ../share/keepass/*
TARGET = ../bin/keepassx TARGET = ../bin/keepassx
unix: !macx{ isEmpty(PREFIX){
PREFIX = /usr
}
unix : !macx {
target.path = $${PREFIX}/bin target.path = $${PREFIX}/bin
data.path = $${PREFIX}/share/keepass data.path = $${PREFIX}/share/keepass
LIBS += -lXtst -lQtDBus LIBS += -lXtst -lQtDBus
SOURCES += lib/AutoType_X11.cpp SOURCES += lib/AutoType_X11.cpp
} }
macx{ macx {
target.path = /Applications target.path = /Applications
data.path = /Applications/keepass.app/Contents/share/keepass data.path = /Applications/keepass.app/Contents/share/keepass
SOURCES += lib/AutoType_X11.cpp SOURCES += lib/AutoType_X11.cpp
} }
win32{ win32 {
SOURCES += lib/AutoType_Win.cpp SOURCES += lib/AutoType_Win.cpp
TARGET = ../$$TARGET TARGET = ../$$TARGET
QMAKE_LINK_OBJECT_SCRIPT = ../build/$$QMAKE_LINK_OBJECT_SCRIPT QMAKE_LINK_OBJECT_SCRIPT = ../build/$$QMAKE_LINK_OBJECT_SCRIPT
@ -50,7 +54,9 @@ FORMS += forms/EditGroupDlg.ui \
forms/CalendarDlg.ui \ forms/CalendarDlg.ui \
forms/TrashCanDlg.ui \ forms/TrashCanDlg.ui \
forms/ExpiredEntriesDlg.ui \ forms/ExpiredEntriesDlg.ui \
forms/WorkspaceLockedWidget.ui forms/WorkspaceLockedWidget.ui \
forms/AddBookmarkDlg.ui \
forms/ManageBookmarksDlg.ui
TRANSLATIONS += translations/keepass-de_DE.ts \ TRANSLATIONS += translations/keepass-de_DE.ts \
translations/keepass-ru_RU.ts \ translations/keepass-ru_RU.ts \
translations/keepass-es_ES.ts \ translations/keepass-es_ES.ts \
@ -113,7 +119,10 @@ HEADERS += lib/IniReader.h \
plugins/interfaces/IGnomeInit.h \ plugins/interfaces/IGnomeInit.h \
plugins/interfaces/IIconTheme.h \ plugins/interfaces/IIconTheme.h \
KpxConfig.h \ KpxConfig.h \
KpxFirefox.h KpxFirefox.h \
dialogs/AddBookmarkDlg.h \
lib/bookmarks.h \
dialogs/ManageBookmarksDlg.h
SOURCES += lib/UrlLabel.cpp \ SOURCES += lib/UrlLabel.cpp \
main.cpp \ main.cpp \
mainwindow.cpp \ mainwindow.cpp \
@ -161,7 +170,10 @@ SOURCES += lib/UrlLabel.cpp \
crypto/yarrow.cpp \ crypto/yarrow.cpp \
lib/WaitAnimationWidget.cpp \ lib/WaitAnimationWidget.cpp \
KpxConfig.cpp \ KpxConfig.cpp \
KpxFirefox.cpp KpxFirefox.cpp \
dialogs/AddBookmarkDlg.cpp \
lib/bookmarks.cpp \
dialogs/ManageBookmarksDlg.cpp
RESOURCES += res/resources.qrc RESOURCES += res/resources.qrc
MOC_DIR = ../build/moc MOC_DIR = ../build/moc
UI_DIR = ../build/ui UI_DIR = ../build/ui
@ -171,9 +183,8 @@ CONFIG += debug \
qt \ qt \
thread \ thread \
warn_off \ warn_off \
dbus \
assistant assistant
QT += dbus xml QT += xml
TEMPLATE = app TEMPLATE = app
INCLUDEPATH += . \ INCLUDEPATH += . \
lib \ lib \