git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@6 b624d157-de02-0410-bad0-e51aec6abb33
master
tariq 18 years ago
parent 28c71dfe1e
commit c83a68ed4e
  1. 16
      src/Database.cpp
  2. 31
      src/Database.h
  3. 95
      src/PwManager.cpp
  4. 23
      src/PwManager.h
  5. 3
      src/PwmConfig.cpp
  6. 2
      src/crypto/blowfish.h
  7. 14
      src/dialogs/AboutDlg.cpp
  8. 5
      src/dialogs/AboutDlg.h
  9. 19
      src/dialogs/ChangeKeyDlg.cpp
  10. 6
      src/dialogs/ChangeKeyDlg.h
  11. 15
      src/dialogs/DatabaseSettingsDlg.cpp
  12. 6
      src/dialogs/DatabaseSettingsDlg.h
  13. 185
      src/dialogs/EditEntryDlg.cpp
  14. 33
      src/dialogs/EditEntryDlg.h
  15. 7
      src/dialogs/EditGroupDlg.cpp
  16. 2
      src/dialogs/EditGroupDlg.h
  17. 26
      src/dialogs/LanguageDlg.cpp
  18. 5
      src/dialogs/LanguageDlg.h
  19. 34
      src/dialogs/PasswordDlg.cpp
  20. 18
      src/dialogs/PasswordDlg.h
  21. 41
      src/dialogs/PasswordGenDlg.cpp
  22. 12
      src/dialogs/PasswordGenDlg.h
  23. 50
      src/dialogs/SearchDlg.cpp
  24. 18
      src/dialogs/SearchDlg.h
  25. 54
      src/dialogs/SettingsDlg.cpp
  26. 6
      src/dialogs/SettingsDlg.h
  27. 3
      src/dialogs/SimplePasswordDlg.cpp
  28. 2
      src/dialogs/SimplePasswordDlg.h
  29. 3
      src/import/Import_KWalletXml.cpp
  30. 4
      src/import/Import_PwManager.cpp
  31. 4
      src/lib/SecString.cpp
  32. 1
      src/lib/UrlLabel.h
  33. 3
      src/lib/random.cpp
  34. 311
      src/main.cpp
  35. 1436
      src/mainwindow.cpp
  36. 184
      src/mainwindow.h
  37. 47
      src/src.pro
  38. 918
      src/translations/english.ts
  39. 1280
      src/translations/russian.ts

