- support for precompiled headers

- made password dialog more userfriendly (especially key file creation/selection)
- database file as command line argument is recognized again
- fixed bug #1825446 (commandline option -cfg does NOT take relative path)
- fixed mac buid problem (see item #1908868)


git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@174 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 17 years ago
parent 97bac939dd
commit bdec5c8450
  1. 12
      changelog
  2. 1
      src/Application_X11.cpp
  3. 1
      src/Application_X11.h
  4. 4
      src/Database.cpp
  5. 28
      src/Database.h
  6. 84
      src/Kdb3Database.cpp
  7. 22
      src/Kdb3Database.h
  8. 5
      src/KpxConfig.cpp
  9. 9
      src/KpxConfig.h
  10. 2
      src/crypto/twofish.cpp
  11. 4
      src/crypto/twofish.h
  12. 4
      src/crypto/yarrow.cpp
  13. 5
      src/dialogs/AboutDlg.cpp
  14. 4
      src/dialogs/AboutDlg.h
  15. 5
      src/dialogs/AddBookmarkDlg.cpp
  16. 4
      src/dialogs/AddBookmarkDlg.h
  17. 6
      src/dialogs/AutoTypeDlg.cpp
  18. 1
      src/dialogs/AutoTypeDlg.h
  19. 3
      src/dialogs/CalendarDlg.cpp
  20. 1
      src/dialogs/CalendarDlg.h
  21. 5
      src/dialogs/CollectEntropyDlg.cpp
  22. 6
      src/dialogs/CollectEntropyDlg.h
  23. 8
      src/dialogs/CustomizeDetailViewDlg.cpp
  24. 2
      src/dialogs/CustomizeDetailViewDlg.h
  25. 9
      src/dialogs/DatabaseSettingsDlg.cpp
  26. 3
      src/dialogs/DatabaseSettingsDlg.h
  27. 16
      src/dialogs/EditEntryDlg.cpp
  28. 4
      src/dialogs/EditEntryDlg.h
  29. 2
      src/dialogs/EditGroupDlg.cpp
  30. 3
      src/dialogs/EditGroupDlg.h
  31. 7
      src/dialogs/ExpiredEntriesDlg.cpp
  32. 4
      src/dialogs/ExpiredEntriesDlg.h
  33. 7
      src/dialogs/ManageBookmarksDlg.cpp
  34. 3
      src/dialogs/ManageBookmarksDlg.h
  35. 548
      src/dialogs/PasswordDlg.cpp
  36. 93
      src/dialogs/PasswordDlg.h
  37. 14
      src/dialogs/PasswordGenDlg.cpp
  38. 3
      src/dialogs/PasswordGenDlg.h
  39. 10
      src/dialogs/SearchDlg.cpp
  40. 4
      src/dialogs/SearchDlg.h
  41. 13
      src/dialogs/SelectIconDlg.cpp
  42. 5
      src/dialogs/SelectIconDlg.h
  43. 12
      src/dialogs/SettingsDlg.cpp
  44. 5
      src/dialogs/SettingsDlg.h
  45. 5
      src/dialogs/SimplePasswordDlg.cpp
  46. 6
      src/export/Export.cpp
  47. 4
      src/export/Export.h
  48. 3
      src/export/Export_KeePassX_Xml.cpp
  49. 1
      src/export/Export_KeePassX_Xml.h
  50. 5
      src/export/Export_Txt.cpp
  51. 1
      src/export/Export_Txt.h
  52. 345
      src/forms/PasswordDlg.ui
  53. 6
      src/import/Import.cpp
  54. 5
      src/import/Import.h
  55. 5
      src/import/Import_KWalletXml.cpp
  56. 2
      src/import/Import_KWalletXml.h
  57. 4
      src/import/Import_KeePassX_Xml.cpp
  58. 1
      src/import/Import_KeePassX_Xml.h
  59. 11
      src/import/Import_PwManager.cpp
  60. 4
      src/import/Import_PwManager.h
  61. 3
      src/lib/AutoType.h
  62. 12
      src/lib/AutoType_X11.cpp
  63. 20
      src/lib/EntryView.cpp
  64. 10
      src/lib/EntryView.h
  65. 6
      src/lib/FileDialogs.cpp
  66. 6
      src/lib/FileDialogs.h
  67. 19
      src/lib/GroupView.cpp
  68. 5
      src/lib/GroupView.h
  69. 1
      src/lib/HelperX11.cpp
  70. 5
      src/lib/SecString.cpp
  71. 5
      src/lib/SecString.h
  72. 1
      src/lib/ShortcutWidget.h
  73. 9
      src/lib/UrlLabel.cpp
  74. 2
      src/lib/UrlLabel.h
  75. 5
      src/lib/WaitAnimationWidget.cpp
  76. 7
      src/lib/WaitAnimationWidget.h
  77. 4
      src/lib/bookmarks.cpp
  78. 3
      src/lib/bookmarks.h
  79. 6
      src/lib/random.h
  80. 41
      src/lib/tools.cpp
  81. 6
      src/lib/tools.h
  82. 34
      src/main.cpp
  83. 32
      src/main.h
  84. 4
      src/main_macx.cpp
  85. 56
      src/main_unix.cpp
  86. 2
      src/main_win32.cpp
  87. 111
      src/mainwindow.cpp
  88. 20
      src/mainwindow.h
  89. 122
      src/src.pro

@ -1,3 +1,15 @@
---------------
0.3.1
---------------
- made key/password dialog more user friendly
- program accepts Qt command line switches like "-style" again
---------------
0.3.0a
---------------
- fixed bug which prevented MacOS X bundle from starting (Bug #1906517)
- fixed error message about missing license file when opening about dialog (Bug #1906696)
---------------
0.3.0
---------------

@ -17,6 +17,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "Application_X11.h"
#include "lib/AutoType.h"
#include "lib/HelperX11.h"

@ -20,7 +20,6 @@
#ifndef APPLICATION_X11_H
#define APPLICATION_X11_H
#include <QApplication>
class KeepassApplication : public QApplication
{

@ -18,9 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "Database.h"
#include "lib/random.h"
#include <QCoreApplication>
KpxUuid::KpxUuid(){
Data.fill(0,16);

@ -21,14 +21,6 @@
#ifndef _DATABASE_H_
#define _DATABASE_H_
#include <QList>
#include <QDateTime>
#include <QFile>
#include <QPixmap>
#include <QByteArray>
#include "lib/SecString.h"
using namespace std;
extern const QDateTime Date_Never;
typedef enum CryptAlgorithm{
@ -246,6 +238,9 @@ This is the common base interface for databases. Every database class must imple
class IDatabase:public QObject{
public:
virtual ~IDatabase(){};
virtual bool setKey(const QString& password,const QString& keyfile)=0;
virtual bool isKeyError()=0;
//! Loads a database.
/*! It is not allowed to call this function if a database is already loaded.
@ -409,23 +404,6 @@ public:
};
//! Interface for password/file based authentication
class IFilePasswordAuth{
public:
virtual void authByPwd(QString& password)=0;
virtual bool authByFile(QString& filename)=0;
virtual bool authByFileAndPwd(QString& password, QString& filename)=0;
/*! Creates a key file.
\param filename Filename of the new key file.
\param length Length of the key file.
\param Hex Wether the key file should be binary or hexadecimal ASCII code. If Hex is true the real file size will be double of length.
\return TRUE if the creation was successfull, otherwise FALSE.
*/
virtual bool createKeyFile(const QString& filename,int length=32, bool Hex=false)=0;
virtual bool isKeyError()=0;
};
class IKdbSettings{
public:
virtual void setCryptAlgorithm(CryptAlgorithm algo)=0;

@ -17,23 +17,9 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "global.h"
#include <iostream>
#include <time.h>
#include <QFile>
#include <QStringList>
#include <QDateTime>
#include <QSysInfo>
#include <QBuffer>
#include <QDir>
#include "crypto/twoclass.h"
#include "crypto/aescpp.h"
#include "crypto/sha256.h"
#include "crypto/yarrow.h"
#include "lib/random.h"
using namespace std;
#include "Kdb3Database.h"
#include "KpxConfig.h"
#define UNEXP_ERROR error=QString("Unexpected error in: %1, Line:%2").arg(__FILE__).arg(__LINE__);
@ -739,29 +725,26 @@ bool Kdb3Database::convHexToBinaryKey(char* HexKey, char* dst){
return true;
}
/*
void Kdb3Database::authByPwd(QString& Password){
if(!Password.size()) {
memcpy(RawMasterKey,QByteArray(32,'\0').data(),32);
return;
}
SHA256::hashBuffer(Password.toUtf8().data(),RawMasterKey,Password.toUtf8().size());
return;
}*/
bool Kdb3Database::setKey(const QString& password,const QString& keyfile){
if(!password.isEmpty() && !keyfile.isEmpty())
return setCompositeKey(password,keyfile);
if(!password.isEmpty())
return setPasswordKey(password);
if(!keyfile.isEmpty())
return setFileKey(keyfile);
assert(false);
}
void Kdb3Database::authByPwd(QString& Password){
if(!Password.size()) {
memcpy(RawMasterKey,QByteArray(32,'\0').data(),32);
return;
}
bool Kdb3Database::setPasswordKey(const QString& Password){
assert(Password.size());
SHA256::hashBuffer(Password.toLatin1().data(),RawMasterKey,Password.toLatin1().size());
QByteArray lat,utf;
utf=Password.toUtf8();
lat=Password.toLatin1();
return;
return true;
}
bool Kdb3Database::authByFile(QString& filename){
bool Kdb3Database::setFileKey(const QString& filename){
QFile file(filename);
if(!file.open(QIODevice::ReadOnly|QIODevice::Unbuffered)){
error=decodeFileError(file.error());
@ -799,14 +782,13 @@ bool Kdb3Database::authByFile(QString& filename){
return true;
}
bool Kdb3Database::authByFileAndPwd(QString& Password, QString& filename){
bool Kdb3Database::setCompositeKey(const QString& Password,const QString& filename){
unsigned char PasswordKey[32];
unsigned char FileKey[32];
if(!authByFile(filename))return false;
if(!setFileKey(filename))return false;
memcpy(FileKey,RawMasterKey,32);
authByPwd(Password);
setPasswordKey(Password);
memcpy(PasswordKey,RawMasterKey,32);
SHA256 sha;
sha.update(PasswordKey,32);
sha.update(FileKey,32);
@ -1637,38 +1619,6 @@ void Kdb3Database::rebuildIndices(QList<StdGroup*>& list){
}
}
bool Kdb3Database::createKeyFile(const QString& filename,int length, bool Hex){
QFile file(filename);
if(!file.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Unbuffered)){
error=decodeFileError(file.error());
return false;
}
if(Hex)length*=2;
unsigned char* key=new unsigned char[length];
randomize(key,length);
if(Hex){
for(int i=0; i<length; i+=2){
unsigned char dig1,dig2;
dig1=key[i]/16;
key[i]-=(16*dig1);
dig2=key[i];
if(dig1>9)key[i]='A'+dig1-10;
else key[i]='0'+dig1;
if(dig2>9)key[i+1]='A'+dig2-10;
else key[i+1]='0'+dig2;
}
}
if(file.write((char*)key,length)==-1){
delete [] key;
error=decodeFileError(file.error());
file.close();
return false;
}
file.close();
delete [] key;
return true;
}
void Kdb3Database::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,int Pos){
StdGroup* Parent;

@ -30,25 +30,13 @@
#define PWM_FLAG_TWOFISH 8
#define PWM_STD_KEYENCROUNDS 6000
#include <QColor>
#include <QDateTime>
#include <QDate>
#include <QTime>
#include <QStringList>
#include <QPixmap>
#include <QMap>
#include "main.h"
#include "lib/SecString.h"
#include "Database.h"
void memcpyFromLEnd32(quint32* dst,const char* src);
void memcpyFromLEnd16(quint16* dst,const char* src);
void memcpyToLEnd32(char* src,const quint32* dst);
void memcpyToLEnd16(char* src,const quint16* dst);
//! Implementation of the standard KeePassX database.
class Kdb3Database:public ICustomIcons,public IDatabase, public IFilePasswordAuth, public IKdbSettings{
class Kdb3Database:public ICustomIcons,public IDatabase, public IKdbSettings{
Q_OBJECT
public:
class StdGroup;
@ -169,10 +157,6 @@ public:
virtual void removeIcon(int index);
virtual void replaceIcon(int index,const QPixmap& icon);
virtual int builtinIcons(){return BUILTIN_ICONS;};
virtual void authByPwd(QString& password);
virtual bool authByFile(QString& filename);
virtual bool authByFileAndPwd(QString& password, QString& filename);
virtual bool createKeyFile(const QString& filename,int length=32, bool Hex=false);
virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields);
virtual QFile* file(){return File;}
virtual bool changeFile(const QString& filename);
@ -180,6 +164,10 @@ public:
virtual CryptAlgorithm cryptAlgorithm(){return Algorithm;}
virtual unsigned int keyTransfRounds(){return KeyTransfRounds;}
virtual void setKeyTransfRounds(unsigned int rounds){KeyTransfRounds=rounds;}
virtual bool setKey(const QString& password, const QString& keyfile);
virtual bool setPasswordKey(const QString& password);
virtual bool setFileKey(const QString& filename);
virtual bool setCompositeKey(const QString& password,const QString& filename);
virtual QList<IEntryHandle*> entries();
virtual QList<IEntryHandle*> entries(IGroupHandle* Group);

@ -21,12 +21,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "KpxConfig.h"
#include <QApplication>
#include <QSettings>
#include <QDir>
#include <QLayout>
#include <QWidget>
KpxConfig::KpxConfig(const QString& filePath) : settings(filePath,QSettings::IniFormat){
configFile=filePath;

@ -23,14 +23,7 @@
#ifndef _KPXCONFIG_H_
#define _KPXCONFIG_H_
#include "lib/tools.h"
#include "AutoType.h"
#include <QBitArray>
#include <QByteArray>
#include <QColor>
#include <QList>
#include <QSettings>
#include <QString>
#include "lib/AutoType.h"
#if defined(Q_WS_MAC)
# define DEFAULT_MOUNT_DIR "/Volumes/"

@ -171,7 +171,7 @@
* Standard include files will probably be ok.
*/
#include <QString> /* for memset(), memcpy(), and memcmp() */
//#include <QString> /* for memset(), memcpy(), and memcmp() */
#include <cstdlib>
#include "twofish.h"

@ -1,3 +1,5 @@
#ifndef TWOFISH_H_
#define TWOFISH_H_
/*
* Fast, portable, and easy-to-use Twofish implementation,
* Version 0.3.
@ -177,3 +179,5 @@ extern void Twofish_decrypt(
Twofish_Byte c[16],
Twofish_Byte p[16]
);
#endif

@ -20,10 +20,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>

@ -17,10 +17,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QMessageBox>
#include <QPainter>
#include <QFile>
#include "lib/tools.h"
#include "AboutDlg.h"

@ -20,11 +20,7 @@
#ifndef _ABOUTDIALOG_H_
#define _ABOUTDIALOG_H_
#include <QPaintEvent>
#include "ui_AboutDlg.h"
#include "lib/UrlLabel.h"
#include "main.h"
class AboutDialog : public QDialog, public Ui_AboutDlg
{

@ -17,11 +17,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QFileInfo>
#include <QPainter>
#include "lib/tools.h"
#include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
#include "AddBookmarkDlg.h"

@ -20,12 +20,8 @@
#ifndef _ADDBOOKMARKDLG_H_
#define _ADDBOOKMARKDLG_H_
#include <QDialog>
#include <QPaintEvent>
#include "ui_AddBookmarkDlg.h"
#include "main.h"
class AddBookmarkDlg : public QDialog, private Ui::AddBookmarkDlg
{
Q_OBJECT

@ -17,12 +17,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "main.h"
#include "AutoTypeDlg.h"
#include "KpxConfig.h"
#include <QDesktopWidget>
#include <QPainter>
#include <QPaintEvent>
#include "AutoTypeDlg.h"
AutoTypeDlg::AutoTypeDlg(QList<IEntryHandle*> entries, QList<int> numbers){
setupUi(this);

@ -18,7 +18,6 @@
***************************************************************************/
#include "ui_AutoTypeDlg.h"
#include "Database.h"
class AutoTypeDlg : public QWidget, private Ui::AutoTypeDlg
{

@ -18,8 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "lib/tools.h"
#include "main.h"
#include "CalendarDlg.h"
CalendarDialog::CalendarDialog(QWidget* parent, const QDate& Start):QDialog(parent){

@ -20,7 +20,6 @@
#ifndef _CALENDAR_DLG_H_
#define _CALENDAR_DLG_H_
#include <QDate>
#include "ui_CalendarDlg.h"
class CalendarDialog:public QDialog, public Ui_CalendarDialog{

@ -18,13 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QPainter>
#include <QCursor>
#include <QFile>
#include "lib/tools.h"
#include "crypto/yarrow.h"
#include "CollectEntropyDlg.h"

@ -22,12 +22,6 @@
#define _COLLECT_ENTROPY_DLG_H_
#include "ui_CollectEntropyDlg.h"
#include <QDialog>
#include <QPaintEvent>
#include <QShowEvent>
#include "main.h"
class CollectEntropyDlg: public QDialog, public Ui_CollectEntropyDlg{
Q_OBJECT

@ -18,16 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QTextCursor>
#include <QTextBlockFormat>
#include <QLineEdit>
#include <QPushButton>
#include <QColorDialog>
#include <QPixmap>
#include <QMenu>
#include "main.h"
#include "CustomizeDetailViewDlg.h"
#include "KpxConfig.h"
bool DisableButtonSlots=false;

@ -21,8 +21,6 @@
#define _CUSTOMIZE_DETAIL_VIEW_H_
#include "ui_CustomizeDetailViewDlg.h"
#include <QColor>
#include <QAction>
class CustomizeDetailViewDialog : public QDialog, public Ui_CustomizeDetailViewDialog{
Q_OBJECT

@ -18,14 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QPainter>
#include <QComboBox>
#include <QLineEdit>
#include <QMessageBox>
#include <QShowEvent>
#include <QFile>
#include "lib/tools.h"
#include "main.h"
#include "DatabaseSettingsDlg.h"

@ -22,9 +22,6 @@
#define DBSETTINGSDLG_H
#include "ui_DatabaseSettingsDlg.h"
#include "main.h"
#include "Database.h"
#include <QPaintEvent>
class CDbSettingsDlg : public QDialog, public Ui_DatabaseSettingsDlg
{

@ -18,29 +18,13 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "main.h"
#include "KpxConfig.h"
#include <QPalette>
#include <QFont>
#include <QProgressBar>
#include <QPixmap>
#include <QColor>
#include <QPainter>
#include <QPen>
#include <QFileDialog>
#include <QMessageBox>
#include <QToolButton>
#include <QShowEvent>
#include <QResizeEvent>
#include <math.h>
#include "SelectIconDlg.h"
#include "PasswordGenDlg.h"
#include "EditEntryDlg.h"
#include "CalendarDlg.h"
CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent, bool modal, bool newEntry)
: QDialog(parent)
{

@ -20,10 +20,8 @@
#ifndef EDITENTRYDLG_H
#define EDITENTRYDLG_H
#include "ui_EditEntryDlg.h"
#include <QPixmap>
#include <QShowEvent>
#include "main.h"
#include "Kdb3Database.h"
class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog

@ -18,9 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "main.h"
#include <QShowEvent>
#include "EditGroupDlg.h"
#include "SelectIconDlg.h"

@ -22,9 +22,6 @@
#define EDITGROUPDLG_H
#include "ui_EditGroupDlg.h"
#include <QString>
#include <QShowEvent>
#include "Database.h"
class CEditGroupDialog : public QDialog, public Ui_EditGroupDialog
{

@ -18,12 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QTreeWidget>
#include <QPainter>
#include <QPaintEvent>
#include <QResizeEvent>
#include "lib/tools.h"
#include "main.h"
#include "ExpiredEntriesDlg.h"
ExpiredEntriesDialog::ExpiredEntriesDialog(QWidget* parent,IDatabase* database,const QList<IEntryHandle*>& ExpiredEntries):QDialog(parent){

@ -21,10 +21,8 @@
#ifndef _EXP_ENTRIES_DLG_
#define _EXP_ENTRIES_DLG_
#include <QList>
#include <QPixmap>
#include "ui_ExpiredEntriesDlg.h"
#include "Database.h"
class ExpiredEntriesDialog:public QDialog, public Ui_ExpiredEntriesDialog{
Q_OBJECT

@ -17,11 +17,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QListWidget>
#include <QPainter>
#include "lib/tools.h"
#include "ManageBookmarksDlg.h"
#include "lib/bookmarks.h"
#include "dialogs/ManageBookmarksDlg.h"
#include "dialogs/AddBookmarkDlg.h"
ManageBookmarksDlg::ManageBookmarksDlg(QWidget* parent):QDialog(parent)

@ -20,9 +20,6 @@
#ifndef MANAGEBOOKMARKSDLG_H
#define MANAGEBOOKMARKSDLG_H
#include <QDialog>
#include <QCloseEvent>
#include <QPaintEvent>
#include "ui_ManageBookmarksDlg.h"
#include "main.h"

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005-2007 by Tarek Saidi *
* Copyright (C) 2005-2008 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
@ -17,372 +17,334 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QFileDialog>
#include <QDir>
#include <QStringList>
#include <QCheckBox>
#include <QLineEdit>
#include <QComboBox>
#include <QPushButton>
#include <QMessageBox>
#include <QPainter>
#include <QPalette>
#include <QMenu>
#include <QTimer>
#include "dialogs/PasswordDlg.h"
#include "main.h"
#include "KpxConfig.h"
#include "PasswordDlg.h"
#include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
CPasswordDialog::CPasswordDialog(QWidget* parent,QString filename,IDatabase* DB,bool IsAuto,bool ChangeKeyMode)
PasswordDialog::PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const QString& filename)
: QDialog(parent)
{
setupUi(this);
createBanner(&BannerPixmap,getPixmap("key"),tr("Database Key"),width());
Button_Bookmarks->setIcon(getIcon("bookmark"));
db=DB;
LastFile=filename;
if (ChangeKeyMode)
setWindowTitle(tr("Change Master Key"));
else
setWindowTitle(LastFile);
QString mountDir=config->mountDir();
QDir media(mountDir);
if(media.exists()){
Mode=mode;
Filename=filename;
QString BannerTitle;
if(Mode==Mode_Ask){
BannerTitle=tr("Enter Master Key");
}
else if(Mode==Mode_Set){
BannerTitle=tr("Set Master Key");
}
else if(Mode==Mode_Change){
BannerTitle=tr("Change Master Key");
}
if(filename==QString()){
setWindowTitle(tr("Database Key"));
}
else {
setWindowTitle(filename);
}
// Add list of subdirs in the mounting dir to the combobox.
// For example making /media/cd1 and /media/myflashdrive to two entries cd1 and myflashdrive in the combobox
QDir mountDir(config->mountDir());
if(mountDir.exists()){
QStringList Paths;
Paths=media.entryList(QStringList()<<"*",QDir::Dirs | QDir::NoDotAndDotDot);
Paths=mountDir.entryList(QStringList()<<"*",QDir::Dirs | QDir::NoDotAndDotDot);
for(int i=0;i<Paths.count();i++)
Combo_Dirs->addItem(mountDir+Paths[i]);
Combo_KeyFile->addItem(config->mountDir()+Paths[i]);
}
Combo_Dirs->setEditText(QString());
if(config->rememberLastKey() && config->openLastFile() && !ChangeKeyMode){
Combo_KeyFile->setEditText(QString());
if(config->rememberLastKey() && Mode!=Mode_Change && Mode!=Mode_Set){
switch(config->lastKeyType()){
case PASSWORD:
Check_Password->setChecked(true);
Check_KeyFile->setChecked(false);
Combo_KeyFile->setEditText("");
break;
case KEYFILE:
Check_Password->setChecked(false);
Check_KeyFile->setChecked(true);
Combo_KeyFile->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
break;
case BOTH:
Check_Password->setChecked(true);
Check_KeyFile->setChecked(true);
Combo_KeyFile->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
break;
}
}
if(Mode!=Mode_Set && Mode!=Mode_Change){
Button_GenKeyFile->hide();
}
if(flags & Flag_Auto){
/*
QPushButton* Button_Quit = buttonBox->addButton(tr("Quit"),QDialogButtonBox::DestructiveRole);
connect(Button_Quit,SIGNAL(clicked()),this,SLOT(OnButtonQuit()));
*/
if(config->rememberLastKey()){
switch(config->lastKeyType()){
case PASSWORD:
Check_Password->setChecked(true);
Check_KeyFile->setChecked(false);
break;
case KEYFILE:
setStateKeyFileOnly();
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
Check_Password->setChecked(false);
Check_KeyFile->setChecked(true);
Combo_KeyFile->setEditText(config->lastKeyLocation());
break;
case BOTH:
setStateBoth();
CheckBox_Both->setChecked(true);
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
Check_Password->setChecked(true);
Check_KeyFile->setChecked(true);
Combo_KeyFile->setEditText(config->lastKeyLocation());
break;
}
}
// if(LastKeyType==Password){... is not required because it is already the default state.
}
// Bookmarks //
QPalette palette=Button_Bookmarks->palette();
palette.setColor(QPalette::Active,QPalette::Button,config->bannerColor1());
palette.setColor(QPalette::Active,QPalette::Window,config->bannerColor2());
Button_Bookmarks->setPalette(palette);
palette=Label_Bookmark->palette();
palette.setColor(QPalette::Active,QPalette::WindowText,config->bannerTextColor());
Label_Bookmark->setPalette(palette);
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++){
// Setting up the bookmark button
if(Mode==Mode_Ask && config->featureBookmarks()){
// Button Color
QPalette palette=Button_Bookmarks->palette();
palette.setColor(QPalette::Active,QPalette::Button,config->bannerColor1());
palette.setColor(QPalette::Active,QPalette::Window,config->bannerColor2());
Button_Bookmarks->setPalette(palette);
palette=Label_Bookmark->palette();
palette.setColor(QPalette::Active,QPalette::WindowText,config->bannerTextColor());
Label_Bookmark->setPalette(palette);
// Create menu and add "last file" menu entry
QMenu* BookmarkMenu=new QMenu(this);
QAction* action=new QAction(this);
action->setData(KpxBookmarks::path(i));
action->setText(KpxBookmarks::title(i));
action->setData(QString());
action->setText(tr("Last File"));
action->setIcon(getIcon("document"));
BookmarkMenu->addAction(action);
BookmarkMenu->addAction(action);
BookmarkMenu->addSeparator();
// Adding all existing bookmarks
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);
connect(BookmarkMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnBookmarkTriggered(QAction*)));
}
Button_Bookmarks->setMenu(BookmarkMenu);
if(!IsAuto || !config->featureBookmarks()){
else {
Button_Bookmarks->hide();
Label_Bookmark->hide();
}
connect(Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
connect(ButtonBox, SIGNAL( rejected() ), 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(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
connect(ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoModeDatabaseKey() ) );
connect(Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
connect(Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
connect(BookmarkMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnBookmarkTriggered(QAction*)));
Mode_Set=ChangeKeyMode;
if(!ChangeKeyMode){
Edit_PasswordRep->hide();
Label_PasswordRep->hide();
connect( ButtonBox, SIGNAL( accepted() ), this, SLOT( OnOK() ) );
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
}else{
connect( ButtonBox, SIGNAL( accepted() ), this, SLOT( OnOK_Set() ) );
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
}
connect(Edit_PwRepeat, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
connect(buttonBox->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), this, SLOT( OnOK() ) );
connect(Button_Browse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
connect(Button_GenKeyFile,SIGNAL(clicked()),this,SLOT(OnGenKeyFile()));
connect(Check_Password,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxesChanged(int)));
connect(Check_KeyFile,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxesChanged(int)));
connect(Button_Back,SIGNAL(clicked()),this,SLOT(OnButtonBack()));
if(!config->showPasswordsPasswordDlg())ChangeEchoModeDatabaseKey();
adjustSize();
setMaximumSize(size());
setMinimumSize(size());
createBanner(&BannerPixmap,getPixmap("key"),BannerTitle,width());
Button_Bookmarks->setIcon(getIcon("bookmark"));
OnCheckBoxesChanged(0);
}
void CPasswordDialog::setStatePasswordOnly(){
Combo_Dirs->setEnabled(false);
ButtonBrowse->setEnabled(false);
Label_KeyFile->setEnabled(false);
Label_Password->setEnabled(true);
Label_PasswordRep->setEnabled(true);
Edit_Password->setEnabled(true);
Edit_PasswordRep->setEnabled(true);
ButtonChangeEchoMode->setEnabled(true);
KeyType=PASSWORD;
}
void CPasswordDialog::setStateKeyFileOnly(){
Combo_Dirs->setEnabled(true);
ButtonBrowse->setEnabled(true);
Label_KeyFile->setEnabled(true);
Label_Password->setEnabled(false);
Label_PasswordRep->setEnabled(false);
Edit_Password->setEnabled(false);
Edit_PasswordRep->setEnabled(false);
ButtonChangeEchoMode->setEnabled(false);
KeyType=KEYFILE;
}
void CPasswordDialog::setStateBoth(){
Combo_Dirs->setEnabled(true);
ButtonBrowse->setEnabled(true);
Label_KeyFile->setEnabled(true);
Label_Password->setEnabled(true);
Label_PasswordRep->setEnabled(true);
Edit_Password->setEnabled(true);
Edit_PasswordRep->setEnabled(true);
ButtonChangeEchoMode->setEnabled(true);
KeyType=BOTH;
}
void CPasswordDialog::OnButtonBrowse()
void PasswordDialog::OnButtonBrowse()
{
QString filename=KpxFileDialogs::openExistingFile(this,"PasswordDlg",tr("Select a Key File"),
QStringList() << tr("Key Files (*.key)") << tr("All Files (*)"));
if(filename!=QString()){
Combo_Dirs->setEditText(filename);
}
return;
QStringList() << tr("All Files (*)")
<< tr("Key Files (*.key)"));
if(filename!=QString())
Combo_KeyFile->setEditText(filename);
}
void CPasswordDialog::OnButtonBrowse_Set()
void PasswordDialog::OnCancel()
{
QString filename=KpxFileDialogs::saveFile(this,"PasswordDlg",tr("Select a Key File"),
QStringList() << tr("Key Files (*.key)") << tr("All Files (*)"),
false);
if(filename!=QString()){
Combo_Dirs->setEditText(filename);
}
return;
done(Exit_Cancel);
}
void CPasswordDialog::OnCancel()
{
done(0);
}
void CPasswordDialog::OnOK(){
password=Edit_Password->text();
keyfile=Combo_Dirs->currentText();
if(password.isEmpty() && keyfile.isEmpty()){
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
void PasswordDialog::OnOK(){
if(stackedWidget->currentIndex()==1){
if(Password==Edit_PwRepeat->text()){
done(Exit_Ok);
}
Edit_PwRepeat->clear();
Edit_PwRepeat->setFocus(Qt::OtherFocusReason);
Label_Unequal->show();
QTimer::singleShot(2000,Label_Unequal,SLOT(hide()));
return;
}
if(KeyType==BOTH){
if(password.isEmpty()){
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0);
return;}
if(keyfile.isEmpty()){
QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0);
return;}
Password=Edit_Password->text();
KeyFile=Combo_KeyFile->currentText();
if(!Check_Password->isChecked() && !Check_KeyFile->isChecked()){
showErrMsg(tr("Please enter a Password or select a key file."),this);
return;
}
if(Check_Password->isChecked() && Password.isEmpty()){
showErrMsg(tr("Please enter a Password."));
return;
}
if(Check_KeyFile->isChecked() && KeyFile.isEmpty()){
showErrMsg(tr("Please provide a key file."));
return;
}
if(KeyType==BOTH || KeyType==KEYFILE){
QFileInfo fileinfo(keyfile);
if(Check_KeyFile->isChecked()){
/* Check wether key path exists and is readable */
QFileInfo fileinfo(KeyFile);
if(!fileinfo.exists()){
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory does not exist."),tr("OK"),"","",0,0);
showErrMsg(tr("%1:\nNo such file or directory.").arg(KeyFile),this);
return;
}
if(!fileinfo.isReadable()){
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
showErrMsg(tr("The selected key file or directory is not readable."),this);
return;
}
/* If the given path is a directory, we need to find the key file in it */
if(fileinfo.isDir()){
if(keyfile.right(1)!="/")keyfile+="/";
QFile file(keyfile+"pwsafe.key");
if(!file.exists()){
QDir dir(keyfile);
if(KeyFile.right(1)!="/")KeyFile+="/";
// First, we try to find $path/pwsafe.key
QFile file(KeyFile+"pwsafe.key");
if(file.exists())
KeyFile+="pwsafe.key";
else{
// If pwsafe.key does not exist, we try to see if there is exactly one file in the
// given directory which has the extension *.key.
QDir dir(KeyFile);
QStringList files;
files=dir.entryList(QStringList()<<"*.key",QDir::Files);
// No Key Files
if(!files.size()){
QMessageBox::warning(this,tr("Error"),tr("The given directory does not contain any key files."),tr("OK"),"","",0,0);
return;}
if(files.size()>1){
QMessageBox::warning(this,tr("Error"),tr("The given directory contains more then one key file.\nPlease specify the key file directly."),tr("OK"),"","",0,0);
return;}
QFile file(keyfile+files[0]);
Q_ASSERT(file.exists());
if(!QFileInfo(file).isReadable()){
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
return;}
keyfile+=files[0];
showErrMsg(tr("The given directory does not contain any key files."),this);
return;
}
else{ /* pwsafe.key exists */
if(!QFileInfo(file).isReadable()){
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
return;}
keyfile+="pwsafe.key";
// More than one key file
if(files.size()>1){
showErrMsg(tr("The given directory contains more then one key files.\n"
"Please specify the key file directly."),this);
return;
}
}
else{ /* not a directory */
QFile file(keyfile);
if(!file.exists()){
QMessageBox::warning(this,tr("Error"),tr("Key file could not be found."),tr("OK"),"","",0,0);
return;}
if(!QFileInfo(file).isReadable()){
QMessageBox::warning(this,tr("Error"),tr("Key file is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
return;}
}
}
if(doAuth())done(1);
}
void CPasswordDialog::OnOK_Set(){
password=Edit_Password->text();
if(password!=Edit_PasswordRep->text()){
QMessageBox::warning(this,tr("Warning"),tr("Password an password repetition are not equal.\nPlease check your input."),tr("OK"),"","",0,0);
return;
}
keyfile=Combo_Dirs->currentText();
if(password.isEmpty() && keyfile.isEmpty()){
QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
return;
}
if(!keyfile.isEmpty()){
QFile file(keyfile);
if(QFileInfo(file).isDir()){
if(keyfile.right(1)!="/")keyfile+="/";
keyfile+="pwsafe.key";
}
if(file.exists()){
switch(QMessageBox::question(this,tr("File exists."),tr("A file with the selected name already exists, should this file be used as key file or do you want to overwrite it with a newly generated one?"),
tr("Use"),tr("Overwrite"),tr("Cancel"),0,2)){
case 0:
OverwriteKeyFile=false;
break;
case 1:
OverwriteKeyFile=true;
break;
case 2:
return;
KeyFile+=files[0];
}
}
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
if(OverwriteKeyFile){
if(!DbAuth->createKeyFile(keyfile,32,true)){
QMessageBox::warning(this,tr("Error"),tr("Key file could not be created.\n%1").arg(db->getError()),tr("OK"),"","",0,0);
// Check again whether the found file exists and is readable
QFileInfo fileinfo(KeyFile);
if(!fileinfo.exists()){
showErrMsg(tr("%1:\nNo such file or directory.").arg(KeyFile),this);
return;
}
}
}
if(doAuth())done(1);
}
if(!fileinfo.isReadable()){
showErrMsg(tr("%1:\nFile is not readable."),this);
return;
}
}
bool CPasswordDialog::doAuth(){
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
if(!password.isEmpty() && keyfile.isEmpty()){
DbAuth->authByPwd(password);
}
else if(password.isEmpty() && !keyfile.isEmpty()){
if(!DbAuth->authByFile(keyfile))return false;
}
else if(!password.isEmpty() && !keyfile.isEmpty()){
if(!DbAuth->authByFileAndPwd(password, keyfile))return false;
}
if(config->rememberLastKey() && config->openLastFile()){
QString KeyLocation=keyfile;
if(config->saveRelativePaths()){
KeyLocation=KeyLocation.left(KeyLocation.lastIndexOf("/"));
KeyLocation=makePathRelative(KeyLocation,QDir::currentPath())+keyfile.right(keyfile.length()-keyfile.lastIndexOf("/")-1);
}
config->setLastKeyLocation(KeyLocation);
config->setLastKeyType(KeyType);
if(Check_Password->isChecked() && (Mode==Mode_Set || Mode==Mode_Change)){
Edit_PwRepeat->clear();
Label_Unequal->hide();
stackedWidget->setCurrentIndex(1);
Edit_PwRepeat->setFocus(Qt::OtherFocusReason);
return;
}
return true;
}
void CPasswordDialog::OnPasswordChanged(const QString &txt){
Edit_PasswordRep->setText(QString());
if(CheckBox_Both->isChecked() || txt.isEmpty())
setStateBoth();
else
setStatePasswordOnly();
done(Exit_Ok);
}
void CPasswordDialog::OnComboTextChanged(const QString& txt){
if(CheckBox_Both->isChecked() || txt.isEmpty())
setStateBoth();
else
setStateKeyFileOnly();
void PasswordDialog::OnCheckBoxesChanged(int state){
Edit_Password->setEnabled(Check_Password->isChecked());
Combo_KeyFile->setEnabled(Check_KeyFile->isChecked());
Button_Browse->setEnabled(Check_KeyFile->isChecked());
Button_GenKeyFile->setEnabled(Check_KeyFile->isChecked());
}
void CPasswordDialog::OnCheckBox_BothChanged(int state){
if(state==Qt::Checked)
setStateBoth();
if(state==Qt::Unchecked){
if(!Edit_Password->text().isEmpty() && !Combo_Dirs->currentText().isEmpty()){
Combo_Dirs->setEditText(QString());
setStatePasswordOnly();
void PasswordDialog::ChangeEchoModeDatabaseKey(){
if(Edit_Password->echoMode()==QLineEdit::Normal){
Edit_Password->setEchoMode(QLineEdit::Password);
Edit_PwRepeat->setEchoMode(QLineEdit::Password);
}
else{
if(Edit_Password->text().isEmpty())
setStateKeyFileOnly();
else
setStatePasswordOnly();
Edit_Password->setEchoMode(QLineEdit::Normal);
Edit_PwRepeat->setEchoMode(QLineEdit::Normal);
}
}
void PasswordDialog::OnButtonQuit(){
done(Exit_Quit);
}
void CPasswordDialog::ChangeEchoModeDatabaseKey(){
if(Edit_Password->echoMode()==QLineEdit::Normal){
Edit_Password->setEchoMode(QLineEdit::Password);
Edit_PasswordRep->setEchoMode(QLineEdit::Password);}
else{
Edit_Password->setEchoMode(QLineEdit::Normal);
Edit_PasswordRep->setEchoMode(QLineEdit::Normal);}
}
void CPasswordDialog::paintEvent(QPaintEvent* event){
void PasswordDialog::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();
void PasswordDialog::OnBookmarkTriggered(QAction* action){
if(action->data().toString()==QString())
setWindowTitle(LastFile);
setWindowTitle(Filename);
else
setWindowTitle(action->data().toString());
Label_Bookmark->setText(action->text());
BookmarkFilename=action->data().toString();
}
void PasswordDialog::OnGenKeyFile(){
QString filename=KpxFileDialogs::saveFile(this,"PasswordDlg",tr("Create Key File..."),
QStringList() << tr("All Files (*)")
<< tr("Key Files (*.key)"));
if(!filename.isEmpty()){
QString error;
if(!createKeyFile(filename,&error,32,true)){
showErrMsg(error,this);
return;
}
else {
if(Check_KeyFile->isChecked())
Combo_KeyFile->setEditText(filename);
return;
}
}
}
QString PasswordDialog::password(){
if(Check_Password->isChecked())
return Edit_Password->text();
else
return QString();
}
QString PasswordDialog::keyFile(){
if(Check_KeyFile->isChecked())
return Combo_KeyFile->currentText();
else
return QString();
}
QString PasswordDialog::selectedBookmark(){
return BookmarkFilename;
}
void PasswordDialog::OnButtonBack(){
stackedWidget->setCurrentIndex(0);
Edit_PwRepeat->clear();
}

@ -1,11 +1,10 @@
/***************************************************************************
* Copyright (C) 2005 by Tarek Saidi *
* tarek@linux *
* Copyright (C) 2005-2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* 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 *
@ -17,51 +16,69 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef PASSWORDDIALOG_H
#define PASSWORDDIALOG_H
#include <QPixmap>
#include <QPaintEvent>
#include "ui_PasswordDlg.h"
#include "main.h"
#include "lib/tools.h"
#include "lib/UrlLabel.h"
#include "Database.h"
#include <QPixmap>
#include <QPaintEvent>
class CPasswordDialog : public QDialog, public Ui_PasswordDlg
{
Q_OBJECT
private:
bool Mode_Set; //true = Set, false = Get
IDatabase* db;
QPixmap BannerPixmap;
void setStatePasswordOnly();
void setStateKeyFileOnly();
void setStateBoth();
bool doAuth();
virtual void paintEvent(QPaintEvent*);
QString LastFile;
class PasswordDialog : public QDialog, public Ui_PasswordDlg {
Q_OBJECT
public:
enum DlgMode {
Mode_Ask, // Normal password entry when opening a database
Mode_Set, // Setting password for the first time after creating a new database
Mode_Change // Changing the password of a database
};
enum DlgFlags {
Flag_None = 0x00,
Flag_Auto = 0x01 // Dialog was automatically opened on start-up
};
public:
QString keyfile;
QString password;
QString BookmarkFilename;
tKeyType KeyType;
bool OverwriteKeyFile;
CPasswordDialog(QWidget* parent,QString filename,IDatabase* DB,bool IsAuto=false,bool ChangeKeyMode=false);
enum DlgExit {
Exit_Ok,
Exit_Cancel,
Exit_Quit
};
private slots:
void OnOK();
void OnOK_Set();
void OnCancel();
void OnButtonBrowse();
void OnButtonBrowse_Set();
void OnPasswordChanged(const QString &txt);
void OnCheckBox_BothChanged(int state);
void ChangeEchoModeDatabaseKey();
void OnComboTextChanged(const QString&);
void OnBookmarkTriggered(QAction* action);
typedef bool (KeyFileGenProc)(const QString& filename,QString* error);
PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const QString& filename=QString());
// result functions
QString selectedBookmark();
QString keyFile();
QString password();
public slots:
void OnOK();
void OnCancel();
void OnButtonBrowse();
void OnButtonQuit();
void OnGenKeyFile();
void OnButtonBack();
void ChangeEchoModeDatabaseKey();
void OnBookmarkTriggered(QAction* action);
void OnCheckBoxesChanged(int state);
private:
DlgMode Mode;
QPixmap BannerPixmap;
QString BookmarkFilename;
QString Filename;
QString Password;
QString KeyFile;
void setStatePasswordOnly();
void setStateKeyFileOnly();
void setStateBoth();
virtual void paintEvent(QPaintEvent*);
};
#endif

@ -18,18 +18,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QSpinBox>
#include <QMessageBox>
#include <QRadioButton>
#include <QLineEdit>
#include <QCheckBox>
#include <QProgressBar>
#include <QPainter>
#include <math.h>
#include "PasswordGenDlg.h"
#include "CollectEntropyDlg.h"
#include "dialogs/PasswordGenDlg.h"
#include "dialogs/CollectEntropyDlg.h"
#include "crypto/yarrow.h"
#include "KpxConfig.h"
bool CGenPwDialog::EntropyCollected=false;

@ -21,10 +21,7 @@
#ifndef GENPWDIALOG_H
#define GENPWDIALOG_H
#include <QPixmap>
#include <QPaintEvent>
#include "ui_PasswordGenDlg.h"
#include "main.h"
#include "EditEntryDlg.h"
class CGenPwDialog : public QDialog, public Ui_GenPwDlg

@ -19,15 +19,7 @@
***************************************************************************/
#include <QLineEdit>
#include <QCheckBox>
#include <QPushButton>
#include <QRegExp>
#include <QMessageBox>
#include <QPainter>
#include "main.h"
#include "KpxConfig.h"
#include "SearchDlg.h"
#include "dialogs/SearchDlg.h"
SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* parent):QDialog(parent)

@ -20,11 +20,7 @@
#ifndef SEARCHDLG_H
#define SEARCHDLG_H
#include <QPaintEvent>
#include <QPixmap>
#include "ui_SearchDlg.h"
#include "main.h"
#include "Database.h"
class SearchDialog : public QDialog, public Ui_Search_Dlg
{

@ -16,18 +16,9 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QStringList>
#include <QFileDialog>
#include <QDir>
#include <QFile>
#include <QPixmap>
#include <QPushButton>
#include <QMessageBox>
#include <QShowEvent>
#include <QFile>
#include "lib/tools.h"
#include "SelectIconDlg.h"
#include "dialogs/SelectIconDlg.h"
CSelectIconDlg::CSelectIconDlg(IDatabase* database,int CurrentId,QWidget* parent, bool modal, Qt::WFlags fl):QDialog(parent,fl){

@ -21,11 +21,6 @@
#ifndef _SELECT_ICON_DLG_
#define _SELECT_ICON_DLG_
#include <QContextMenuEvent>
#include <QMenu>
#include <QAction>
#include "main.h"
#include "Database.h"
#include "ui_SelectIconDlg.h"
class CSelectIconDlg:public QDialog, public Ui_SelectIconDlg{

@ -17,16 +17,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "main.h"
#include "KpxConfig.h"
#include <QPixmap>
#include <QColorDialog>
#include <QFileDialog>
#include <QDir>
#include <QPainter>
#include "SettingsDlg.h"
#include "CustomizeDetailViewDlg.h"
#include "FileDialogs.h"
#include <QColorDialog>
#include "dialogs/SettingsDlg.h"
#include "dialogs/CustomizeDetailViewDlg.h"
bool CSettingsDlg::PluginsModified=false;

@ -21,12 +21,7 @@
#ifndef SETTINGSDLG_H
#define SETTINGSDLG_H
#include <QColor>
#include <QPixmap>
#include <QPaintEvent>
#include "ui_SettingsDlg.h"
#include "main.h"
#include "lib/AutoType.h"
class CSettingsDlg : public QDialog, public Ui_SettingsDialog

@ -18,10 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QLineEdit>
#include <QPushButton>
#include "main.h"
#include "KpxConfig.h"
#include "SimplePasswordDlg.h"
SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl)

@ -18,12 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QMessageBox>
#include <QFile>
#include "lib/tools.h"
#include "main.h"
#include "Export.h"
#include "lib/FileDialogs.h"
#include "dialogs/SimplePasswordDlg.h"
QFile* ExporterBase::openFile(QWidget* parent, QString id, QStringList Filters){

@ -20,10 +20,6 @@
#ifndef _EXPORT_H_
#define _EXPORT_H_
#include <QWidget>
#include <QFile>
#include "Database.h"
class IExport{
public:

@ -17,8 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QtXml>
#include "Export_KeePassX_Xml.h"
bool Export_KeePassX_Xml::exportDatabase(QWidget* GuiParent,IDatabase* database){

@ -21,7 +21,6 @@
#ifndef _EXPORT_KPX_XML_H_
#define _EXPORT_KPX_XML_H_
#include <QDomElement>
#include "Export.h"
class Export_KeePassX_Xml:public ExporterBase, public IExport{

@ -18,10 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QString>
#include <QFile>
#include "main.h"
#include "lib/SecString.h"
#include "Export_Txt.h"

@ -20,7 +20,6 @@
#ifndef _EXPORT_TXT_H_
#define _EXPORT_TXT_H_
#include <QObject>
#include "Export.h"
class Export_Txt:public ExporterBase, public IExport{

@ -6,11 +6,11 @@
<x>0</x>
<y>0</y>
<width>578</width>
<height>280</height>
<height>255</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<sizepolicy vsizetype="Maximum" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -18,13 +18,7 @@
<property name="minimumSize" >
<size>
<width>578</width>
<height>280</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>578</width>
<height>280</height>
<height>0</height>
</size>
</property>
<property name="windowTitle" >
@ -37,6 +31,9 @@
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout" >
<item>
@ -115,150 +112,187 @@
<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>
<layout class="QVBoxLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QGridLayout" >
<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>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<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>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</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>
</layout>
</widget>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="stackedWidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="pw_entry" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="Check_Password" >
<property name="text" >
<string>Password:</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLineEdit" name="Edit_Password" />
</item>
<item>
<widget class="QToolButton" name="ButtonChangeEchoMode" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="Check_KeyFile" >
<property name="text" >
<string>Key File:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<layout class="QHBoxLayout" >
<item>
<widget class="QComboBox" name="Combo_KeyFile" >
<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="Button_Browse" >
<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 row="2" column="1" >
<widget class="QPushButton" name="Button_GenKeyFile" >
<property name="text" >
<string>Generate Key File...</string>
</property>
</widget>
</item>
<item row="2" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="pw_repeat" >
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Please repeat your password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="Edit_PwRepeat" />
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="Button_Back" >
<property name="text" >
<string>Back</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>
<item>
<widget class="QLabel" name="Label_Unequal" >
<property name="font" >
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Passwords are not equal.</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonBox" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
@ -269,13 +303,16 @@
<layoutdefault spacing="6" margin="11" />
<tabstops>
<tabstop>Edit_Password</tabstop>
<tabstop>Combo_KeyFile</tabstop>
<tabstop>Check_Password</tabstop>
<tabstop>Check_KeyFile</tabstop>
<tabstop>ButtonChangeEchoMode</tabstop>
<tabstop>Edit_PasswordRep</tabstop>
<tabstop>Combo_Dirs</tabstop>
<tabstop>ButtonBrowse</tabstop>
<tabstop>CheckBox_Both</tabstop>
<tabstop>ButtonBox</tabstop>
<tabstop>Button_Browse</tabstop>
<tabstop>Button_Bookmarks</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>Button_GenKeyFile</tabstop>
<tabstop>Button_Back</tabstop>
<tabstop>Edit_PwRepeat</tabstop>
</tabstops>
<resources/>
<connections/>

@ -18,12 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QMessageBox>
#include <QFile>
#include "lib/tools.h"
#include "main.h"
#include "Import.h"
#include "lib/FileDialogs.h"
#include "dialogs/SimplePasswordDlg.h"
QFile* ImporterBase::openFile(QWidget* parent, QString id, QStringList Filters){

@ -19,11 +19,6 @@
***************************************************************************/
#ifndef _IMPORT_H_
#define _IMPORT_H_
#include <QWidget>
#include <QFile>
#include "Database.h"
class IImport{
public:

@ -18,11 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "Import_KWalletXml.h"
#include <QFile>
#include <QtXml>
#include <QMessageBox>
#include "Import_KWalletXml.h"
bool Import_KWalletXml::importDatabase(QWidget* GuiParent, IDatabase* db){
QFile* file=openFile(GuiParent,identifier(),QStringList()<<tr("XML Files (*.xml)")<<tr("All Files (*)"));

@ -20,7 +20,7 @@
#ifndef _IMPORT_KWALLET_H_
#define _IMPORT_KWALLET_H_
#include "Database.h"
#include "Import.h"
class Import_KWalletXml:public ImporterBase, public IImport{

@ -18,9 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QStringList>
#include <QMessageBox>
#include <QtXml>
#include "Import_KeePassX_Xml.h"
bool Import_KeePassX_Xml::importDatabase(QWidget* Parent, IDatabase* database){

@ -21,7 +21,6 @@
#ifndef _IMPORT_KPX_XML_H_
#define _IMPORT_KPX_XML_H_
#include <QDomElement>
#include "Import.h"

@ -18,14 +18,9 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QFile>
#include <iostream>
#include <QMessageBox>
#include <QtXml>
#include "crypto/blowfish.h"
#include "crypto/sha1.h"
#include "Import_PwManager.h"
using namespace std;
bool Import_PwManager::importDatabase(QWidget* GuiParent, IDatabase* db){
database=db;
@ -115,7 +110,7 @@ bool Import_PwManager::importDatabase(QWidget* GuiParent, IDatabase* db){
if(!parseXmlContent((char*)xml)){
delete [] xml;
QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Invalid XML data (see stdout for details).")); return false;}
dynamic_cast<IFilePasswordAuth*>(database)->authByPwd(password);
database->setKey(password,QString());
return true;
}

@ -20,9 +20,7 @@
#ifndef _IMPORT_PWMANAGER_
#define _IMPORT_PWMANAGER_
#include <QDomElement>
#include <QString>
#include "Database.h"
#include "Import.h"

@ -21,9 +21,6 @@
#ifndef _AUTOTYPE_H_
#define _AUTOTYPE_H_
#include <QString>
#include "Database.h"
#ifdef GLOBAL_AUTOTYPE
struct Shortcut{
bool ctrl, shift, alt, altgr, win;

@ -18,18 +18,14 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QtCore>
#include "KpxConfig.h"
#include "AutoType.h"
#include "mainwindow.h"
#include <QList>
#include <QChar>
#include <QX11Info>
#include "HelperX11.h"
#include <X11/Xutil.h>
#include "mainwindow.h"
#include "HelperX11.h"
#include "AutoType.h"
#ifdef GLOBAL_AUTOTYPE
#include "dialogs/AutoTypeDlg.h"
#include "dialogs/AutoTypeDlg.h"
#endif
enum AutoTypeActionType{

@ -18,24 +18,12 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDragLeaveEvent>
#include <QDropEvent>
#include <QMouseEvent>
#include <QHeaderView>
#include <QTime>
#include <QApplication>
#include <QPainter>
#include <QPair>
#include <QMessageBox>
#include "main.h"
#include "KpxConfig.h"
#include "EntryView.h"
#include "dialogs/EditEntryDlg.h"
#include <QClipboard>
#include <QFileDialog>
#include "lib/AutoType.h"
#include "Database.h"
#include "lib/EntryView.h"
#include "dialogs/EditEntryDlg.h"
// just for the lessThan funtion
QList<EntryViewItem*>* pItems;

@ -21,15 +21,7 @@
#ifndef _ENTRY_VIEW_H_
#define _ENTRY_VIEW_H_
#include <QMenu>
#include <QTreeWidget>
#include <QContextMenuEvent>
#include <QHeaderView>
#include <QTimer>
#include <QClipboard>
#include <QBitArray>
#include <QList>
#include "../Kdb3Database.h"
#include "Kdb3Database.h"
#define NUM_COLUMNS 11

@ -18,11 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QDir>
#include "main.h"
#include "KpxConfig.h"
#include "FileDialogs.h"
#include <QFileDialog>
IFileDialog* KpxFileDialogs::iFileDialog=NULL;
QtStandardFileDialogs DefaultQtDlgs;

@ -19,11 +19,7 @@
***************************************************************************/
#ifndef _FILE_DIALOGS_H_
#define _FILE_DIALOGS_H_
#include <QObject>
#include <QFileDialog>
#include <QList>
#include <QHash>
#include "plugins/interfaces/IFileDialog.h"

@ -17,24 +17,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDragLeaveEvent>
#include <QDropEvent>
#include <QPaintEvent>
#include <QMouseEvent>
#include <QApplication>
#include <QFont>
#include <QFontMetrics>
#include <QSize>
#include <QPixmap>
#include <QPainter>
#include <QPen>
#include <QBrush>
#include <QMenu>
#include <QMessageBox>
#include "KpxConfig.h"
#include "main.h"
#include "EntryView.h"
#include "GroupView.h"
#include "dialogs/EditGroupDlg.h"

@ -20,10 +20,7 @@
#ifndef _GROUP_VIEW_H_
#define _GROUP_VIEW_H_
#include <QTreeWidget>
#include <QLine>
#include <QContextMenuEvent>
#include "../Kdb3Database.h"
#include "Kdb3Database.h"
class GroupViewItem;

@ -19,7 +19,6 @@
***************************************************************************/
#include "HelperX11.h"
#include <QX11Info>
int HelperX11::getModifiers(Display *d,KeySym keysym, int keycode){

@ -18,10 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "SecString.h"
#include <iostream>
#include "crypto/arcfour.h"
#include "crypto/yarrow.h"
using namespace std;
CArcFour SecString::RC4;

@ -20,11 +20,6 @@
#ifndef _SECSTRING_H_
#define _SECSTRING_H_
#include <QByteArray>
#include <QString>
#include <QGlobalStatic>
#include "crypto/arcfour.h"
//! QString based class with in-memory encryption of its content.
/*!
This class can hold a QString object in an encrypted buffer. To get access to the string it is neccassary to unlock the SecString object.

@ -20,7 +20,6 @@
#ifndef SHORTCUT_WIDGET_H
#define SHORTCUT_WIDGET_H
#include <QLineEdit>
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_X11)
#include "lib/AutoType.h"

@ -20,15 +20,6 @@
#include "UrlLabel.h"
#include "main.h"
#include "lib/tools.h"
#include <QFont>
#include <QColor>
#include <QCursor>
#include <QFontMetrics>
#include <QMouseEvent>
#include <QLabel>
#include <QPalette>
LinkLabel::LinkLabel(QWidget *parent,const QString& text, int x, int y,Qt::WFlags f) : QLabel(parent,f){
QFont font(parentWidget()->font()); font.setUnderline(true);

@ -20,8 +20,6 @@
#ifndef _LINKLABEL_H_
#define _LINKLABEL_H_
#include <QLabel>
#include <QMouseEvent>
class LinkLabel : public QLabel{
Q_OBJECT

@ -18,10 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <math.h>
#include <QPainter>
#include <QRectF>
#include "main.h"
#include "WaitAnimationWidget.h"

@ -17,12 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QWidget>
#include <QPaintEvent>
#include <QResizeEvent>
#include <QTimer>
#include <QPointF>
class WaitAnimationWidget:public QWidget{
Q_OBJECT

@ -17,9 +17,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "bookmarks.h"
#include "main.h"
#include "KpxConfig.h"
QList<KpxBookmarks::BookmarkEntry> KpxBookmarks::Bookmarks;

@ -19,9 +19,6 @@
#ifndef _BOOKMARKS_H_
#define _BOOKMARKS_H_
#include <QString>
#include <QList>
class KpxBookmarks {
public:
static void load();

@ -17,4 +17,10 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef RANDOM_H_
#define RANDOM_H_
extern void getRandomBytes(void* buffer,int NumBlocks,int BlockSize=1,bool Strong=false);
#endif

@ -16,12 +16,9 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QtCore>
#include <QtGui>
#include "KpxConfig.h"
#include "main.h"
#include "lib/tools.h"
#include <QProcess>
#include <QDesktopServices>
void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width){
createBanner(Pixmap,IconAlpha,Text,Width,config->bannerColor1(),config->bannerColor2(),config->bannerTextColor());
@ -177,3 +174,37 @@ const QPixmap* getPixmap(const QString& name){
}
bool createKeyFile(const QString& filename,QString* error,int length, bool Hex){
QFile file(filename);
if(!file.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Unbuffered)){
*error=decodeFileError(file.error());
return false;
}
if(Hex)length*=2;
unsigned char* key=new unsigned char[length];
randomize(key,length);
if(Hex){
// convert binary data to hex code (8 bit ==> 2 digits)
for(int i=0; i<length; i+=2){
unsigned char dig1,dig2;
dig1=key[i]/16;
key[i]-=(16*dig1);
dig2=key[i];
if(dig1>9)key[i]='A'+dig1-10;
else key[i]='0'+dig1;
if(dig2>9)key[i+1]='A'+dig2-10;
else key[i+1]='0'+dig2;
}
}
if(file.write((char*)key,length)==-1){
delete [] key;
*error=decodeFileError(file.error());
file.close();
return false;
}
file.close();
delete [] key;
return true;
}

@ -19,11 +19,6 @@
#ifndef TOOLS_H
#define TOOLS_H
#include <QFile>
#include <QString>
#include <QPixmap>
#include <QIcon>
#define CSTR(x)(x.toLocal8Bit().constData())
class IEntryHandle;
typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2};
@ -37,5 +32,6 @@ void showErrMsg(const QString& msg,QWidget* parent=NULL);
QString decodeFileError(QFile::FileError Code);
QString makePathRelative(const QString& Abs,const QString& Cur);
QString getImageFile(const QString& name);
bool createKeyFile(const QString& filename,QString* err, int length=32, bool Hex=true);
#endif //TOOLS_H

@ -19,10 +19,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QtCore>
#include <QMessageBox>
#include <iostream>
/*
#include "plugins/interfaces/IFileDialog.h"
#include "plugins/interfaces/IKdeInit.h"
@ -31,12 +27,10 @@
#include "lib/FileDialogs.h"
*/
#include "main.h"
#include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
#include "KpxConfig.h"
#include "Kdb3Database.h"
#include <QTranslator>
#include <QLibraryInfo>
#include "mainwindow.h"
#include "main.h"
#include "crypto/yarrow.h"
#if defined(Q_WS_X11) && defined(GLOBAL_AUTOTYPE)
#include "Application_X11.h"
@ -55,10 +49,6 @@ QString DetailViewTemplate;
QPixmap* EntryIcons;
//IIconTheme* IconLoader=NULL; //TODO plugins
inline void loadImages();
inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang,bool& ArgMin,bool& ArgLock);
bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& LocaleCode,const QStringList& SearchPaths);
void initAppPaths();
int main(int argc, char **argv)
{
@ -68,7 +58,7 @@ int main(int argc, char **argv)
#else
app = new QApplication(argc,argv);
#endif
initAppPaths();
initAppPaths(argc,argv);
CmdLineArgs args;
args.parse(QApplication::arguments());
qDebug(CSTR(AppDir));
@ -243,7 +233,8 @@ bool CmdLineArgs::parse(const QStringList& argv){
Error=QString("Expected a path as argument for '-cfg' but got '%1.'").arg(argv[i+1]);
return false;
}
ConfigLocation=argv[i+1];
QFileInfo file(argv[i+1]);
ConfigLocation=file.absolutePath();
i++;
continue;
}
@ -268,6 +259,10 @@ bool CmdLineArgs::parse(const QStringList& argv){
StartLocked=true;
continue;
}
if(i==1){
File=argv[1];
continue;
}
Error=QString("** Unrecognized argument: '%1'").arg(argv[i]);
return false;
}
@ -288,6 +283,10 @@ void CmdLineArgs::printHelp(){
cout << " pt_BR Portuguese(Brazil)"<<endl;
}
//TODO Plugins
/*
QString findPlugin(const QString& filename){
@ -300,3 +299,8 @@ QString findPlugin(const QString& filename){
return QString();
}
*/

@ -20,36 +20,10 @@
#ifndef _MAIN_H_
#define _MAIN_H_
#include <QLabel>
#include <QPixmap>
#include <QString>
#include <QColor>
#include <QIcon>
#include <QFile>
#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.3.0a"
#define BUILTIN_ICONS 65
//QString findPlugin(const QString& filename); //TODO Plugins
class KpxConfig;
extern QString PluginLoadError;
extern KpxConfig *config;
extern QString AppDir;
extern QString HomeDir;
extern QString DataDir;
extern bool TrActive;
extern QString DetailViewTemplate;
extern QPixmap *EntryIcons;
void loadImages();
bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& LocaleCode,const QStringList& SearchPaths);
void initAppPaths(int argc, char **argv);
class CmdLineArgs {
public:

@ -19,12 +19,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QVarLengthArray>
#include <QDir>
#include <Carbon/Carbon.h>
#include "main.h"
void initAppPaths() {
void initAppPaths(int argc,char** argv) {
CFURLRef bundleURL(CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
//assert(bundleURL);
CFStringRef cfPath(CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle));

@ -19,14 +19,56 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QApplication>
#include <QByteArray>
#include <QDir>
#include <QFileInfo>
#include "main.h"
void initAppPaths() {
AppDir = QApplication::applicationDirPath();
DataDir = QDir(AppDir+"/../share/keepassx").canonicalPath();
void initAppPaths(int argc,char** argv) {
// Try looking for a /proc/<pid>/exe symlink first which points to
// the absolute path of the executable
QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid()));
if (pfi.exists() && pfi.isSymLink()) {
AppDir = pfi.canonicalFilePath();
}
else {
QString argv0 = QFile::decodeName(QByteArray(argv[0]));
QString absPath;
if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) {
/*
If argv0 starts with a slash, it is already an absolute
file path.
*/
absPath = argv0;
} else if (argv0.contains(QLatin1Char('/'))) {
/*
If argv0 contains one or more slashes, it is a file path
relative to the current directory.
*/
absPath = QDir::current().absoluteFilePath(argv0);
} else {
/*
Otherwise, the file path has to be determined using the
PATH environment variable.
*/
QByteArray pEnv = qgetenv("PATH");
QDir currentDir = QDir::current();
QStringList paths = QString::fromLocal8Bit(pEnv.constData()).split(QLatin1String(":"));
for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) {
if ((*p).isEmpty())
continue;
QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0);
QFileInfo candidate_fi(candidate);
if (candidate_fi.exists() && !candidate_fi.isDir()) {
absPath = candidate;
break;
}
}
}
absPath = QDir::cleanPath(absPath);
QFileInfo fi(absPath);
AppDir = fi.exists() ? fi.canonicalFilePath() : QString();
}
AppDir.truncate(AppDir.lastIndexOf("/"));
DataDir=AppDir+"/../share/keepassx";
HomeDir = QDir::homePath()+"/.keepassx";
}

@ -19,8 +19,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QApplication>
#include <QDir>
#include <windows.h>
#include "main.h"

@ -17,53 +17,18 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include <QToolButton>
#include <QToolBar>
#include <QMenuBar>
#include <QAction>
#include <QImage>
#include <QClipboard>
#include <QApplication>
#include <QColor>
#include <QLocale>
#include <QMessageBox>
#include <QPixmap>
#include <QDropEvent>
#include <QLabel>
#include <QShowEvent>
#include <QWidget>
#include <QFileDialog>
#include <QStatusBar>
//#include "KpxFirefox.h"
#include "lib/random.h"
#include "mainwindow.h"
#include "lib/AutoType.h"
#include "lib/FileDialogs.h"
#include "lib/bookmarks.h"
#include "import/Import_PwManager.h"
#include "import/Import_KWalletXml.h"
#include "import/Import_KeePassX_Xml.h"
#include "export/Export_Txt.h"
#include "export/Export_KeePassX_Xml.h"
#include "dialogs/AboutDlg.h"
#include "dialogs/SearchDlg.h"
#include "dialogs/SettingsDlg.h"
#include "dialogs/DatabaseSettingsDlg.h"
#include "dialogs/PasswordDlg.h"
#include "dialogs/SimplePasswordDlg.h"
#include "dialogs/PasswordGenDlg.h"
#include "dialogs/CollectEntropyDlg.h"
#include "dialogs/CustomizeDetailViewDlg.h"
#include "dialogs/ExpiredEntriesDlg.h"
//#include "dialogs/TrashCanDlg.h" //TODO TrashCan
#include "dialogs/AddBookmarkDlg.h"
#include "dialogs/ManageBookmarksDlg.h"
#include <iostream>
#include "dialogs/dialogs.h"
Import_KeePassX_Xml import_KeePassX_Xml;
Import_PwManager import_PwManager;
@ -408,25 +373,29 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
config->setLastKeyType(PASSWORD);
}
db=dynamic_cast<IDatabase*>(new Kdb3Database());
CPasswordDialog PasswordDlg(this,filename,db,(IsAuto&&!InUnLock),false);
PasswordDialog::DlgFlags flags=PasswordDialog::Flag_None;
if(IsAuto)
flags = PasswordDialog::Flag_Auto;
PasswordDialog dlg(this,PasswordDialog::Mode_Ask,flags,filename);
if (InUnLock){
PasswordDlg.setWindowModality(Qt::WindowModal);
unlockDlg = &PasswordDlg;
dlg.setWindowModality(Qt::WindowModal);
unlockDlg = &dlg;
}
bool rejected = (PasswordDlg.exec()==QDialog::Rejected);
bool rejected = (dlg.exec()==PasswordDialog::Exit_Cancel);
if (InUnLock)
unlockDlg = NULL;
if (rejected)
return false;
if(PasswordDlg.BookmarkFilename!=QString())
filename=PasswordDlg.BookmarkFilename;
if(dlg.selectedBookmark()!=QString())
filename=dlg.selectedBookmark();
GroupView->db=db;
EntryView->db=db;
setupDatabaseConnections(db);
QString err;
StatusBarGeneral->setText(tr("Loading Database..."));
db->setKey(dlg.password(),dlg.keyFile());
if(db->load(filename)==true){
if (IsLocked)
resetLock();
@ -442,10 +411,10 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
StatusBarGeneral->setText(tr("Loading Failed"));
QString error=db->getError();
if(error.isEmpty())error=tr("Unknown error while loading database.");
QMessageBox::critical(this,tr("Error")
,QString("%1\n%2").arg(tr("The following error occured while opening the database:"))
.arg(error));
if(dynamic_cast<IFilePasswordAuth*>(db)->isKeyError()){
QMessageBox::critical(this,tr("Error"),
QString("%1\n%2").arg(tr("The following error occured while opening the database:"))
.arg(error));
if(db->isKeyError()){
delete db;
return openDatabase(filename,IsAuto);
}
@ -510,14 +479,14 @@ bool KeepassMainWindow::closeDatabase(bool lock){
void KeepassMainWindow::OnFileNewKdb(){
IDatabase* db_new=dynamic_cast<IDatabase*>(new Kdb3Database());
db_new->create();
CPasswordDialog dlg(this,QString(),db_new,false,true);
dlg.setWindowTitle(tr("New Database"));
if(dlg.exec()==1){
PasswordDialog dlg(this,PasswordDialog::Mode_Set,PasswordDialog::Flag_None,"New Database");
if(dlg.exec()==PasswordDialog::Exit_Ok){
if(FileOpen)
if(!closeDatabase())return;
if (IsLocked)
resetLock();
db=dynamic_cast<IDatabase*>(db_new);
db=db_new;
db->setKey(dlg.password(),dlg.keyFile());
setWindowTitle(QString("[%1][*] - KeePassX").arg(tr("new")));
GroupView->db=db;
EntryView->db=db;
@ -533,7 +502,6 @@ void KeepassMainWindow::OnFileNewKdb(){
else{
delete db_new;
}
}
// TODO Kxdb
@ -854,9 +822,13 @@ void KeepassMainWindow::OnFileSettings(){
}
void KeepassMainWindow::OnFileChangeKey(){
CPasswordDialog dlg(this,QString(),db,false,true);
if(dlg.exec())
QFile* file=db->file();
QString filename = file ? file->fileName() : QString();
PasswordDialog dlg(this,PasswordDialog::Mode_Change,PasswordDialog::Flag_None,filename);
if(dlg.exec()==PasswordDialog::Exit_Ok){
setStateFileModified(true);
db->setKey(dlg.password(),dlg.keyFile());
}
}
void KeepassMainWindow::OnFileExit(){
@ -875,25 +847,24 @@ void KeepassMainWindow::OnImport(QAction* action){
IDatabase* tmpdb=dynamic_cast<IDatabase*>(new Kdb3Database());
tmpdb->create();
if(dynamic_cast<IImport*>(action->data().value<QObject*>())->importDatabase(this,tmpdb)){
CPasswordDialog dlg(this,QString(),tmpdb,false,true);
dlg.setWindowTitle(tr("Set Master Key"));
if(!dlg.exec()){
delete tmpdb;
return;
}
db=tmpdb;
GroupView->db=db;
EntryView->db=db;
setupDatabaseConnections(db);
setWindowTitle(QString("[%1][*] - KeePassX").arg(tr("new")));
GroupView->createItems();
EntryView->showGroup(NULL);
setStateFileOpen(true);
setStateFileModified(true);
PasswordDialog dlg(this,PasswordDialog::Mode_Set,PasswordDialog::Flag_None,QString());
if(dlg.exec()!=PasswordDialog::Exit_Ok){
delete tmpdb;
return;
}
db=tmpdb;
db->setKey(dlg.password(),dlg.keyFile());
GroupView->db=db;
EntryView->db=db;
setupDatabaseConnections(db);
setWindowTitle(QString("[%1][*] - KeePassX").arg(tr("new")));
GroupView->createItems();
EntryView->showGroup(NULL);
setStateFileOpen(true);
setStateFileModified(true);
}
else
delete tmpdb;
}
/*

@ -21,27 +21,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QImage>
#include <QPixmap>
#include <QPainter>
#include <QFont>
#include <QLabel>
#include <QTime>
#include <QApplication>
#include <QShowEvent>
#include <QTranslator>
#include <QDropEvent>
#include <QListWidget>
#include <QTreeWidget>
#include <QClipboard>
#include <QTimer>
#include <QToolButton>
#include <QSystemTrayIcon>
//#include <QAssistantClient> //TODO HelpBrowser
#include <QUrl>
#include "Kdb3Database.h"
#include "KpxConfig.h"
#include "lib/EntryView.h"
#include "lib/GroupView.h"
#include "export/Export.h"

@ -1,5 +1,5 @@
CONFIG = qt uic resources thread stl warn_off
CONFIG = qt uic resources thread stl warn_off precompile_header
QT += xml
DEPENDPATH += crypto dialogs export forms import lib translations res
@ -10,102 +10,102 @@ UI_DIR = ../build/ui
OBJECTS_DIR = ../build
RCC_DIR = ../build/rcc
isEqual(DEBUG,1) {
CONFIG += debug
isEqual(DEBUG,1){
CONFIG += debug
}
else {
CONFIG += release
CONFIG += release
}
win32:QMAKE_WIN32 = 1
win32 : QMAKE_WIN32 = 1
#-------------------------------------------------------------------------------
# Platform Specific: Unix (except MacOS X)
#-------------------------------------------------------------------------------
unix : !macx : !isEqual(QMAKE_WIN32,1) {
isEmpty(PREFIX):PREFIX = /usr
!isEqual(AUTOTYPE,0) {
DEFINES += AUTOTYPE
!isEqual(GLOBAL_AUTOTYPE,0) {
DEFINES += GLOBAL_AUTOTYPE
unix : !macx : !isEqual(QMAKE_WIN32,1){
isEmpty(PREFIX): PREFIX = /usr
!isEqual(AUTOTYPE,0){
DEFINES += AUTOTYPE
!isEqual(GLOBAL_AUTOTYPE,0){
DEFINES += GLOBAL_AUTOTYPE
}
}
TARGET = ../bin/keepassx
target.path = $${PREFIX}/bin
data.files += ../share/keepassx
data.path = $${PREFIX}/share
pixmaps.files = ../share/pixmaps/*
pixmaps.path = $${PREFIX}/share/pixmaps
desktop.files = ../share/applications/*
desktop.path = $${PREFIX}/share/applications
INSTALLS += pixmaps desktop
contains(DEFINES,AUTOTYPE){
LIBS += -lXtst
SOURCES += lib/HelperX11.cpp lib/AutoType_X11.cpp
HEADERS += lib/HelperX11.h
}
contains(DEFINES,GLOBAL_AUTOTYPE){
SOURCES += Application_X11.cpp
HEADERS += Application_X11.h
}
SOURCES += main_unix.cpp
}
}
TARGET = ../bin/keepassx
target.path = $${PREFIX}/bin
data.files = ../share/keepassx
data.path = $${PREFIX}/share
pixmaps.files = ../share/pixmaps/*
pixmaps.path = $${PREFIX}/share/pixmaps
desktop.files = ../share/applications/*
desktop.path = $${PREFIX}/share/applications
INSTALLS += pixmaps desktop
contains(DEFINES,AUTOTYPE) {
LIBS += -lXtst
SOURCES += lib/HelperX11.cpp lib/AutoType_X11.cpp
HEADERS += lib/HelperX11.h
}
contains(DEFINES,GLOBAL_AUTOTYPE) {
SOURCES += Application_X11.cpp
HEADERS += Application_X11.h
}
SOURCES += main_unix.cpp
}
#-------------------------------------------------------------------------------
# Platform Specific: MacOS X
#-------------------------------------------------------------------------------
macx {
isEmpty(PREFIX):PREFIX = /Applications
isEmpty(PREFIX): PREFIX = /Applications
TARGET = ../bin/KeePassX
target.path = $${PREFIX}
data.files = ../share/keepassx
data.files += ../share/keepassx
data.path = Contents/Resources
LIBS += -framework CoreFoundation
isEqual(LINK,DYNAMIC) {
isEmpty(QT_FRAMEWORK_DIR) : QT_FRAMEWORK_DIR = /Library/Frameworks
private_frameworks.files += $${QT_FRAMEWORK_DIR}/QtCore.framework
private_frameworks.files += $${QT_FRAMEWORK_DIR}/QtGui.framework
private_frameworks.files += $${QT_FRAMEWORK_DIR}/QtXml.framework
private_frameworks.path = Contents/Frameworks
QMAKE_BUNDLE_DATA += private_frameworks
isEqual(LINK,DYNAMIC){
isEmpty(QT_FRAMEWORK_DIR): QT_FRAMEWORK_DIR = /Library/Frameworks
private_frameworks.files += $${QT_FRAMEWORK_DIR}/QtCore.framework
private_frameworks.files += $${QT_FRAMEWORK_DIR}/QtGui.framework
private_frameworks.files += $${QT_FRAMEWORK_DIR}/QtXml.framework
private_frameworks.path = Contents/Frameworks
QMAKE_BUNDLE_DATA += private_frameworks
}
isEqual(LINK,STATIC){
LIBS += -framework Carbon -framework AppKit -lz
LIBS += -framework Carbon -framework AppKit -lz
}
QMAKE_BUNDLE_DATA += data
ICON = ../share/macx_bundle/icon.icns
CONFIG += app_bundle
isEqual(ARCH,UNIVERSAL) : CONFIG += x86 ppc
isEqual(ARCH,INTEL) : CONFIG += x86
isEqual(ARCH,PPC) : CONFIG += ppc
SOURCES += main_macx.cpp
isEqual(ARCH,UNIVERSAL): CONFIG += x86 ppc
isEqual(ARCH,INTEL): CONFIG += x86
isEqual(ARCH,PPC): CONFIG += ppc
SOURCES += main_macx.cpp
}
#-------------------------------------------------------------------------------
# Platform Specific: Windows
#-------------------------------------------------------------------------------
isEqual(QMAKE_WIN32,1) {
isEqual(QMAKE_WIN32,1){
CONFIG += windows
isEmpty(PREFIX):PREFIX = "C:/Program files/KeePassX"
isEmpty(PREFIX): PREFIX = "C:/Program files/KeePassX"
TARGET = ../bin/KeePassX
target.path = $${PREFIX}
data.files = ../share/keepassx/*
data.files += ../share/keepassx/*
data.path = $${PREFIX}/share
!isEqual(INSTALL_QTLIB,0) {
!isEqual(INSTALL_QTLIB,0){
qt_libs.files = $${QMAKE_LIBDIR_QT}/QtCore4.dll $${QMAKE_LIBDIR_QT}/QtGui4.dll $${QMAKE_LIBDIR_QT}/QtXml4.dll
qt_libs.path = $${PREFIX}
INSTALLS += qt_libs
}
RC_FILE = ../share/win_ico/keepassx.rc
QMAKE_LINK_OBJECT_SCRIPT = $${OBJECTS_DIR}/$${QMAKE_LINK_OBJECT_SCRIPT}
SOURCES += main_win32.cpp
SOURCES += main_win32.cpp
}
INSTALLS += target data
contains(DEFINES,GLOBAL_AUTOTYPE) {
contains(DEFINES,GLOBAL_AUTOTYPE){
FORMS += forms/AutoTypeDlg.ui
HEADERS += dialogs/AutoTypeDlg.h
SOURCES += dialogs/AutoTypeDlg.cpp
@ -180,7 +180,6 @@ HEADERS += lib/UrlLabel.h \
lib/GroupView.h \
lib/EntryView.h \
crypto/arcfour.h \
lib/KpFileIconProvider.h \
crypto/aes_edefs.h \
crypto/aes_tdefs.h \
crypto/aes.h \
@ -200,7 +199,9 @@ HEADERS += lib/UrlLabel.h \
# KpxFirefox.h \
dialogs/AddBookmarkDlg.h \
lib/bookmarks.h \
dialogs/ManageBookmarksDlg.h
dialogs/ManageBookmarksDlg.h \
dialogs/dialogs.h
SOURCES += lib/UrlLabel.cpp \
main.cpp \
mainwindow.cpp \
@ -240,12 +241,7 @@ SOURCES += lib/UrlLabel.cpp \
lib/EntryView.cpp \
lib/FileDialogs.cpp \
crypto/arcfour.cpp \
lib/KpFileIconProvider.cpp \
lib/ShortcutWidget.cpp \
crypto/aescrypt.c \
crypto/aeskey.c \
crypto/aestab.c \
crypto/aes_modes.c \
crypto/sha256.cpp \
crypto/yarrow.cpp \
lib/WaitAnimationWidget.cpp \
@ -253,6 +249,12 @@ SOURCES += lib/UrlLabel.cpp \
# KpxFirefox.cpp \
dialogs/AddBookmarkDlg.cpp \
lib/bookmarks.cpp \
dialogs/ManageBookmarksDlg.cpp
dialogs/ManageBookmarksDlg.cpp \
crypto/aescrypt.c \
crypto/aeskey.c \
crypto/aes_modes.c \
crypto/aestab.c
PRECOMPILED_HEADER = keepassx.h
RESOURCES += res/resources.qrc