@ -24,10 +24,10 @@
CEntry::CEntry(){
ImageID=0;
GroupID=0;
Creation.SetToNow();
LastMod.SetToNow();
LastAccess.SetToNow();
Expire.Set(28,12,2999,0,0,0);
Creation=QDateTime::currentDateTime();
LastMod=QDateTime::currentDateTime();
LastAccess=QDateTime::currentDateTime();
Expire=QDateTime(QDate(2999,12,28),QTime(23,59,59));
BinaryDataLength=0;
pBinaryData=NULL;
}
@ -35,10 +35,10 @@ pBinaryData=NULL;
bool CGroup::UI_ExpandByDefault=true;
CGroup::CGroup(){
Creation.SetToNow();
LastAccess.SetToNow();
LastMod.SetToNow();
Expire.Set(1,1,2999,0,0,0);
Creation=QDateTime::currentDateTime();
LastAccess=QDateTime::currentDateTime();
LastMod=QDateTime::currentDateTime();
Expire=QDateTime(QDate(2999,12,28),QTime(23,59,59));
Level=0;
ImageID=0;
Name="<Group>";

@ -21,8 +21,9 @@
#define _DATABASE_H_
#include <vector.h>
#include "lib/PwmTime.h"
#include <QDateTime>
#include "lib/SecString.h"
using namespace std;
class CEntry{
public:
@ -38,10 +39,10 @@ QString UserName;
SecString Password;
QString Additional;
QString BinaryDesc;
CPwmTime Creation;
CPwmTime LastMod;
CPwmTime LastAccess;
CPwmTime Expire;
QDateTime Creation;
QDateTime LastMod;
QDateTime LastAccess;
QDateTime Expire;
Q_UINT8 *pBinaryData;
Q_UINT32 BinaryDataLength;
Q_UINT32 PasswordLength;
@ -57,10 +58,10 @@ Q_UINT32 ID;
Q_UINT32 ImageID;
Q_UINT32 NumEntries;
QString Name;
CPwmTime Creation;
CPwmTime LastMod;
CPwmTime LastAccess;
CPwmTime Expire;
QDateTime Creation;
QDateTime LastMod;
QDateTime LastAccess;
QDateTime Expire;
Q_UINT16 Level;
Q_UINT32 Flags;
bool ReadGroupField(Q_UINT16 FieldType, Q_UINT32 FieldSize, Q_UINT8 *pData);
@ -75,21 +76,15 @@ typedef vector<CEntry>::iterator EntryItr;
typedef vector<CGroup>::iterator GroupItr;
class AbstractDatabase{
public:
vector<CGroup>Groups;
vector<CEntry>Entries;
};
class Database:public AbstractDatabase{
class Database{
public:
Q_UINT32 CryptoAlgorithmus;
Q_UINT32 KeyEncRounds;
QString filename;
bool modflag;
int SearchGroupID;
vector<CGroup>Groups;
vector<CEntry>Entries;
protected:
Q_UINT8 MasterKey[32];

@ -19,7 +19,7 @@
***************************************************************************/
#include "global.h"
#include <iostream.h>
#include <iostream>
#include <time.h>
#include <qfile.h>
#include <qstringlist.h>
@ -29,10 +29,27 @@
#include "crypto/rijndael.h"
#include "crypto/twoclass.h"
#include "lib/random.h"
using namespace std;
#include "PwManager.h"
QString PwDatabase::getError(){
if(Errors.size()){
QString r=Errors.front();
Errors.pop_front();
return r;
}
else return QString(trUtf8("unbekannter Fehler"));
}
QString PwDatabase::getErrors(){
QString r;
for(int i=0; i<Errors.size(); i++){
r+=Errors[i];
r+='\n';
}
Errors.clear();
return r;
}
bool PwDatabase::loadDatabase(QString _filename, QString& err){
unsigned long total_size,crypto_size;
@ -110,7 +127,7 @@ else if(CryptoAlgorithmus == ALGO_TWOFISH)
total_size - DB_HEADER_SIZE, (Q_UINT8 *)buffer + DB_HEADER_SIZE);
}
if((crypto_size > 2147483446) || (crypto_size == 0)){err=trUtf8("Unerwarteter Wert für 'crypto_size'"); return false;}
if((crypto_size > 2147483446) || (crypto_size == 0)){err=trUtf8("Entschlüsselung nicht möglich - der Schlüssel ist falsch oder die Datei beschädigt."); return false;}
sha256_starts(&sha32);
sha256_update(&sha32,(unsigned char *)buffer + DB_HEADER_SIZE,crypto_size);
@ -418,16 +435,16 @@ bool CGroup::ReadGroupField(Q_UINT16 FieldType, Q_UINT32 FieldSize, Q_UINT8 *pDa
Name=QString::fromUtf8((char*)pData);
break;
case 0x0003:
Creation.Set(pData);
Creation=dateFromPackedStruct5(pData);
break;
case 0x0004:
LastMod.Set(pData);
LastMod=dateFromPackedStruct5(pData);
break;
case 0x0005:
LastAccess.Set(pData);
LastAccess=dateFromPackedStruct5(pData);
break;
case 0x0006:
Expire.Set(pData);
Expire=dateFromPackedStruct5(pData);
break;
case 0x0007:
memcpyFromLEnd32(&ImageID, (char*)pData);
@ -491,16 +508,16 @@ switch(FieldType)
Additional=QString::fromUtf8((char*)pData);
break;
case 0x0009:
Creation.Set(pData);
Creation=dateFromPackedStruct5(pData);
break;
case 0x000A:
LastMod.Set(pData);
LastMod=dateFromPackedStruct5(pData);
break;
case 0x000B:
LastAccess.Set(pData);
LastAccess=dateFromPackedStruct5(pData);
break;
case 0x000C:
Expire.Set(pData);
Expire=dateFromPackedStruct5(pData);
break;
case 0x000D:
BinaryDesc=(char*)pData;
@ -527,13 +544,13 @@ switch(FieldType)
return true; // Field processed
}
bool PwDatabase::CloseDataBase(){
bool PwDatabase::closeDatabase(){
Groups.clear();
Entries.clear();
return true;
}
bool PwDatabase::SaveDataBase(QString filename){
bool PwDatabase::saveDatabase(){
CGroup SearchGroup;
Q_UINT32 NumGroups,NumEntries,Signature1,Signature2,Flags,Version;
Q_UINT8 TrafoRandomSeed[32];
@ -604,22 +621,22 @@ for(int i=0; i < Groups.size(); i++){
FieldType = 0x0003; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Groups[i].Creation.GetPackedTime((unsigned char*)buffer+pos);pos += 5;
dateToPackedStruct5(Groups[i].Creation,(unsigned char*)buffer+pos); pos += 5;
FieldType = 0x0004; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Groups[i].LastMod.GetPackedTime((unsigned char*)buffer+pos);pos += 5;
dateToPackedStruct5(Groups[i].LastMod,(unsigned char*)buffer+pos);pos += 5;
FieldType = 0x0005; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Groups[i].LastAccess.GetPackedTime((unsigned char*)buffer+pos);pos += 5;
dateToPackedStruct5(Groups[i].LastAccess,(unsigned char*)buffer+pos);pos += 5;
FieldType = 0x0006; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Groups[i].Expire.GetPackedTime((unsigned char*)buffer+pos);pos += 5;
dateToPackedStruct5(Groups[i].Expire,(unsigned char*)buffer+pos);pos += 5;
FieldType = 0x0007; FieldSize = 4;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
@ -692,23 +709,23 @@ for(int i = 0; i < Entries.size(); i++){
FieldType = 0x0009; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Entries[i].Creation.GetPackedTime((unsigned char*)buffer+pos); pos+=5;
dateToPackedStruct5(Entries[i].Creation,(unsigned char*)buffer+pos); pos+=5;
FieldType = 0x000A; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Entries[i].LastMod.GetPackedTime((unsigned char*)buffer+pos); pos+=5;
dateToPackedStruct5(Entries[i].LastMod,(unsigned char*)buffer+pos); pos+=5;
FieldType = 0x000B; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Entries[i].LastAccess.GetPackedTime((unsigned char*)buffer+pos); pos+=5;
dateToPackedStruct5(Entries[i].LastAccess,(unsigned char*)buffer+pos); pos+=5;
FieldType = 0x000C; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4;
Entries[i].Expire.GetPackedTime((unsigned char*)buffer+pos); pos+=5;
dateToPackedStruct5(Entries[i].Expire,(unsigned char*)buffer+pos); pos+=5;
FieldType = 0x000D;
FieldSize = Entries[i].BinaryDesc.utf8().length() + 1; // Add terminating NULL character space
@ -797,18 +814,6 @@ if(SearchGroupID!=-1)Groups.push_back(SearchGroup);
return true;
}
bool PwDatabase::NewDataBase(){
filename="";
SearchGroupID=-1;
CryptoAlgorithmus=ALGO_AES;
KeyEncRounds=6000;
CGroup g;
g.ID=1;
g.Name=QObject::trUtf8("Standardgruppe");
Groups.push_back(g);
}
GroupItr PwDatabase::getGroupIterator(CGroup* pGroup){
//for(vector<CGroup>::iterator i=Groups.begin();i!=Groups.end();i++){
//if((*i).ID==pGroup->ID)return i;}
@ -961,3 +966,27 @@ void memcpyFromLEnd16(Q_UINT16* dst,char* src){
memcpy(dst+0,src+1,1);
#endif
}
const QDateTime Date_Never(QDate(2999,12,28),QTime(23,59,59));
QDateTime dateFromPackedStruct5(const unsigned char* pBytes){
Q_UINT32 dw1, dw2, dw3, dw4, dw5;
dw1 = (Q_UINT32)pBytes[0]; dw2 = (Q_UINT32)pBytes[1]; dw3 = (Q_UINT32)pBytes[2];
dw4 = (Q_UINT32)pBytes[3]; dw5 = (Q_UINT32)pBytes[4];
int y = (dw1 << 6) | (dw2 >> 2);
int mon = ((dw2 & 0x00000003) << 2) | (dw3 >> 6);
int d = (dw3 >> 1) & 0x0000001F;
int h = ((dw3 & 0x00000001) << 4) | (dw4 >> 4);
int min = ((dw4 & 0x0000000F) << 2) | (dw5 >> 6);
int s = dw5 & 0x0000003F;
return QDateTime(QDate(y,mon,d),QTime(h,min));
}
void dateToPackedStruct5(const QDateTime& d,unsigned char* pBytes){
pBytes[0] = (Q_UINT8)(((Q_UINT32)d.date().year() >> 6) & 0x0000003F);
pBytes[1] = (Q_UINT8)((((Q_UINT32)d.date().year() & 0x0000003F) << 2) | (((Q_UINT32)d.date().month() >> 2) & 0x00000003));
pBytes[2] = (Q_UINT8)((((Q_UINT32)d.date().month() & 0x00000003) << 6) | (((Q_UINT32)d.date().day() & 0x0000001F) << 1) | (((Q_UINT32)d.time().hour() >> 4) & 0x00000001));
pBytes[3] = (Q_UINT8)((((Q_UINT32)d.time().hour() & 0x0000000F) << 4) | (((Q_UINT32)d.time().minute() >> 2) & 0x0000000F));
pBytes[4] = (Q_UINT8)((((Q_UINT32)d.time().minute() & 0x00000003) << 6) | ((Q_UINT32)d.time().second() & 0x0000003F));
}

@ -17,9 +17,10 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PW_MANAGER_H_
#define _PW_MANAGER_H_
#define DB_HEADER_SIZE 124
#define DB_HEADER_SIZE 124
#define PWM_DBSIG_1 0x9AA2D903
#define PWM_DBSIG_2 0xB54BFB65
#define PWM_DBVER_DW 0x00030002
@ -30,12 +31,14 @@
#define PWM_STD_KEYENCROUNDS 6000
#define ALGO_AES 0
#define ALGO_TWOFISH 1
#define KEEPASS_VERSION "0.1.3"
#include <qcolor.h>
#include <qobject.h>
#include <QDateTime>
#include <QDate>
#include <QTime>
#include <QStringList>
#include "lib/SecString.h"
#include "lib/PwmTime.h"
#include "Database.h"
@ -45,9 +48,8 @@ public:
PwDatabase();
~ PwDatabase();
bool loadDatabase(QString filename, QString& err);
bool SaveDataBase(QString filename);
bool NewDataBase();
bool CloseDataBase();
bool saveDatabase();
bool closeDatabase();
bool CalcMasterKeyByPassword(QString& password);
bool CalcMasterKeyByFile(QString filename);
bool CalcMasterKeyByFileAndPw(QString filename, QString& password);
@ -59,7 +61,9 @@ public:
EntryItr deleteEntry(CEntry* pEntry);
void moveEntry(CEntry* pEntry,CGroup* pDstGroup);
CEntry* addEntry();
void merge(PwDatabase* db2);
void merge(PwDatabase* db2);
QString getError(); //get first error
QString getErrors(); //get all errors in a \n seperated String
@ -75,9 +79,14 @@ private:
Q_UINT32 getNewGroupId();
Q_UINT32 getNewEntrySid();
bool convHexToBinaryKey(char* HexKey, char* dst);
QStringList Errors;
};
extern const QDateTime Date_Never;
void memcpyFromLEnd32(Q_UINT32* dst,char* src);
void memcpyFromLEnd16(Q_UINT16* dst,char* src);
QDateTime dateFromPackedStruct5(const unsigned char* pBytes);
void dateToPackedStruct5(const QDateTime& datetime, unsigned char* dst);
#endif

@ -21,7 +21,8 @@
#include "PwmConfig.h"
#include <qobject.h>
#include <qdir.h>
#include <iostream.h>
#include <iostream>
using namespace std;
bool CConfig::loadFromIni(QString filename){
CIniFile ini((char*)filename.data());

@ -16,7 +16,7 @@
#define BLOWFISH_H
#include "global.h"
#include <stdint.h>
//#include <stdint.h>
#include <string>
using std::string;

@ -18,20 +18,20 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include <qmessagebox.h>
#include <q3scrollview.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qfile.h>
#include "main.h"
#include "AboutDlg.h"
CAboutDialog::CAboutDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: AboutDlg(parent,name, modal,fl)
: QDialog(parent,name, modal,fl)
{
mainwnd=((CMainWindow*)parentWidget());
mainwnd->CreateBanner(Banner,mainwnd->Icon_Key32x32,trUtf8("Keepass für Linux"));
setupUi(this);
createBanner(Banner,Icon_Key32x32,trUtf8("Keepass für Linux"));
Link_Homepage=new LinkLabel(this,"Link_Homepage",trUtf8("http://keepass.de.vu"),80,143);
Link_EMail=new LinkLabel(this,"Link_EMail",trUtf8("tarek.saidi@arcor.de"),80,163);
Link_License=new LinkLabel(this,"Link_License",trUtf8("Lizenz"),80,183);
@ -60,7 +60,7 @@ QDialog dlg(this,NULL,true);
Q3ScrollView scroll(&dlg);
QLabel label(&scroll,"License-Scroll");
scroll.addChild(&label);
QFile gpl(((CMainWindow*)parentWidget())->appdir+"/../share/keepass/license.txt");
QFile gpl(AppDir+"/../share/keepass/license.txt");
if(!gpl.exists()){
QMessageBox::critical(this,trUtf8("Fehler"),trUtf8("Die Datei '%1' konnte nicht gefunden werden.")
.arg("'license.txt'")+"\n"+trUtf8("Die Anwendung wurde möglicherweiße nicht korrekt installiert.")
@ -89,10 +89,10 @@ delete buffer;
}
void CAboutDialog::OnHomepageClicked(){
mainwnd->OpenURL("http://keepass.de.vu");
openBrowser(tr("http://keepass.berlios.de/index.php"));
}
void CAboutDialog::OnEMailClicked(){
mainwnd->OpenURL("mailto:tarek.saidi@arcor.de");
openBrowser("mailto:tarek.saidi@arcor.de");
}

@ -21,11 +21,11 @@
#define _ABOUTDIALOG_H_
#include "ui_AboutDlg.h"
#include "lib/UrlLabel.h"
#include "mainwindow.h"
#include "main.h"
class CAboutDialog : public AboutDlg
class CAboutDialog : public QDialog, public Ui_AboutDlg
{
Q_OBJECT
@ -34,7 +34,6 @@ public:
CAboutDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CAboutDialog();
CMainWindow* mainwnd;
/*$PUBLIC_FUNCTIONS$*/
public slots:

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include "main.h"
#include "PwManager.h"
#include "../lib/random.h"
#include "ChangeKeyDlg.h"
@ -33,12 +33,21 @@
CChangeKeyDlg::CChangeKeyDlg(QWidget* parent,PwDatabase* _db,const char* name, bool modal, Qt::WFlags fl)
: ChangeKeyDialog(parent,name, modal,fl)
: QDialog(parent,name, modal,fl)
{
setupUi(this);
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
connect( Button_Browse, SIGNAL( clicked() ), this, SLOT( OnBrowse() ) );
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
connect( Edit_Password_2, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPassword2Changed(const QString&) ) );
connect( Combo_Dirs, SIGNAL( activated(int) ), this, SLOT( OnComboChanged(int) ) );
connect( CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBoxChanged(int) ) );
connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoMode() ) );
db=_db;
parentwnd=((CMainWindow*)parentWidget());
parentwnd->CreateBanner(Banner,parentwnd->Icon_Key32x32,trUtf8("Hauptschlüssel ändern"));
if(!parentwnd->config->ShowPasswords)ChangeEchoMode();
createBanner(Banner,Icon_Key32x32,trUtf8("Hauptschlüssel ändern"));
if(!config.ShowPasswords)ChangeEchoMode();
///@PlatformSpecific
QDir media("/media");
if(media.exists()){

@ -17,15 +17,16 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#ifndef _CHANGEKEYDLG_H_
#define _CHANGEKEYDLG_H_
#include "ui_ChangeKeyDlg.h"
#include <qstringlist.h>
#include <q3valuelist.h>
#include <qfile.h>
#include "main.h"
#include "PwManager.h"
class CChangeKeyDlg : public ChangeKeyDialog
class CChangeKeyDlg : public QDialog, public Ui_ChangeKeyDialog
{
Q_OBJECT
@ -57,7 +58,6 @@ public slots:
private:
PwDatabase* db;
CMainWindow* parentwnd;
QStringList Paths;
Q3ValueList<bool> IsFile;

@ -22,14 +22,17 @@
#include <qmessagebox.h>
//Added by qt3to4:
#include <QShowEvent>
#include "mainwindow.h"
#include "main.h"
#include "DatabaseSettingsDlg.h"
CDbSettingsDlg::CDbSettingsDlg(CMainWindow* parent,Database* db, const char* name, bool modal, Qt::WFlags fl)
: dbsettingdlg_base(parent,name, modal,fl)
CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,Database* db, const char* name, bool modal, Qt::WFlags fl)
: QDialog(parent,name, modal,fl)
{
setupUi(this);
database=db;
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
}
CDbSettingsDlg::~CDbSettingsDlg()
@ -38,7 +41,7 @@ CDbSettingsDlg::~CDbSettingsDlg()
void CDbSettingsDlg::showEvent(QShowEvent *event){
if(event->spontaneous()==false){
((CMainWindow*)parentWidget())->CreateBanner(Banner,((CMainWindow*)parentWidget())->Icon_Settings32x32,"Einstellungen");
createBanner(Banner,Icon_Settings32x32,"Einstellungen");
ComboAlgo->insertItem(trUtf8("AES(Rijndael): 256 Bit (Standard)"),0);
ComboAlgo->insertItem(trUtf8("Twofish: 256 Bit"),1);
ComboAlgo->setCurrentItem(database->CryptoAlgorithmus); //Achtung: AlgoID muss gleich dem ComboBox Index sein!
@ -49,7 +52,7 @@ EditRounds->setText(QString::number(database->KeyEncRounds));
void CDbSettingsDlg::OnCancel()
{
close();
done(0);
}
@ -72,7 +75,7 @@ return;
database->KeyEncRounds=rounds;
database->CryptoAlgorithmus=ComboAlgo->currentItem();
close();
done(1);
}

@ -20,17 +20,17 @@
#ifndef DBSETTINGSDLG_H
#define DBSETTINGSDLG_H
#include "ui_DatabaseSettingsDlg.h"
#include "mainwindow.h"
#include "main.h"
#include "Database.h"
//Added by qt3to4:
#include <QShowEvent>
class CDbSettingsDlg : public dbsettingdlg_base
class CDbSettingsDlg : public QDialog, public Ui_dbsettingdlg_base
{
Q_OBJECT
public:
CDbSettingsDlg(CMainWindow* parent,Database* db,const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
CDbSettingsDlg(QWidget* parent,Database* db,const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CDbSettingsDlg();
virtual void showEvent(QShowEvent *);
/*$PUBLIC_FUNCTIONS$*/

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include "main.h"
#include <qpushbutton.h>
#include <qpalette.h>
@ -43,72 +43,97 @@
CEditEntryDlg::CEditEntryDlg(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: EditEntryDialog(parent,name, modal,fl)
CEditEntryDlg::CEditEntryDlg(PwDatabase* _db, CEntry* _entry,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: QDialog(parent,name, modal,fl)
{
pw=((CMainWindow*)parentWidget())->db;
mainwnd=((CMainWindow*)parentWidget());
mainwnd->CreateBanner(Banner,mainwnd->Icon_Key32x32,trUtf8("Eintrag bearbeiten"));
Q_ASSERT(_db);
Q_ASSERT(_entry);
entry=_entry;
db=_db;
setupUi(this);
createBanner(Banner,Icon_Key32x32,trUtf8("Eintrag bearbeiten"));
ModFlag=false;
}
CEditEntryDlg::~CEditEntryDlg()
{
connect(Edit_Password_w, SIGNAL(editingFinished()), this, SLOT(OnPasswordwLostFocus()));
connect(Edit_Password_w, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordwTextChanged(const QString&)));
connect(Edit_Password, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordTextChanged(const QString&)));
connect(ButtonEchoMode, SIGNAL(clicked()), this, SLOT( ChangeEchoMode()));
connect(ButtonCancel, SIGNAL(clicked()), this, SLOT( OnButtonCancel()));
connect(ButtonOpenAttachment, SIGNAL(clicked()), this, SLOT( OnNewAttachment()));
connect(ButtonDeleteAttachment, SIGNAL(clicked()), this, SLOT( OnDeleteAttachment()));
connect(ButtonSaveAttachment, SIGNAL(clicked()), this, SLOT( OnSaveAttachment()));
connect(ButtonGenPw, SIGNAL(clicked()), this, SLOT( OnButtonGenPw()));
connect(ButtonOK, SIGNAL(clicked()),this,SLOT(OnButtonOK()));
connect(CheckBox_ExpiresNever,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxExpiresNeverChanged(int)));
ButtonOpenAttachment->setIcon(*Icon_FileOpen);
ButtonDeleteAttachment->setIcon(*Icon_EditDelete);
ButtonSaveAttachment->setIcon(*Icon_FileSave);
}
void CEditEntryDlg::showEvent(QShowEvent *event){
if(event->spontaneous()==false){
if(entry->pBinaryData==NULL){
ButtonSaveAttachment->setDisabled(true);
ButtonDeleteAttachment->setDisabled(true);
}
ButtonSaveAttachment->setDisabled(true);
ButtonDeleteAttachment->setDisabled(true);}
setCaption(entry->Title);
setIcon(mainwnd->EntryIcons[entry->ImageID]);
setIcon(EntryIcons[entry->ImageID]);
Edit_Title->setText(entry->Title);
Edit_UserName->setText(entry->UserName);
Edit_URL->setText(entry->URL);
Edit_Password->setText(entry->Password.getString());
Edit_Password_w->setText(entry->Password.getString());
entry->Password.delRef();
if(!mainwnd->config->ShowPasswords)ChangeEchoMode();
if(!config.ShowPasswords)
ChangeEchoMode();
OnPasswordwLostFocus();
int bits=(entry->Password.length()*8);
Label_Bits->setText(QString::number(bits)+" Bit");
if(bits>128)bits=128;
Progress_Quali->setProgress(bits,128);
Progress_Quali->setPercentageVisible(false);
if(bits>128)
bits=128;
Progress_Quali->setValue(100*bits/128);
Edit_Attachment->setText(entry->BinaryDesc);
Edit_Comment->setText(entry->Additional);
InitGroupComboBox();
InitIconComboBox();
Edit_Expire_Date->setText((entry->Expire.GetString(0)).mid(0,10));
Edit_Expire_Time->setText((entry->Expire.GetString(0)).mid(11,8));
if(entry->BinaryDataLength==0){
Label_AttachmentSize->setText("");
}
else
{
QString unit;
int faktor;
int prec;
if(entry->BinaryDataLength==0)
Label_AttachmentSize->setText("");
else{
QString unit;
int faktor;
int prec;
if(entry->BinaryDataLength<1000){unit=" Byte";faktor=1;prec=0;}
else {if(entry->BinaryDataLength<1000000){unit=" kB";faktor=1000;prec=1;}
else{unit=" MB";faktor=1000000;prec=1;}
}
Label_AttachmentSize->setText(QString::number((float)entry->BinaryDataLength/(float)faktor,'f',prec)+unit);
}
Label_AttachmentSize->setText(QString::number((float)entry->BinaryDataLength/(float)faktor,'f',prec)+unit);
}
if(entry->Expire==Date_Never){
DateTime_Expire->setDisabled(true);
CheckBox_ExpiresNever->setChecked(true);
}
else{
DateTime_Expire->setDateTime(entry->Expire);
}
}
CEditEntryDlg::~CEditEntryDlg()
{
}
void CEditEntryDlg::showEvent(QShowEvent *event){
if(event->spontaneous()==false){
}
}
void CEditEntryDlg::InitIconComboBox(){
for(int i=0;i<52;i++){
Combo_IconPicker->insertItem(((CMainWindow*)parentWidget())->EntryIcons[i],"",i);
Combo_IconPicker->insertItem(EntryIcons[i],"",i);
}
Combo_IconPicker->setCurrentItem(entry->ImageID);
}
@ -117,38 +142,26 @@ Combo_IconPicker->setCurrentItem(entry->ImageID);
void CEditEntryDlg::InitGroupComboBox(){
QString tmp;
int i;
for(i=0;i!=pw->Groups.size();i++){
for(i=0;i!=db->Groups.size();i++){
tmp="";
for(int j=0;j<pw->Groups[i].Level;j++)tmp+=" ";
Combo_Group->insertItem(((CMainWindow*)parentWidget())->EntryIcons[pw->Groups[i].ImageID],
tmp+pw->Groups[i].Name,i);
for(int j=0;j<db->Groups[i].Level;j++)tmp+=" ";
Combo_Group->insertItem(EntryIcons[db->Groups[i].ImageID],
tmp+db->Groups[i].Name,i);
}
Combo_Group->setCurrentItem(pw->getGroupIndex(entry->GroupID));
Combo_Group->setCurrentItem(db->getGroupIndex(entry->GroupID));
}
void CEditEntryDlg::OnButtonOK()
{
if(QString::compare(Edit_Password->text(),Edit_Password_w->text())!=0){
QMessageBox::warning(NULL,"Stopp",QString::fromUtf8("Passwort und Passwortwiederholung stimmen\nnicht überein."),"OK");
return;
}
QString str=Edit_Expire_Date->text();
if(CPwmTime::IsValidDate(str)==false){
QMessageBox::warning(NULL,"Stopp",QString::fromUtf8(str+" ist kein gültiges Datum."),"OK");
return;
}
str=Edit_Expire_Time->text();
if(CPwmTime::IsValidTime(str)==false){
QMessageBox::warning(NULL,"Stopp",QString::fromUtf8(str+" ist keine gültige Uhrzeit."),"OK");
return;
}
if(CheckBox_ExpiresNever->state()==Qt::Checked){
DateTime_Expire->setDateTime(Date_Never);}
CPwmTime tmp_Expire;
tmp_Expire.SetDate(Edit_Expire_Date->text());
tmp_Expire.SetTime(Edit_Expire_Time->text());
if(tmp_Expire!=entry->Expire)
if(DateTime_Expire->dateTime()!=entry->Expire)
ModFlag=true;
if(entry->Title!=Edit_Title->text())
ModFlag=true;
@ -163,18 +176,17 @@ if(passw!=Edit_Password->text())
ModFlag=true;
entry->Password.delRef();
entry->Expire.SetDate(Edit_Expire_Date->text());
entry->Expire.SetTime(Edit_Expire_Time->text());
entry->LastAccess.SetToNow();
if(ModFlag)entry->LastMod.SetToNow();
entry->Expire=DateTime_Expire->dateTime();
entry->LastAccess=QDateTime::currentDateTime();
if(ModFlag)entry->LastMod=QDateTime::currentDateTime();
entry->Title=Edit_Title->text();
entry->UserName=Edit_UserName->text();
entry->URL=Edit_URL->text();
QString s=Edit_Password->text();
entry->Password.setString(s,true);
entry->Additional=Edit_Comment->text();
if(Combo_Group->currentItem()!=pw->getGroupIndex(entry->GroupID)){
pw->moveEntry(entry,&pw->Groups[Combo_Group->currentItem()]);
if(Combo_Group->currentItem()!=db->getGroupIndex(entry->GroupID)){
db->moveEntry(entry,&db->Groups[Combo_Group->currentItem()]);
}
entry->ImageID=Combo_IconPicker->currentItem();
done(1);
@ -182,7 +194,7 @@ done(1);
void CEditEntryDlg::OnButtonCancel()
{
entry->LastAccess.SetToNow();
entry->LastAccess=QDateTime::currentDateTime();
done(0);
}
@ -207,7 +219,7 @@ Edit_Password_w->setText("");
int bits=(Edit_Password->text().length()*8);
Label_Bits->setText(QString::number(bits)+" Bit");
if(bits>128)bits=128;
Progress_Quali->setProgress(bits,128);
Progress_Quali->setValue(100*bits/128);
}
void CEditEntryDlg::OnPasswordwTextChanged(const QString& w)
@ -237,30 +249,6 @@ Edit_Password_w->setPaletteBackgroundColor(QColor(255,255,255)); ///@FIXME Stand
}
void CEditEntryDlg::OnExpDateLostFocus()
{
QString str=Edit_Expire_Date->text();
if(CPwmTime::IsValidDate(str)==false){
Edit_Expire_Date->setPaletteBackgroundColor(QColor(255,125,125));
}
else
{
Edit_Expire_Date->setPaletteBackgroundColor(QColor(255,255,255));///@FIXME Standart-Hintergrundfarbe nicht weiß
}
}
void CEditEntryDlg::OnExpTimeLostFocus()
{
QString str=Edit_Expire_Time->text();
if(CPwmTime::IsValidTime(str)==false){
Edit_Expire_Time->setPaletteBackgroundColor(QColor(255,125,125));
}
else
{
Edit_Expire_Time->setPaletteBackgroundColor(QColor(255,255,255));///@FIXME Standart-Hintergrundfarbe nicht weiß
}
}
void CEditEntryDlg::OnNewAttachment()
{
QString filename=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Anhang hinzufügen..."));
@ -355,12 +343,15 @@ pDlg->show();
}
void CEditEntryDlg::OnCheckBoxExpiresNeverChanged(int state){
if(state==Qt::Unchecked){
DateTime_Expire->setDisabled(false);
}
else
{
DateTime_Expire->setDisabled(true);
}
}

@ -17,20 +17,21 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#ifndef EDITENTRYDLG_H
#define EDITENTRYDLG_H
#include "ui_EditEntryDlg.h"
//Added by qt3to4:
#include <QPixmap>
#include <QShowEvent>
#include "main.h"
#include "PwManager.h"
class CEditEntryDlg : public EditEntryDialog
class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
{
Q_OBJECT
public:
CEditEntryDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0);
CEditEntryDlg(PwDatabase* _db, CEntry* _entry,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0);
~CEditEntryDlg();
virtual void showEvent(QShowEvent *);
/*$PUBLIC_FUNCTIONS$*/
@ -46,9 +47,8 @@ protected slots:
/*$PROTECTED_SLOTS$*/
public:
CMainWindow* mainwnd;
CEntry* entry;
PwDatabase* pw;
PwDatabase* db;
QPixmap* banner_pixmap;
bool ModFlag;
@ -59,17 +59,16 @@ void InitIconComboBox();
public slots:
virtual void OnExpTimeLostFocus();
virtual void OnExpDateLostFocus();
virtual void OnPasswordwLostFocus();
virtual void OnPasswordwTextChanged(const QString&);
virtual void OnPasswordTextChanged(const QString&);
virtual void ChangeEchoMode();
virtual void OnButtonCancel();
virtual void OnNewAttachment();
virtual void OnDeleteAttachment();
virtual void OnSaveAttachment();
virtual void OnButtonGenPw();
void OnPasswordwLostFocus();
void OnPasswordwTextChanged(const QString&);
void OnPasswordTextChanged(const QString&);
void ChangeEchoMode();
void OnButtonCancel();
void OnNewAttachment();
void OnDeleteAttachment();
void OnSaveAttachment();
void OnButtonGenPw();
void OnCheckBoxExpiresNeverChanged(int state);
};

@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include "main.h"
#include <qcombobox.h>
#include <qlineedit.h>
@ -28,8 +28,9 @@
CEditGroupDialog::CEditGroupDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: EditGroupDialog(parent,name, modal,fl)
: QDialog(parent,name, modal,fl)
{
setupUi(this);
IconID=0;
}
@ -41,7 +42,7 @@ void CEditGroupDialog::showEvent(QShowEvent *event){
if(event->spontaneous()==false){
EditTitle->setText(GroupName);
for(int i=0;i<52;i++){
ComboIconPicker->insertItem(((CMainWindow*)parentWidget())->EntryIcons[i],"",i);
ComboIconPicker->insertItem(EntryIcons[i],"",i);
}
ComboIconPicker->setCurrentItem(IconID);
}}

@ -26,7 +26,7 @@
//Added by qt3to4:
#include <QShowEvent>
class CEditGroupDialog : public EditGroupDialog
class CEditGroupDialog : public QDialog, public Ui_EditGroupDialog
{
Q_OBJECT

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include "main.h"
#include "LanguageDlg.h"
#include <qtranslator.h>
#include <qdir.h>
@ -26,7 +26,8 @@
#include <qmessagebox.h>
//Added by qt3to4:
#include <QShowEvent>
#include <iostream.h>
#include <iostream>
using namespace std;
const char* infostrings[]={
QT_TRANSLATE_NOOP("_INFO","$TRANSL_AUTHOR"),
@ -38,23 +39,24 @@ const char* msg[]={QT_TRANSLATE_NOOP("_MSG","Die Änderung der Sprache wird erst
QT_TRANSLATE_NOOP("_MSG","Hinweis")};
CLanguageDlg::CLanguageDlg(QWidget* parent, const char* name, Qt::WFlags fl)
: LanguageDlg(parent,name,fl)
: QDialog(parent,name,fl)
{
parentwnd=((CMainWindow*)parentWidget());
parentwnd->CreateBanner(Banner,parentwnd->Icon_I18n32x32,trUtf8("Spracheinstellungen"));
setupUi(this);
createBanner(Banner,Icon_I18n32x32,trUtf8("Spracheinstellungen"));
Q3ListViewItem* item;
QString& config_lang=parentwnd->config->Language;
QString& config_lang=config.Language;
QStringList files;
QString langdir=parentwnd->appdir+"/../share/keepass/i18n/";
QString langdir=AppDir+"/../share/keepass/i18n/";
QDir dir(langdir);
if(dir.exists()){
files=dir.entryList("*.qm",QDir::Files);
}
List->insertItem(item=new Q3ListViewItem(List,"","Deutsch","-","-"));
if(config_lang=="_DEUTSCH_")item->setPixmap(0,*parentwnd->Icon_Ok16x16);
if(config_lang=="_DEUTSCH_")item->setPixmap(0,*Icon_Ok16x16);
pItems.push_back(item);
filenames.push_back("_DEUTSCH_");
@ -67,7 +69,7 @@ QTranslator translator;
List->insertItem(item=new Q3ListViewItem(List,"",translator.translate("_INFO","$TRANSL_LANGUAGE")
,translator.translate("_INFO","$TRANSL_VERSION")
,translator.translate("_INFO","$TRANSL_AUTHOR")));
if(config_lang==files[i])item->setPixmap(0,*parentwnd->Icon_Ok16x16);
if(config_lang==files[i])item->setPixmap(0,*Icon_Ok16x16);
pItems.push_back(item);
filenames.push_back(files[i]);
}
@ -96,7 +98,7 @@ void CLanguageDlg::OnItemRightClick(Q3ListViewItem* item)
void CLanguageDlg::OnItemDoubleClicked(Q3ListViewItem* item) // == Slot für Button "wählen"
{
int i;
QString langdir=parentwnd->appdir+"/../share/keepass/i18n/";
QString langdir=AppDir+"/../share/keepass/i18n/";
for(i=0;i<pItems.size();i++){
if(item==pItems[i])break;
@ -116,10 +118,10 @@ QMessageBox::information(this,translator.translate("_MSG",msg[2])
,0,0,0);
}
else QMessageBox::information(this,QString::fromUtf8(msg[2]),QString::fromUtf8(msg[0]),QString::fromUtf8(msg[1]),0,0,2,1);
parentwnd->config->Language=filenames[i];
config.Language=filenames[i];
for(int j=0;j<pItems.size();j++){
if(j==i)pItems[j]->setPixmap(0,*parentwnd->Icon_Ok16x16);
if(j==i)pItems[j]->setPixmap(0,*Icon_Ok16x16);
else pItems[j]->setPixmap(0,0);}
List->setColumnWidth(0,20);

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include "main.h"
#ifndef _LANGUAGEDLG_H_
#define _LANGUAGEDLG_H_
#include "ui_LanguageDlg.h"
@ -27,14 +27,13 @@
class CLanguageDlg : public LanguageDlg
class CLanguageDlg : public QDialog, public Ui_LanguageDlg
{
Q_OBJECT
public:
CLanguageDlg(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0 );
~CLanguageDlg();
CMainWindow* parentwnd;
vector<QString> filenames;
vector<Q3ListViewItem*> pItems;
/*$PUBLIC_FUNCTIONS$*/

@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "mainwindow.h"
#include "main.h"
#include "PasswordDlg.h"
#include <qdir.h>
@ -34,12 +34,20 @@
CPasswordDialog::CPasswordDialog(QWidget* par