git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@6 b624d157-de02-0410-bad0-e51aec6abb33
master
tariq 19 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(){ CEntry::CEntry(){
ImageID=0; ImageID=0;
GroupID=0; GroupID=0;
Creation.SetToNow(); Creation=QDateTime::currentDateTime();
LastMod.SetToNow(); LastMod=QDateTime::currentDateTime();
LastAccess.SetToNow(); LastAccess=QDateTime::currentDateTime();
Expire.Set(28,12,2999,0,0,0); Expire=QDateTime(QDate(2999,12,28),QTime(23,59,59));
BinaryDataLength=0; BinaryDataLength=0;
pBinaryData=NULL; pBinaryData=NULL;
} }
@ -35,10 +35,10 @@ pBinaryData=NULL;
bool CGroup::UI_ExpandByDefault=true; bool CGroup::UI_ExpandByDefault=true;
CGroup::CGroup(){ CGroup::CGroup(){
Creation.SetToNow(); Creation=QDateTime::currentDateTime();
LastAccess.SetToNow(); LastAccess=QDateTime::currentDateTime();
LastMod.SetToNow(); LastMod=QDateTime::currentDateTime();
Expire.Set(1,1,2999,0,0,0); Expire=QDateTime(QDate(2999,12,28),QTime(23,59,59));
Level=0; Level=0;
ImageID=0; ImageID=0;
Name="<Group>"; Name="<Group>";

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

@ -19,7 +19,7 @@
***************************************************************************/ ***************************************************************************/
#include "global.h" #include "global.h"
#include <iostream.h> #include <iostream>
#include <time.h> #include <time.h>
#include <qfile.h> #include <qfile.h>
#include <qstringlist.h> #include <qstringlist.h>
@ -29,10 +29,27 @@
#include "crypto/rijndael.h" #include "crypto/rijndael.h"
#include "crypto/twoclass.h" #include "crypto/twoclass.h"
#include "lib/random.h" #include "lib/random.h"
using namespace std;
#include "PwManager.h" #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){ bool PwDatabase::loadDatabase(QString _filename, QString& err){
unsigned long total_size,crypto_size; 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); 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_starts(&sha32);
sha256_update(&sha32,(unsigned char *)buffer + DB_HEADER_SIZE,crypto_size); 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); Name=QString::fromUtf8((char*)pData);
break; break;
case 0x0003: case 0x0003:
Creation.Set(pData); Creation=dateFromPackedStruct5(pData);
break; break;
case 0x0004: case 0x0004:
LastMod.Set(pData); LastMod=dateFromPackedStruct5(pData);
break; break;
case 0x0005: case 0x0005:
LastAccess.Set(pData); LastAccess=dateFromPackedStruct5(pData);
break; break;
case 0x0006: case 0x0006:
Expire.Set(pData); Expire=dateFromPackedStruct5(pData);
break; break;
case 0x0007: case 0x0007:
memcpyFromLEnd32(&ImageID, (char*)pData); memcpyFromLEnd32(&ImageID, (char*)pData);
@ -491,16 +508,16 @@ switch(FieldType)
Additional=QString::fromUtf8((char*)pData); Additional=QString::fromUtf8((char*)pData);
break; break;
case 0x0009: case 0x0009:
Creation.Set(pData); Creation=dateFromPackedStruct5(pData);
break; break;
case 0x000A: case 0x000A:
LastMod.Set(pData); LastMod=dateFromPackedStruct5(pData);
break; break;
case 0x000B: case 0x000B:
LastAccess.Set(pData); LastAccess=dateFromPackedStruct5(pData);
break; break;
case 0x000C: case 0x000C:
Expire.Set(pData); Expire=dateFromPackedStruct5(pData);
break; break;
case 0x000D: case 0x000D:
BinaryDesc=(char*)pData; BinaryDesc=(char*)pData;
@ -527,13 +544,13 @@ switch(FieldType)
return true; // Field processed return true; // Field processed
} }
bool PwDatabase::CloseDataBase(){ bool PwDatabase::closeDatabase(){
Groups.clear(); Groups.clear();
Entries.clear(); Entries.clear();
return true; return true;
} }
bool PwDatabase::SaveDataBase(QString filename){ bool PwDatabase::saveDatabase(){
CGroup SearchGroup; CGroup SearchGroup;
Q_UINT32 NumGroups,NumEntries,Signature1,Signature2,Flags,Version; Q_UINT32 NumGroups,NumEntries,Signature1,Signature2,Flags,Version;
Q_UINT8 TrafoRandomSeed[32]; Q_UINT8 TrafoRandomSeed[32];
@ -604,22 +621,22 @@ for(int i=0; i < Groups.size(); i++){
FieldType = 0x0003; FieldSize = 5; FieldType = 0x0003; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x0004; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x0005; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x0006; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x0007; FieldSize = 4;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
@ -692,23 +709,23 @@ for(int i = 0; i < Entries.size(); i++){
FieldType = 0x0009; FieldSize = 5; FieldType = 0x0009; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x000A; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x000B; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x000C; FieldSize = 5;
memcpy(buffer+pos, &FieldType, 2); pos += 2; memcpy(buffer+pos, &FieldType, 2); pos += 2;
memcpy(buffer+pos, &FieldSize, 4); pos += 4; 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; FieldType = 0x000D;
FieldSize = Entries[i].BinaryDesc.utf8().length() + 1; // Add terminating NULL character space 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; 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){ GroupItr PwDatabase::getGroupIterator(CGroup* pGroup){
//for(vector<CGroup>::iterator i=Groups.begin();i!=Groups.end();i++){ //for(vector<CGroup>::iterator i=Groups.begin();i!=Groups.end();i++){
//if((*i).ID==pGroup->ID)return 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); memcpy(dst+0,src+1,1);
#endif #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., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef _PW_MANAGER_H_ #ifndef _PW_MANAGER_H_
#define _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_1 0x9AA2D903
#define PWM_DBSIG_2 0xB54BFB65 #define PWM_DBSIG_2 0xB54BFB65
#define PWM_DBVER_DW 0x00030002 #define PWM_DBVER_DW 0x00030002
@ -30,12 +31,14 @@
#define PWM_STD_KEYENCROUNDS 6000 #define PWM_STD_KEYENCROUNDS 6000
#define ALGO_AES 0 #define ALGO_AES 0
#define ALGO_TWOFISH 1 #define ALGO_TWOFISH 1
#define KEEPASS_VERSION "0.1.3"
#include <qcolor.h> #include <qcolor.h>
#include <qobject.h> #include <qobject.h>
#include <QDateTime>
#include <QDate>
#include <QTime>
#include <QStringList>
#include "lib/SecString.h" #include "lib/SecString.h"
#include "lib/PwmTime.h"
#include "Database.h" #include "Database.h"
@ -45,9 +48,8 @@ public:
PwDatabase(); PwDatabase();
~ PwDatabase(); ~ PwDatabase();
bool loadDatabase(QString filename, QString& err); bool loadDatabase(QString filename, QString& err);
bool SaveDataBase(QString filename); bool saveDatabase();
bool NewDataBase(); bool closeDatabase();
bool CloseDataBase();
bool CalcMasterKeyByPassword(QString& password); bool CalcMasterKeyByPassword(QString& password);
bool CalcMasterKeyByFile(QString filename); bool CalcMasterKeyByFile(QString filename);
bool CalcMasterKeyByFileAndPw(QString filename, QString& password); bool CalcMasterKeyByFileAndPw(QString filename, QString& password);
@ -59,7 +61,9 @@ public:
EntryItr deleteEntry(CEntry* pEntry); EntryItr deleteEntry(CEntry* pEntry);
void moveEntry(CEntry* pEntry,CGroup* pDstGroup); void moveEntry(CEntry* pEntry,CGroup* pDstGroup);
CEntry* addEntry(); 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 getNewGroupId();
Q_UINT32 getNewEntrySid(); Q_UINT32 getNewEntrySid();
bool convHexToBinaryKey(char* HexKey, char* dst); bool convHexToBinaryKey(char* HexKey, char* dst);
QStringList Errors;
}; };
extern const QDateTime Date_Never;
void memcpyFromLEnd32(Q_UINT32* dst,char* src); void memcpyFromLEnd32(Q_UINT32* dst,char* src);
void memcpyFromLEnd16(Q_UINT16* 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 #endif

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

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

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

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

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "main.h"
#include "PwManager.h" #include "PwManager.h"
#include "../lib/random.h" #include "../lib/random.h"
#include "ChangeKeyDlg.h" #include "ChangeKeyDlg.h"
@ -33,12 +33,21 @@
CChangeKeyDlg::CChangeKeyDlg(QWidget* parent,PwDatabase* _db,const char* name, bool modal, Qt::WFlags fl) 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; db=_db;
parentwnd=((CMainWindow*)parentWidget()); createBanner(Banner,Icon_Key32x32,trUtf8("Hauptschlüssel ändern"));
parentwnd->CreateBanner(Banner,parentwnd->Icon_Key32x32,trUtf8("Hauptschlüssel ändern")); if(!config.ShowPasswords)ChangeEchoMode();
if(!parentwnd->config->ShowPasswords)ChangeEchoMode();
///@PlatformSpecific ///@PlatformSpecific
QDir media("/media"); QDir media("/media");
if(media.exists()){ if(media.exists()){

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

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

@ -20,17 +20,17 @@
#ifndef DBSETTINGSDLG_H #ifndef DBSETTINGSDLG_H
#define DBSETTINGSDLG_H #define DBSETTINGSDLG_H
#include "ui_DatabaseSettingsDlg.h" #include "ui_DatabaseSettingsDlg.h"
#include "mainwindow.h" #include "main.h"
#include "Database.h" #include "Database.h"
//Added by qt3to4: //Added by qt3to4:
#include <QShowEvent> #include <QShowEvent>
class CDbSettingsDlg : public dbsettingdlg_base class CDbSettingsDlg : public QDialog, public Ui_dbsettingdlg_base
{ {
Q_OBJECT Q_OBJECT
public: 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(); ~CDbSettingsDlg();
virtual void showEvent(QShowEvent *); virtual void showEvent(QShowEvent *);
/*$PUBLIC_FUNCTIONS$*/ /*$PUBLIC_FUNCTIONS$*/

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "main.h"
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qpalette.h> #include <qpalette.h>
@ -43,72 +43,97 @@
CEditEntryDlg::CEditEntryDlg(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) CEditEntryDlg::CEditEntryDlg(PwDatabase* _db, CEntry* _entry,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: EditEntryDialog(parent,name, modal,fl) : QDialog(parent,name, modal,fl)
{ {
Q_ASSERT(_db);
pw=((CMainWindow*)parentWidget())->db; Q_ASSERT(_entry);
mainwnd=((CMainWindow*)parentWidget()); entry=_entry;
mainwnd->CreateBanner(Banner,mainwnd->Icon_Key32x32,trUtf8("Eintrag bearbeiten")); db=_db;
setupUi(this);
createBanner(Banner,Icon_Key32x32,trUtf8("Eintrag bearbeiten"));
ModFlag=false; ModFlag=false;
} connect(Edit_Password_w, SIGNAL(editingFinished()), this, SLOT(OnPasswordwLostFocus()));
connect(Edit_Password_w, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordwTextChanged(const QString&)));
CEditEntryDlg::~CEditEntryDlg() 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){ if(entry->pBinaryData==NULL){
ButtonSaveAttachment->setDisabled(true); ButtonSaveAttachment->setDisabled(true);
ButtonDeleteAttachment->setDisabled(true); ButtonDeleteAttachment->setDisabled(true);}
}
setCaption(entry->Title); setCaption(entry->Title);
setIcon(mainwnd->EntryIcons[entry->ImageID]); setIcon(EntryIcons[entry->ImageID]);
Edit_Title->setText(entry->Title); Edit_Title->setText(entry->Title);
Edit_UserName->setText(entry->UserName); Edit_UserName->setText(entry->UserName);
Edit_URL->setText(entry->URL); Edit_URL->setText(entry->URL);
Edit_Password->setText(entry->Password.getString()); Edit_Password->setText(entry->Password.getString());
Edit_Password_w->setText(entry->Password.getString()); Edit_Password_w->setText(entry->Password.getString());
entry->Password.delRef(); entry->Password.delRef();
if(!mainwnd->config->ShowPasswords)ChangeEchoMode(); if(!config.ShowPasswords)
ChangeEchoMode();
OnPasswordwLostFocus(); OnPasswordwLostFocus();
int bits=(entry->Password.length()*8); int bits=(entry->Password.length()*8);
Label_Bits->setText(QString::number(bits)+" Bit"); Label_Bits->setText(QString::number(bits)+" Bit");
if(bits>128)bits=128; if(bits>128)
Progress_Quali->setProgress(bits,128); bits=128;
Progress_Quali->setPercentageVisible(false); Progress_Quali->setValue(100*bits/128);
Edit_Attachment->setText(entry->BinaryDesc); Edit_Attachment->setText(entry->BinaryDesc);
Edit_Comment->setText(entry->Additional); Edit_Comment->setText(entry->Additional);
InitGroupComboBox(); InitGroupComboBox();
InitIconComboBox(); InitIconComboBox();
Edit_Expire_Date->setText((entry->Expire.GetString(0)).mid(0,10)); if(entry->BinaryDataLength==0)
Edit_Expire_Time->setText((entry->Expire.GetString(0)).mid(11,8)); Label_AttachmentSize->setText("");
if(entry->BinaryDataLength==0){ else{
Label_AttachmentSize->setText(""); QString unit;
} int faktor;
else int prec;
{
QString unit;
int faktor;
int prec;
if(entry->BinaryDataLength<1000){unit=" Byte";faktor=1;prec=0;} if(entry->BinaryDataLength<1000){unit=" Byte";faktor=1;prec=0;}
else {if(entry->BinaryDataLength<1000000){unit=" kB";faktor=1000;prec=1;} else {if(entry->BinaryDataLength<1000000){unit=" kB";faktor=1000;prec=1;}
else{unit=" MB";faktor=1000000;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(){ void CEditEntryDlg::InitIconComboBox(){
for(int i=0;i<52;i++){ 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); Combo_IconPicker->setCurrentItem(entry->ImageID);
} }
@ -117,38 +142,26 @@ Combo_IconPicker->setCurrentItem(entry->ImageID);
void CEditEntryDlg::InitGroupComboBox(){ void CEditEntryDlg::InitGroupComboBox(){
QString tmp; QString tmp;
int i; int i;
for(i=0;i!=pw->Groups.size();i++){ for(i=0;i!=db->Groups.size();i++){
tmp=""; tmp="";
for(int j=0;j<pw->Groups[i].Level;j++)tmp+=" "; for(int j=0;j<db->Groups[i].Level;j++)tmp+=" ";
Combo_Group->insertItem(((CMainWindow*)parentWidget())->EntryIcons[pw->Groups[i].ImageID], Combo_Group->insertItem(EntryIcons[db->Groups[i].ImageID],
tmp+pw->Groups[i].Name,i); tmp+db->Groups[i].Name,i);
} }
Combo_Group->setCurrentItem(pw->getGroupIndex(entry->GroupID)); Combo_Group->setCurrentItem(db->getGroupIndex(entry->GroupID));
} }
void CEditEntryDlg::OnButtonOK() void CEditEntryDlg::OnButtonOK()
{ {
if(QString::compare(Edit_Password->text(),Edit_Password_w->text())!=0){ if(QString::compare(Edit_Password->text(),Edit_Password_w->text())!=0){
QMessageBox::warning(NULL,"Stopp",QString::fromUtf8("Passwort und Passwortwiederholung stimmen\nnicht überein."),"OK"); QMessageBox::warning(NULL,"Stopp",QString::fromUtf8("Passwort und Passwortwiederholung stimmen\nnicht überein."),"OK");
return; 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(CheckBox_ExpiresNever->state()==Qt::Checked){
if(CPwmTime::IsValidTime(str)==false){ DateTime_Expire->setDateTime(Date_Never);}
QMessageBox::warning(NULL,"Stopp",QString::fromUtf8(str+" ist keine gültige Uhrzeit."),"OK");
return;
}
CPwmTime tmp_Expire; if(DateTime_Expire->dateTime()!=entry->Expire)
tmp_Expire.SetDate(Edit_Expire_Date->text());
tmp_Expire.SetTime(Edit_Expire_Time->text());
if(tmp_Expire!=entry->Expire)
ModFlag=true; ModFlag=true;
if(entry->Title!=Edit_Title->text()) if(entry->Title!=Edit_Title->text())
ModFlag=true; ModFlag=true;
@ -163,18 +176,17 @@ if(passw!=Edit_Password->text())
ModFlag=true; ModFlag=true;
entry->Password.delRef(); entry->Password.delRef();
entry->Expire.SetDate(Edit_Expire_Date->text()); entry->Expire=DateTime_Expire->dateTime();
entry->Expire.SetTime(Edit_Expire_Time->text()); entry->LastAccess=QDateTime::currentDateTime();
entry->LastAccess.SetToNow(); if(ModFlag)entry->LastMod=QDateTime::currentDateTime();
if(ModFlag)entry->LastMod.SetToNow();
entry->Title=Edit_Title->text(); entry->Title=Edit_Title->text();
entry->UserName=Edit_UserName->text(); entry->UserName=Edit_UserName->text();
entry->URL=Edit_URL->text(); entry->URL=Edit_URL->text();
QString s=Edit_Password->text(); QString s=Edit_Password->text();
entry->Password.setString(s,true); entry->Password.setString(s,true);
entry->Additional=Edit_Comment->text(); entry->Additional=Edit_Comment->text();
if(Combo_Group->currentItem()!=pw->getGroupIndex(entry->GroupID)){ if(Combo_Group->currentItem()!=db->getGroupIndex(entry->GroupID)){
pw->moveEntry(entry,&pw->Groups[Combo_Group->currentItem()]); db->moveEntry(entry,&db->Groups[Combo_Group->currentItem()]);
} }
entry->ImageID=Combo_IconPicker->currentItem(); entry->ImageID=Combo_IconPicker->currentItem();
done(1); done(1);
@ -182,7 +194,7 @@ done(1);
void CEditEntryDlg::OnButtonCancel() void CEditEntryDlg::OnButtonCancel()
{ {
entry->LastAccess.SetToNow(); entry->LastAccess=QDateTime::currentDateTime();
done(0); done(0);
} }
@ -207,7 +219,7 @@ Edit_Password_w->setText("");
int bits=(Edit_Password->text().length()*8); int bits=(Edit_Password->text().length()*8);
Label_Bits->setText(QString::number(bits)+" Bit"); Label_Bits->setText(QString::number(bits)+" Bit");
if(bits>128)bits=128; if(bits>128)bits=128;
Progress_Quali->setProgress(bits,128); Progress_Quali->setValue(100*bits/128);
} }
void CEditEntryDlg::OnPasswordwTextChanged(const QString& w) 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() void CEditEntryDlg::OnNewAttachment()
{ {
QString filename=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Anhang hinzufügen...")); 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., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h"
#ifndef EDITENTRYDLG_H #ifndef EDITENTRYDLG_H
#define EDITENTRYDLG_H #define EDITENTRYDLG_H
#include "ui_EditEntryDlg.h" #include "ui_EditEntryDlg.h"
//Added by qt3to4:
#include <QPixmap> #include <QPixmap>
#include <QShowEvent> #include <QShowEvent>
#include "main.h"
#include "PwManager.h"
class CEditEntryDlg : public EditEntryDialog class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
{ {
Q_OBJECT Q_OBJECT
public: 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(); ~CEditEntryDlg();
virtual void showEvent(QShowEvent *); virtual void showEvent(QShowEvent *);
/*$PUBLIC_FUNCTIONS$*/ /*$PUBLIC_FUNCTIONS$*/
@ -46,9 +47,8 @@ protected slots:
/*$PROTECTED_SLOTS$*/ /*$PROTECTED_SLOTS$*/
public: public:
CMainWindow* mainwnd;
CEntry* entry; CEntry* entry;
PwDatabase* pw; PwDatabase* db;
QPixmap* banner_pixmap; QPixmap* banner_pixmap;
bool ModFlag; bool ModFlag;
@ -59,17 +59,16 @@ void InitIconComboBox();
public slots: public slots:
virtual void OnExpTimeLostFocus(); void OnPasswordwLostFocus();
virtual void OnExpDateLostFocus(); void OnPasswordwTextChanged(const QString&);
virtual void OnPasswordwLostFocus(); void OnPasswordTextChanged(const QString&);
virtual void OnPasswordwTextChanged(const QString&); void ChangeEchoMode();
virtual void OnPasswordTextChanged(const QString&); void OnButtonCancel();
virtual void ChangeEchoMode(); void OnNewAttachment();
virtual void OnButtonCancel(); void OnDeleteAttachment();
virtual void OnNewAttachment(); void OnSaveAttachment();
virtual void OnDeleteAttachment(); void OnButtonGenPw();
virtual void OnSaveAttachment(); void OnCheckBoxExpiresNeverChanged(int state);
virtual void OnButtonGenPw();
}; };

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

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

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

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

@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "main.h"
#include "PasswordDlg.h" #include "PasswordDlg.h"
#include <qdir.h> #include <qdir.h>
@ -34,12 +34,20 @@
CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: PasswordDlg(parent,name, modal,fl) : QDialog(parent,name, modal,fl)
{ {
parentwnd=((CMainWindow*)parentWidget()); setupUi(this);
parentwnd->CreateBanner(Banner,parentwnd->Icon_Key32x32,trUtf8("Datenbank öffnen")); createBanner(Banner,Icon_Key32x32,trUtf8("Datenbank öffnen"));
Label_select=new LinkLabel((QWidget*)groupframe,"Select",trUtf8("Datei manuell wählen..."),410,100); Label_select=new LinkLabel((QWidget*)groupframe,"Select",trUtf8("Datei manuell wählen..."),410,100);
connect(Label_select,SIGNAL(clicked()),this,SLOT(OnSelectClicked())); connect( Combo_Dirs, SIGNAL( activated(int) ), this, SLOT( OnComboSelectionChanged(int) ) );
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
connect( CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBox_BothChanged(int) ) );
connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoMode() ) );
connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
///@PlatformSpecific ///@PlatformSpecific
QDir media("/media"); QDir media("/media");
if(media.exists()){ if(media.exists()){
@ -57,7 +65,7 @@ Combo_Dirs->insertItem(0,Paths[i]);
IsFile.append(false); IsFile.append(false);
} }
if(!parentwnd->config->ShowPasswords)ChangeEchoMode(); if(!config.ShowPasswords)ChangeEchoMode();
} }
@ -116,7 +124,7 @@ QMessageBox::warning(this,"Datei nicht gefunden",QString::fromUtf8("Im gewählte
void CPasswordDialog::OnSelectClicked() void CPasswordDialog::OnSelectClicked()
{ {
if(Button_Browse->isEnabled()){ if(ButtonBrowse->isEnabled()){
keyfile=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Schlüsseldatei öffnen")); keyfile=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Schlüsseldatei öffnen"));
if(keyfile=="")return; if(keyfile=="")return;
Combo_Dirs->insertItem(keyfile); Combo_Dirs->insertItem(keyfile);
@ -133,13 +141,11 @@ IsFile.append(true);
void CPasswordDialog::OnCancel() void CPasswordDialog::OnCancel()
{ {
canceled=true; done(0);
close();
} }
void CPasswordDialog::OnOK() void CPasswordDialog::OnOK()
{ {
canceled=false;
if(CheckBox_Both->isChecked()){ if(CheckBox_Both->isChecked()){
if(password==""){QMessageBox::warning(this,trUtf8("Fehler"),trUtf8("Bitte geben Sie ein Passwort ein.") if(password==""){QMessageBox::warning(this,trUtf8("Fehler"),trUtf8("Bitte geben Sie ein Passwort ein.")
@ -155,7 +161,7 @@ else
,trUtf8("OK"),"","",0,0); ,trUtf8("OK"),"","",0,0);
return;} return;}
} }
close(); done(1);
} }
void CPasswordDialog::OnPasswordChanged(const QString &txt) void CPasswordDialog::OnPasswordChanged(const QString &txt)
@ -163,10 +169,10 @@ void CPasswordDialog::OnPasswordChanged(const QString &txt)
password=Edit_Password->text(); password=Edit_Password->text();
if(txt!="" && !(CheckBox_Both->isChecked())){ if(txt!="" && !(CheckBox_Both->isChecked())){
Combo_Dirs->setDisabled(true); Combo_Dirs->setDisabled(true);
Button_Browse->setDisabled(true);} ButtonBrowse->setDisabled(true);}
else{ else{
Combo_Dirs->setEnabled(true); Combo_Dirs->setEnabled(true);
Button_Browse->setEnabled(true);} ButtonBrowse->setEnabled(true);}
} }
@ -174,7 +180,7 @@ void CPasswordDialog::OnCheckBox_BothChanged(int state)
{ {
if(state==QCheckBox::On){ if(state==QCheckBox::On){
Combo_Dirs->setEnabled(true); Combo_Dirs->setEnabled(true);
Button_Browse->setEnabled(true); ButtonBrowse->setEnabled(true);
Edit_Password->setEnabled(true);} Edit_Password->setEnabled(true);}
else{ else{
Edit_Password->setText(""); Edit_Password->setText("");

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "main.h"
#ifndef PASSWORDDIALOG_H #ifndef PASSWORDDIALOG_H
#define PASSWORDDIALOG_H #define PASSWORDDIALOG_H
#include "lib/UrlLabel.h" #include "lib/UrlLabel.h"
@ -25,12 +25,11 @@
//Added by qt3to4: //Added by qt3to4:
#include <Q3ValueList> #include <Q3ValueList>
class CPasswordDialog : public PasswordDlg class CPasswordDialog : public QDialog, public Ui_PasswordDlg
{ {
Q_OBJECT Q_OBJECT
private: private:
CMainWindow* parentwnd;
int NumComboEntries; int NumComboEntries;
QStringList Paths; QStringList Paths;
Q3ValueList<bool> IsFile; Q3ValueList<bool> IsFile;
@ -41,7 +40,7 @@ public:
QString keyfile; QString keyfile;
QString password; QString password;
bool canceled;
public: public:
@ -51,22 +50,21 @@ public:
public slots: public slots:
/*$PUBLIC_SLOTS$*/ /*$PUBLIC_SLOTS$*/
virtual void OnOK(); virtual void OnOK();
virtual void OnCancel(); virtual void OnCancel();
virtual void OnSelectClicked(); virtual void OnSelectClicked();
virtual void OnButtonBrowse(); virtual void OnButtonBrowse();
virtual void OnComboSelectionChanged(int);
virtual void OnPasswordChanged(const QString &txt);
virtual void OnCheckBox_BothChanged(int state);
virtual void ChangeEchoMode();
protected: protected:
/*$PROTECTED_FUNCTIONS$*/ /*$PROTECTED_FUNCTIONS$*/
protected slots: protected slots:
/*$PROTECTED_SLOTS$*/ /*$PROTECTED_SLOTS$*/
public slots:
virtual void OnComboSelectionChanged(int);
virtual void OnPasswordChanged(const QString &txt);
virtual void OnCheckBox_BothChanged(int state);
virtual void ChangeEchoMode();
}; };
#endif #endif

@ -25,29 +25,29 @@
#include <qradiobutton.h> #include <qradiobutton.h>
#include <qlineedit.h> #include <qlineedit.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <q3progressbar.h> #include <QProgressBar>
CGenPwDialog::CGenPwDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) CGenPwDialog::CGenPwDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: GenPwDlg(parent,name, modal,fl) : QDialog(parent,name, modal,fl)
{ {
mainwnd=(CMainWindow*)(((CEditEntryDlg*)parentWidget())->parentWidget()); setupUi(this);
mainwnd->CreateBanner(Banner,mainwnd->Icon_Key32x32,QString::fromUtf8("Passwort generieren")); createBanner(Banner,Icon_Key32x32,QString::fromUtf8("Passwort generieren"));
Radio_1->setChecked(true); Radio_1->setChecked(true);
Edit_chars->setDisabled(true); Edit_chars->setDisabled(true);
connect(ButtonGenerate,SIGNAL(clicked()),this,SLOT(OnGeneratePw()));
connect(Radio_1,SIGNAL(toggled(bool)),this,SLOT(OnRadio1StateChanged(bool)));
connect(Radio_2,SIGNAL(toggled(bool)),this,SLOT(OnRadio2StateChanged(bool)));
connect(Button_Cancel,SIGNAL(clicked()),this,SLOT(OnCancel()));
connect(ButtonOK,SIGNAL(clicked()),this,SLOT(OnAccept()));
} }
CGenPwDialog::~CGenPwDialog() CGenPwDialog::~CGenPwDialog()
{ {
} }
void CGenPwDialog::OnRadio1StateChanged(int state) void CGenPwDialog::OnRadio1StateChanged(bool state)
{ {
switch (state){ if(state){
case QCheckBox::On:
Radio_2->setChecked(false); Radio_2->setChecked(false);
checkBox1->setEnabled(true); checkBox1->setEnabled(true);
checkBox2->setEnabled(true); checkBox2->setEnabled(true);
@ -57,8 +57,7 @@ switch (state){
checkBox6->setEnabled(true); checkBox6->setEnabled(true);
checkBox7->setEnabled(true); checkBox7->setEnabled(true);
checkBox8->setEnabled(true); checkBox8->setEnabled(true);
break; }else{
case QCheckBox::Off:
if(Radio_2->isChecked()==false)Radio_2->setChecked(true); if(Radio_2->isChecked()==false)Radio_2->setChecked(true);
checkBox1->setDisabled(true); checkBox1->setDisabled(true);
checkBox2->setDisabled(true); checkBox2->setDisabled(true);
@ -68,27 +67,19 @@ switch (state){
checkBox6->setDisabled(true); checkBox6->setDisabled(true);
checkBox7->setDisabled(true); checkBox7->setDisabled(true);
checkBox8->setDisabled(true); checkBox8->setDisabled(true);
break;
case QCheckBox::NoChange:
break;
} }
} }
void CGenPwDialog::OnRadio2StateChanged(int state) void CGenPwDialog::OnRadio2StateChanged(bool state)
{ {
switch (state){ if(state){
case QCheckBox::On:
Radio_1->setChecked(false); Radio_1->setChecked(false);
Edit_chars->setEnabled(true); Edit_chars->setEnabled(true);
break; }
case QCheckBox::Off: else{
if(Radio_1->isChecked()==false)Radio_1->setChecked(true); if(Radio_1->isChecked()==false)Radio_1->setChecked(true);
Edit_chars->setDisabled(true); Edit_chars->setDisabled(true);
break;
case QCheckBox::NoChange:
break;
} }
} }

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "main.h"
#ifndef GENPWDIALOG_H #ifndef GENPWDIALOG_H
#define GENPWDIALOG_H #define GENPWDIALOG_H
#include "ui_PasswordGenDlg.h" #include "ui_PasswordGenDlg.h"
@ -25,7 +25,7 @@
class CGenPwDialog : public GenPwDlg class CGenPwDialog : public QDialog, public Ui_GenPwDlg
{ {
Q_OBJECT Q_OBJECT
private: private:
@ -44,14 +44,10 @@ protected:
protected slots: protected slots:
/*$PROTECTED_SLOTS$*/ /*$PROTECTED_SLOTS$*/
public:
CMainWindow* mainwnd;
public slots: public slots:
virtual void OnGeneratePw(); virtual void OnGeneratePw();
public slots: virtual void OnRadio2StateChanged(bool);
virtual void OnRadio2StateChanged(int); virtual void OnRadio1StateChanged(bool);
public slots:
virtual void OnRadio1StateChanged(int);
virtual void OnCancel(); virtual void OnCancel();
virtual void OnAccept(); virtual void OnAccept();
}; };

@ -18,6 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "main.h"
#include "PwManager.h" #include "PwManager.h"
#include "SearchDlg.h" #include "SearchDlg.h"
#include <qlineedit.h> #include <qlineedit.h>
@ -26,33 +27,30 @@
#include <qmessagebox.h> #include <qmessagebox.h>
CSearchDlg::CSearchDlg(CGroup* pGroup,QWidget* parent, const char* name, bool modal, Qt::WFlags fl) CSearchDlg::CSearchDlg(CGroup* pGroup,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: Search_Dlg(parent,name, modal,fl) : QDialog(parent,name, modal,fl)
{ {
parentwnd=(CMainWindow*)parent; setupUi(this);
parentwnd->CreateBanner(Banner,parentwnd->Icon_Search32x32,tr("Suchen")); createBanner(Banner,Icon_Search32x32,tr("Suchen"));
group=pGroup; checkBox_Cs->setChecked(config.SearchOptions[0]);
pw=parentwnd->db; checkBox_regExp->setChecked(config.SearchOptions[1]);
checkBox_Title->setChecked(config.SearchOptions[2]);
checkBox_Cs->setChecked(parentwnd->config->SearchOptions[0]); checkBox_Username->setChecked(config.SearchOptions[3]);
checkBox_regExp->setChecked(parentwnd->config->SearchOptions[1]); checkBox_Password->setChecked(config.SearchOptions[4]);
checkBox_Title->setChecked(parentwnd->config->SearchOptions[2]); checkBox_Comment->setChecked(config.SearchOptions[5]);
checkBox_Username->setChecked(parentwnd->config->SearchOptions[3]); checkBox_URL->setChecked(config.SearchOptions[6]);
checkBox_Password->setChecked(parentwnd->config->SearchOptions[4]); checkBox_Attachment->setChecked(config.SearchOptions[7]);
checkBox_Comment->setChecked(parentwnd->config->SearchOptions[5]);
checkBox_URL->setChecked(parentwnd->config->SearchOptions[6]);
checkBox_Attachment->setChecked(parentwnd->config->SearchOptions[7]);
} }
CSearchDlg::~CSearchDlg() CSearchDlg::~CSearchDlg()
{ {
parentwnd->config->SearchOptions[0]=checkBox_Cs->isChecked(); config.SearchOptions[0]=checkBox_Cs->isChecked();
parentwnd->config->SearchOptions[1]=checkBox_regExp->isChecked(); config.SearchOptions[1]=checkBox_regExp->isChecked();
parentwnd->config->SearchOptions[2]=checkBox_Title->isChecked(); config.SearchOptions[2]=checkBox_Title->isChecked();
parentwnd->config->SearchOptions[3]=checkBox_Username->isChecked(); config.SearchOptions[3]=checkBox_Username->isChecked();
parentwnd->config->SearchOptions[4]=checkBox_Password->isChecked(); config.SearchOptions[4]=checkBox_Password->isChecked();
parentwnd->config->SearchOptions[5]=checkBox_Comment->isChecked(); config.SearchOptions[5]=checkBox_Comment->isChecked();
parentwnd->config->SearchOptions[6]=checkBox_URL->isChecked(); config.SearchOptions[6]=checkBox_URL->isChecked();
parentwnd->config->SearchOptions[7]=checkBox_Attachment->isChecked(); config.SearchOptions[7]=checkBox_Attachment->isChecked();
} }
void CSearchDlg::OnButtonClose() void CSearchDlg::OnButtonClose()
@ -60,9 +58,9 @@ void CSearchDlg::OnButtonClose()
done(0); done(0);
} }
void CSearchDlg::OnButtonSearch() void CSearchDlg::OnButtonSearch()
{ {
/*
txt=Edit_Search->text(); txt=Edit_Search->text();
regexp=checkBox_regExp->isChecked(); regexp=checkBox_regExp->isChecked();
if(txt==""){ if(txt==""){
@ -81,8 +79,12 @@ for(int i=0;i<pw->Entries.size();i++){
pw->Entries[i].Password.delRef(); pw->Entries[i].Password.delRef();
if(hit)hits.push_back(&pw->Entries[i]); if(hit)hits.push_back(&pw->Entries[i]);
} }
*/
done(1); done(1);
} }
/*
bool CSearchDlg::search(QString& str){ bool CSearchDlg::search(QString& str){
if(regexp){ if(regexp){
QRegExp exp(txt,checkBox_Cs->isChecked()); QRegExp exp(txt,checkBox_Cs->isChecked());
@ -90,7 +92,7 @@ if(regexp){
else{ else{
if(str.contains(txt,checkBox_Cs->isChecked())==0)return false;} if(str.contains(txt,checkBox_Cs->isChecked())==0)return false;}
return true; return true;
} }*/
/*$SPECIALIZATION$*/ /*$SPECIALIZATION$*/

@ -17,17 +17,18 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h"
#ifndef SEARCHDLG_H #ifndef SEARCHDLG_H
#define SEARCHDLG_H #define SEARCHDLG_H
#include "ui_SearchDlg.h" #include "ui_SearchDlg.h"
#include "main.h"
#include "PwManager.h"
class CSearchDlg : public Search_Dlg class CSearchDlg : public QDialog, public Ui_Search_Dlg
{ {
Q_OBJECT Q_OBJECT
public: public:
CSearchDlg(CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); CSearchDlg(CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0,
bool modal = FALSE, Qt::WFlags fl = 0 );
~CSearchDlg(); ~CSearchDlg();
/*$PUBLIC_FUNCTIONS$*/ /*$PUBLIC_FUNCTIONS$*/
@ -45,18 +46,9 @@ public slots:
public slots: public slots:
virtual void OnButtonSearch(); virtual void OnButtonSearch();
private: private:
CMainWindow* parentwnd;
CGroup* group;
PwDatabase* pw;
QString txt; QString txt;
bool regexp; bool regexp;
bool search(QString&);
public:
vector<CEntry*> hits;
}; };
#endif #endif

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "main.h"
#include <qpixmap.h> #include <qpixmap.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qspinbox.h> #include <qspinbox.h>
@ -27,30 +27,28 @@
CSettingsDlg::CSettingsDlg(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) CSettingsDlg::CSettingsDlg(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: SettingsDialog(parent,name, modal,fl) : QDialog(parent,name, modal,fl)
{ {
pw=((CMainWindow*)parentWidget())->db; setupUi(this);
mainwnd=((CMainWindow*)parentWidget()); createBanner(Banner,Icon_Settings32x32,trUtf8("Einstellungen"));
mainwnd->CreateBanner(Banner,mainwnd->Icon_Settings32x32,trUtf8("Einstellungen")); CheckBox_OpenLast->setChecked(config.OpenLast);
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
CheckBox_OpenLast->setChecked(mainwnd->config->OpenLast);
SpinBox_ClipboardTime->setValue(mainwnd->config->ClipboardTimeOut);
pixmTextColor->setPixmap(*(new QPixmap(pixmTextColor->width(),pixmTextColor->height()))); pixmTextColor->setPixmap(*(new QPixmap(pixmTextColor->width(),pixmTextColor->height())));
//pixmTextColor->pixmap()->fill(mainwnd->config->BannerTextColor); //pixmTextColor->pixmap()->fill(config.BannerTextColor);
pixmColor1->setPixmap(*(new QPixmap(pixmColor1->width(),pixmColor1->height()))); pixmColor1->setPixmap(*(new QPixmap(pixmColor1->width(),pixmColor1->height())));
//pixmColor1->pixmap()->fill(mainwnd->config->BannerColor1); //pixmColor1->pixmap()->fill(config.BannerColor1);
pixmColor2->setPixmap(*(new QPixmap(pixmColor2->width(),pixmColor2->height()))); pixmColor2->setPixmap(*(new QPixmap(pixmColor2->width(),pixmColor2->height())));
//pixmColor2->pixmap()->fill(mainwnd->config->BannerColor2); //pixmColor2->pixmap()->fill(config.BannerColor2);
color1=mainwnd->config->BannerColor1; color1=config.BannerColor1;
color2=mainwnd->config->BannerColor2; color2=config.BannerColor2;
textcolor=mainwnd->config->BannerTextColor; textcolor=config.BannerTextColor;
CheckBox_ShowPasswords->setChecked(mainwnd->config->ShowPasswords); CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
Edit_BrowserCmd->setText(mainwnd->config->OpenUrlCommand); Edit_BrowserCmd->setText(config.OpenUrlCommand);
CheckBox_ExpandGroupTree->setChecked(mainwnd->config->ExpandGroupTree); CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree);
} }
@ -60,14 +58,14 @@ CSettingsDlg::~CSettingsDlg()
void CSettingsDlg::OnOK() void CSettingsDlg::OnOK()
{ {
mainwnd->config->OpenLast=CheckBox_OpenLast->isChecked(); config.OpenLast=CheckBox_OpenLast->isChecked();
mainwnd->config->ClipboardTimeOut=SpinBox_ClipboardTime->value(); config.ClipboardTimeOut=SpinBox_ClipboardTime->value();
mainwnd->config->BannerColor1=color1; config.BannerColor1=color1;
mainwnd->config->BannerColor2=color2; config.BannerColor2=color2;
mainwnd->config->BannerTextColor=textcolor; config.BannerTextColor=textcolor;
mainwnd->config->ShowPasswords=CheckBox_ShowPasswords->isChecked(); config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
mainwnd->config->OpenUrlCommand=Edit_BrowserCmd->text(); config.OpenUrlCommand=Edit_BrowserCmd->text();
mainwnd->config->ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked(); config.ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked();
close(); close();
} }
@ -85,7 +83,7 @@ QPixmap *px=new QPixmap(pixmTextColor->width(),pixmTextColor->height());
px->fill(c); px->fill(c);
pixmTextColor->clear(); pixmTextColor->clear();
pixmTextColor->setPixmap(*px); pixmTextColor->setPixmap(*px);
mainwnd->CreateBanner(Banner,mainwnd->Icon_Settings32x32,trUtf8("Einstellungen"),color1,color2,textcolor);} createBanner(Banner,Icon_Settings32x32,trUtf8("Einstellungen"),color1,color2,textcolor);}
} }
@ -98,7 +96,7 @@ QPixmap *px=new QPixmap(pixmColor2->width(),pixmColor2->height());
px->fill(c); px->fill(c);
pixmColor2->clear(); pixmColor2->clear();
pixmColor2->setPixmap(*px); pixmColor2->setPixmap(*px);
mainwnd->CreateBanner(Banner,mainwnd->Icon_Settings32x32,trUtf8("Einstellungen"),color1,color2,textcolor);} createBanner(Banner,Icon_Settings32x32,trUtf8("Einstellungen"),color1,color2,textcolor);}
} }
@ -111,7 +109,7 @@ QPixmap *px=new QPixmap(pixmColor1->width(),pixmColor1->height());
px->fill(c); px->fill(c);
pixmColor1->clear(); pixmColor1->clear();
pixmColor1->setPixmap(*px); pixmColor1->setPixmap(*px);
mainwnd->CreateBanner(Banner,mainwnd->Icon_Settings32x32,trUtf8("Einstellungen"),color1,color2,textcolor); createBanner(Banner,Icon_Settings32x32,trUtf8("Einstellungen"),color1,color2,textcolor);
} }
} }

@ -17,20 +17,18 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "main.h"
#ifndef SETTINGSDLG_H #ifndef SETTINGSDLG_H
#define SETTINGSDLG_H #define SETTINGSDLG_H
#include "ui_SettingsDlg.h" #include "ui_SettingsDlg.h"
#include <qcolor.h> #include <qcolor.h>
class CSettingsDlg : public SettingsDialog class CSettingsDlg : public QDialog, public Ui_SettingsDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
CMainWindow* mainwnd;
PwDatabase* pw;
CSettingsDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); CSettingsDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CSettingsDlg(); ~CSettingsDlg();
/*$PUBLIC_FUNCTIONS$*/ /*$PUBLIC_FUNCTIONS$*/

@ -24,8 +24,9 @@
#include <qpushbutton.h> #include <qpushbutton.h>
CSimplePasswordDialog::CSimplePasswordDialog(bool HidePw,QWidget* parent, const char* name, bool modal, Qt::WFlags fl) CSimplePasswordDialog::CSimplePasswordDialog(bool HidePw,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: SimplePasswordDialog(parent,name, modal,fl) : QDialog(parent,name, modal,fl)
{ {
setupUi(this);
if(HidePw)Button_HidePassword->toggle(); if(HidePw)Button_HidePassword->toggle();
} }

@ -23,7 +23,7 @@
#include "ui_SimplePasswordDlg.h" #include "ui_SimplePasswordDlg.h"
class CSimplePasswordDialog : public SimplePasswordDialog class CSimplePasswordDialog : public QDialog, public Ui_SimplePasswordDialog
{ {
Q_OBJECT Q_OBJECT

@ -19,10 +19,11 @@
***************************************************************************/ ***************************************************************************/
#include "Import_KWalletXml.h" #include "Import_KWalletXml.h"
#include <iostream.h> #include <iostream>
#include <qobject.h> #include <qobject.h>
#include <qfile.h> #include <qfile.h>
#include <qdom.h> #include <qdom.h>
using namespace std;
bool Import_KWalletXml::importFile(QString FileName,PwDatabase* pwm,QString& err){ bool Import_KWalletXml::importFile(QString FileName,PwDatabase* pwm,QString& err){
QFile file(FileName); QFile file(FileName);

@ -20,12 +20,12 @@
#include <qobject.h> #include <qobject.h>
#include <qfile.h> #include <qfile.h>
#include <iostream.h> #include <iostream>
#include <qdom.h> #include <qdom.h>
#include "crypto/blowfish.h" #include "crypto/blowfish.h"
#include "crypto/sha1.h" #include "crypto/sha1.h"
#include "Import_PwManager.h" #include "Import_PwManager.h"
using namespace std;
bool Import_PwManager::importFile(QString filename, QString password, PwDatabase* db, QString& err){ bool Import_PwManager::importFile(QString filename, QString password, PwDatabase* db, QString& err){
database=db; database=db;

@ -20,9 +20,9 @@
#include "SecString.h" #include "SecString.h"
#include <qmessagebox.h> #include <qmessagebox.h>
#include <iostream.h> #include <iostream>
#include "random.h" #include "random.h"
using namespace std;
Q_UINT8 SecString::Key[32]={0}; Q_UINT8 SecString::Key[32]={0};
SecString::SecString(){ SecString::SecString(){

@ -22,7 +22,6 @@
#define _LINKLABEL_H_ #define _LINKLABEL_H_
#include <qlabel.h> #include <qlabel.h>
#include <q3signal.h> #include <q3signal.h>
//Added by qt3to4:
#include <QMouseEvent> #include <QMouseEvent>
class LinkLabel : public QLabel{ class LinkLabel : public QLabel{

@ -17,11 +17,12 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <iostream.h> #include <iostream>
#include <fstream.h> #include <fstream.h>
#include <qdatetime.h> #include <qdatetime.h>
#include <qobject.h> #include <qobject.h>
#include "random.h" #include "random.h"
using namespace std;
void getRandomBytes(void* buffer,int NumBlocks,int BlockSize,bool Strong){ void getRandomBytes(void* buffer,int NumBlocks,int BlockSize,bool Strong){
FILE *dev_random; FILE *dev_random;

@ -18,51 +18,58 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <iostream.h> #include <iostream>
#include <qapplication.h> #include <qapplication.h>
#include <qlibrary.h> #include <qlibrary.h>
#include <qlocale.h> #include <qlocale.h>
#include <qdir.h> #include <qdir.h>
#include <qmessagebox.h> #include <QMessageBox>
//Added by qt3to4:
#include <QTranslator> #include <QTranslator>
#include <QPainter>
#include <QImage>
#include <QStyleFactory>
#include "pwsafe.h" #include "main.h"
#include "PwmConfig.h" #include "PwmConfig.h"
#include "lib/KdePlugin.h" #include "mainwindow.h"
using namespace std;
void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg){ CConfig config;
if(argc>1){ QString AppDir;
int i=1; QPixmap *Icon_Key32x32;
if(argv[i][0]!='-'){ QPixmap *Icon_Settings32x32;
ArgFile=QString::fromUtf8(argv[i]); QPixmap *Icon_Search32x32;
i++; QPixmap *Icon_I18n32x32;
} QPixmap *Icon_Ok16x16;
for(i; i<argc;i++){ QPixmap *EntryIcons;
if(QString(argv[i])=="-h"){ QIcon *Icon_FileNew;
cout << "Keepass 0.1.3 (Alpha)" << endl; QIcon *Icon_FileOpen;
cout << "Usage: keepass [Filename] [Options]" << endl; QIcon *Icon_FileClose;
cout << " -h This Help" << endl; QIcon *Icon_FileSave;
cout << " -cfg ConfigFile Use specified configuration" << endl; QIcon *Icon_FileSaveAs;
exit(0); QIcon *Icon_Exit;
} QIcon *Icon_File_Export;
else if(QString(argv[i])=="-cfg"){ QIcon *Icon_EditDelete;
if(i-1==argc) cout << "No configuration file specified." << endl; QString DateTimeFormat("no-format-string");
else{ArgCfg=QString::fromUtf8(argv[i+1]); i++;}
}
else{cout << "** Unrecognized option: " << argv[i] << endl; inline void loadImages();
exit(1);} inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg);
}
}
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/*
QStringList keys=QStyleFactory::keys();
for(int i=0; i<keys.size(); i++){
cout << keys[i].ascii() << endl;
}
QApplication::setStyle(QStyleFactory::create("slimplastic"));
*/
QString ArgFile,ArgCfg,IniFilename; QString ArgFile,ArgCfg,IniFilename;
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg); parseCmdLineArgs(argc,argv,ArgFile,ArgCfg);
CConfig config; QApplication* app=new QApplication(argc,argv);
AppDir=app->applicationDirPath();
//Load Config //Load Config
if(ArgCfg==""){ if(ArgCfg==""){
if(!QDir(QDir::homeDirPath()+"/.keepass").exists()){ if(!QDir(QDir::homeDirPath()+"/.keepass").exists()){
@ -73,41 +80,9 @@ if(ArgCfg==""){
IniFilename=QDir::homeDirPath()+"/.keepass/config"; IniFilename=QDir::homeDirPath()+"/.keepass/config";
config.loadFromIni(IniFilename); config.loadFromIni(IniFilename);
} }
else
{
IniFilename=ArgCfg;
config.loadFromIni(IniFilename);
}
//KDE PlugIn
QApplication* app=NULL;
if(config.EnableKdePlugin){
cout << "don't activate the kde plugin option" << endl;
exit(1);
/*
QLibrary lib("/home/tarek/Documents/keepass_kde/bin/libkeepass_kde.so");
if(!lib.load()){
cout << "Could not load KDE plugin." << endl;
exit(1);
}
CKdePlugin KdePlugin;
if(!KdePlugin.resolveSymbols(lib)){
cout << "KDE plugin: Symbols could not be resolved." << endl;
exit(1);
}
app=KdePlugin.getAppObj(argc,argv);
QApplication*(*_getAppObj)(int,char**);
_getAppObj=(QApplication*(*)(int,char**))lib.resolve("getAppObj");
app=_getAppObj(argc,argv**);
if(!app){cout << "app==NULL" << endl;
exit(1);
}
*/
}
else{ else{
app=new QApplication(argc,argv); IniFilename=ArgCfg;
} config.loadFromIni(IniFilename);}
//Internationalization //Internationalization
@ -129,6 +104,7 @@ if(config.Language==""){
config.Language="english.qm"; config.Language="english.qm";
break;} break;}
} }
if(config.Language!="_DEUTSCH_"){ if(config.Language!="_DEUTSCH_"){
if(!translator->load(app->applicationDirPath()+"/../share/keepass/i18n/"+config.Language)){ if(!translator->load(app->applicationDirPath()+"/../share/keepass/i18n/"+config.Language)){
if(!translator->load(app->applicationDirPath()+"/share/i18n/"+config.Language)){ if(!translator->load(app->applicationDirPath()+"/share/i18n/"+config.Language)){
@ -141,16 +117,16 @@ if(config.Language!="_DEUTSCH_"){
else app->installTranslator(translator); else app->installTranslator(translator);
} }
PwSafe *mainWin = 0; DateTimeFormat=QObject::trUtf8("dd'.'MM'.'yy' 'hh':'mm");
loadImages();
mainWin = new PwSafe(app,ArgFile,&config);
app->setMainWidget( mainWin ); KeepassMainWindow *mainWin = new KeepassMainWindow();
mainWin->show(); mainWin->show();
int ret=app->exec(); int r=app->exec();
if(!config.saveToIni(IniFilename)) if(!config.saveToIni(IniFilename))
QMessageBox::warning(NULL,QObject::tr("Warnung"),QObject::trUtf8("Die Konfigurationsdatei konnte nicht gespeichert werden.Stellen Sie sicher, dass\nSie Schreibrechte im Verzeichnis ~/.keepass besitzen."),QObject::tr("OK"),"","",0.0); QMessageBox::warning(NULL,QObject::tr("Warnung"),QObject::trUtf8("Die Konfigurationsdatei konnte nicht gespeichert werden.Stellen Sie sicher, dass\nSie Schreibrechte im Verzeichnis ~/.keepass besitzen."),QObject::tr("OK"),"","",0.0);
delete app; delete app;
return ret; return r;
} }
@ -160,55 +136,154 @@ if(config.Language!="_DEUTSCH_"){
/********* KDE ************** void createBanner(QLabel *Banner,QPixmap* symbol,QString text){
#include <kapplication.h> createBanner(Banner,symbol,text,config.BannerColor1
#include <kaboutdata.h> ,config.BannerColor2
#include <kcmdlineargs.h> ,config.BannerTextColor); //call overloaded function
#include <klocale.h> }
void createBanner(QLabel *Banner,QPixmap* symbol,QString text,QColor color1,QColor color2,QColor textcolor){
int w=Banner->width();
int h=Banner->height();
QColor color;
float b1[3];
float b2[3];
float a1,a2;
QPixmap* banner_pixmap=new QPixmap(w,h); ///@FIXME löscht der Destruktor von QLabel die Pixmap zum schluss???
QPainter painter(banner_pixmap);
QPen pen;
pen.setWidth(1);
painter.setPen(pen);
QFont font("Arial",16);
painter.setFont(font);
if(color1!=color2){
b1[0]=color1.red();
b1[1]=color1.green();
b1[2]=color1.blue();
b2[0]=color2.red();
b2[1]=color2.green();
b2[2]=color2.blue();
for(int x=0;x<w;x++){
a2=(float)x/(float)w;
a1=1-a2;
color.setRgb( (int)(a1*b1[0]+a2*b2[0]),
(int)(a1*b1[1]+a2*b2[1]),
(int)(a1*b1[2]+a2*b2[2]));
pen.setColor(color);
painter.setPen(pen);
painter.drawLine(x,0,x,h);
}
}
else{
banner_pixmap->fill(color1);
}
painter.drawPixmap(10,10,*symbol);
pen.setColor(textcolor);
painter.setPen(pen);
painter.drawText(50,30,text);
Banner->setPixmap(*banner_pixmap);
}
static const char description[] =
I18N_NOOP("A KDE KPart Application");
static const char version[] = "0.1";
static KCmdLineOptions options[] = void openBrowser(QString url){
{
// { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
KCmdLineLastOption
};
int main(int argc, char **argv)
{
KAboutData about("Keepass", I18N_NOOP("Keepass"), version, description,
KAboutData::License_BSD, "(C) %{YEAR} Tarek Saidi", 0, 0, "tareks@arcor.de");
about.addAuthor( "Tarek Saidi", 0, "tareks@arcor.de" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
PwSafe *mainWin = 0;
if (app.isRestored())
{
RESTORE(PwSafe);
}
else
{
// no session.. just start up normally
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
/// @todo do something with the command line args here
mainWin = new PwSafe();
app.setMainWidget( mainWin );
mainWin->show();
args->clear();
}
// mainWin has WDestructiveClose flag by default, so it will delete itself.
return app.exec();
} }
*/
void loadImg(QString name,QPixmap& Img){
if(Img.load(AppDir+"/../share/keepass/icons/"+name)==false){
if(Img.load(AppDir+"/share/"+name)==false){
QMessageBox::critical(0,QObject::trUtf8("Fehler"),QObject::trUtf8("Die Datei '%1' konnte nicht gefunden werden.")
.arg(name),QObject::tr("OK"),0,0,2,1);
exit(1);
}}
}
void loadImages(){
QString ThemeDir="nuvola/32x32";
QPixmap tmpImg;
//-----------------------
loadImg("clientic.png",tmpImg);
EntryIcons=new QPixmap[NUM_CLIENT_ICONS];
for(int i=0;i<52;i++){
EntryIcons[i]=tmpImg.copy(i*16,0,16,16);}
//--------------------------
loadImg("key.png",tmpImg);
Icon_Key32x32=new QPixmap;
*Icon_Key32x32=tmpImg;
//--------------------------
loadImg("settings.png",tmpImg);
Icon_Settings32x32=new QPixmap;
*Icon_Settings32x32=tmpImg;
//--------------------------
loadImg("i18n.png",tmpImg);
Icon_I18n32x32=new QPixmap;
*Icon_I18n32x32=tmpImg;
//--------------------------
loadImg("ok.png",tmpImg);
Icon_Ok16x16=new QPixmap;
*Icon_Ok16x16=tmpImg;
//--------------------------
loadImg("search.png",tmpImg);
Icon_Search32x32=new QPixmap;
*Icon_Search32x32=tmpImg;
//--------------------------
loadImg(ThemeDir+"/actions/filenew.png",tmpImg);
Icon_FileNew=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/fileopen.png",tmpImg);
Icon_FileOpen=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/filesave.png",tmpImg);
Icon_FileSave=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/filesaveas.png",tmpImg);
Icon_FileSaveAs=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/fileclose.png",tmpImg);
Icon_FileClose=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/exit.png",tmpImg);
Icon_Exit=new QIcon(tmpImg);
//--------------------------
loadImg(ThemeDir+"/actions/editdelete.png",tmpImg);
Icon_EditDelete=new QIcon(tmpImg);
}
void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg){
if(argc>1){
int i=1;
if(argv[i][0]!='-'){
ArgFile=QString::fromUtf8(argv[i]);
i++; }
for(i; i<argc;i++){
if(QString(argv[i])=="-h"){
cout << "Keepass 0.1.3 (Alpha)" << endl;
cout << "Usage: keepass [Filename] [Options]" << endl;
cout << " -h This Help" << endl;
cout << " -cfg ConfigFile Use specified configuration" << endl;
exit(0);
}
else if(QString(argv[i])=="-cfg"){
if(i-1==argc) cout << "No configuration file specified." << endl;
else{ArgCfg=QString::fromUtf8(argv[i+1]); i++;}
}
else{cout << "** Unrecognized argument: " << argv[i] << endl;
exit(1);}
}
}
}
void showErrMsg(const QString& msg,QWidget* parent){
QMessageBox::critical(parent,QObject::tr("Fehler"),msg,QObject::tr("OK"));
}

File diff suppressed because it is too large Load Diff

@ -21,156 +21,68 @@
#ifndef MAINWINDOW_H #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include <qimage.h>
#include <qpixmap.h> #include <QImage>
#include <qpainter.h> #include <QPixmap>
#include <qfont.h> #include <QPainter>
#include <qlabel.h> #include <QFont>
#include <qtimer.h> #include <QLabel>
#include <QTime>
#include <qapplication.h> #include <qapplication.h>
//Added by qt3to4:
#include <QShowEvent> #include <QShowEvent>
#include <QTranslator> #include <QTranslator>
#include <QDropEvent> #include <QDropEvent>
#include "ui_MainWindow.h" #include <QListWidget>
#include "ListViews.h" #include <QTreeWidget>
#include "PwManager.h"
#include "PwmConfig.h" #include "PwmConfig.h"
#include "lib/GroupView.h"
typedef vector<GroupItem*>::iterator GroupItemItr; #include "ui_MainWindow.h"
typedef vector<EntryItem*>::iterator EntryItemItr;
class CMainWindow : public MainFrame{ #define NO_ENTRY_SELECTED
Q_OBJECT
class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
Q_OBJECT
public: public:
/*$PUBLIC_FUNCTIONS$*/ KeepassMainWindow (QWidget *parent=0, Qt::WFlags flags=0);
CMainWindow(QApplication* app,QString ArgFile,CConfig* config, QWidget* parent = 0,const char* name = 0, Qt::WFlags fl = 0 ); PwDatabase* db;
~CMainWindow();
protected:
/*$PROTECTED_FUNCTIONS$*/
protected slots:
/*$PROTECTED_SLOTS$*/
virtual void showEvent(QShowEvent *e);
public slots:
/*$PUBLIC_SLOTS$*/
virtual void OnClose();
virtual void OnMainWinResize();
virtual void OnFileOpen();
virtual void OnGroupChanged(Q3ListViewItem*);
virtual void OnEntryChanged(Q3ListViewItem*);
virtual void OnEntryDoubleClicked(Q3ListViewItem*,const QPoint&,int);
virtual void OnMenu_closeDB();
virtual void OnFileSaveAs();
virtual void OnFileSave();
virtual void OnMenuExit();
virtual void OnAddGroup();
virtual void OnUserNameToClipboard();
virtual void OnPasswordToClipboard();
virtual void OnDeleteGroup();
virtual void OnEditGroup();
virtual void OnAddSubGroup();
virtual void OnClipboardTimerEvent();
virtual void OnOpenURL();
virtual void OnGroupSearch();
virtual void OnGlobalSearch();
virtual void OnDeleteEntry();
virtual void OnCopyEntry();
virtual void OnEditEntry();
virtual void OnAddEntry();
virtual void OnSaveAttachment();
virtual void OnEntryRightClicked(Q3ListViewItem* item, const QPoint& pos,int column);
virtual void OnEntryCtxMenuClicked(int id);
virtual void OnGroupRightClicked(Q3ListViewItem* item, const QPoint& pos, int column);
virtual void OnGroupCtxMenuClicked(int id);
virtual void OnChangeDbKey();
virtual void OnDbSettings();
virtual void OnFileNew();
virtual void OnViewToolbarToggled(bool toggled);
virtual void OnViewEntryDetailsToggled(bool toggled);
virtual void OnHelpAbout();
virtual void OnSettings();
virtual void OnView_ColumnUrlToggled(bool value);
virtual void OnView_ColumnTitleToggled(bool value);
virtual void OnView_ColumnCreationToggled(bool value);
virtual void OnView_ColumnLastAccessToggled(bool value);
virtual void OnView_ColumnLastModToggled(bool value);
virtual void OnView_ColumnCommentToggled(bool value);
virtual void OnView_ColumnPasswordToggled(bool value);
virtual void OnView_ColumnAttachmentToggled(bool value);
virtual void OnView_ColumnExpireToggled(bool value);
virtual void OnView_ColumnUsernameToggled(bool value);
virtual void OnExtrasLanguage();
virtual void OnSearchGroupCtxMenuClicked(int);
virtual void OnQickSearch();
virtual void OnGroupItemExpanded(Q3ListViewItem* item);
virtual void OnGroupItemCollapsed(Q3ListViewItem* item);
virtual void DEBUG_OnPrintDbStucture();
virtual void OnImportPwManagerFile();
virtual void OnView_HideUsernamesToggled(bool state);
virtual void OnView_HidePasswordsToggled(bool state);
virtual void OnGroupViewDrop(QDropEvent* e);
virtual void OnHelpAboutQt();
virtual void OnImportKWalletXML();
private slots:
void OnFileNew();
void OnFileOpen();
void OnFileClose();
bool OnFileSave();
bool OnFileSaveAs();
void OnFileSettings();
void OnFileChangeKey();
void OnFileExit();
void OnImportFromPwm();
void OnImportFromKWalletXml();
void OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*);
void OnEntryItemDoubleClicked(QTreeWidgetItem* item,int column);
public:
PwDatabase* db;
vector<GroupItem*> GroupItems;
vector<EntryItem*> EntryItems;
vector<unsigned long> SearchResults;
QString img_res_dir;
QPixmap* EntryIcons;
QPixmap* Icon_Key32x32;
QPixmap* Icon_Settings32x32;
QPixmap* Icon_Search32x32;
QPixmap* Icon_I18n32x32;
QPixmap* Icon_Ok16x16;
QTimer ClipboardTimer;
QString appdir;
CConfig* config;
enum FileMenuState{STATE_FileOpen,
STATE_NoFileOpen};
enum EditMenuState{STATE_NoGroupSelected,
STATE_NoEntrySelected,
STATE_SingleGroupSelected,
STATE_SingleEntrySelected};
void InitMenus();
void SetFileMenuState(FileMenuState status);
void SetEditMenuState(EditMenuState status);
void LoadImg(QString name,QImage &tmpImg);
void SetupColumns();
void ResizeColumns();
void OpenDatabase(QString filename);
void CreateBanner(QLabel *Banner,QPixmap* symbol,QString text);
void CreateBanner(QLabel *Banner,QPixmap* symbol,QString text,QColor color1,QColor color2,QColor textcolor);
void CloseDataBase();
void OpenURL(QString url);
GroupItem* getLastSameLevelItem(int i);
void setCurrentGroup(GroupItem* item);
void updateEntryView();
void updateGroupView();
void updateEntryDetails();
void updateEntryDetails(EntryItem* item);
inline EntryItem* currentEntryItem();
inline CEntry* currentEntry();
GroupItem* CurrentGroup;
QClipboard* Clipboard;
private: private:
bool isInSearchResults(CEntry*);
void Search(CGroup* pGroup=NULL);
QApplication* App;
QTranslator* translator;
bool modflag;
void setModFlag(bool);
bool FileOpen; bool FileOpen;
QString IniFilename; bool ModFlag;
inline void setupToolbar();
inline void setupIcons();
inline void setupConnections();
void setStateFileOpen(bool);
void setStateFileModified(bool);
void openDatabase(QString filename);
bool closeDatabase();
void editEntry(CEntry* pEntry);
}; };
#endif
#endif

@ -8,31 +8,29 @@ INSTALLS += Share \
target.path = /usr/local/bin target.path = /usr/local/bin
Share.files += ../share/keepass/* Share.files += ../share/keepass/*
Share.path = /usr/local/share/keepass Share.path = /usr/local/share/keepass
FORMS += forms/ui_EditGroupDlg.ui \ FORMS += forms/EditGroupDlg.ui \
forms/ui_SearchDlg.ui \ forms/SearchDlg.ui \
forms/ui_AboutDlg.ui \ forms/AboutDlg.ui \
forms/ui_LanguageDlg.ui \ forms/LanguageDlg.ui \
forms/ui_SettingsDlg.ui \ forms/SettingsDlg.ui \
forms/ui_ChangeKeyDlg.ui \ forms/ChangeKeyDlg.ui \
forms/ui_MainWindow.ui \ forms/MainWindow.ui \
forms/ui_SimplePasswordDlg.ui \ forms/SimplePasswordDlg.ui \
forms/ui_DatabaseSettingsDlg.ui \ forms/DatabaseSettingsDlg.ui \
forms/ui_PasswordDlg.ui \ forms/PasswordDlg.ui \
forms/ui_EditEntryDlg.ui \ forms/EditEntryDlg.ui \
forms/ui_PasswordGenDlg.ui forms/PasswordGenDlg.ui
TRANSLATIONS += translations/english.ts \ TRANSLATIONS += translations/english.ts \
translations/russian.ts translations/russian.ts
HEADERS += lib/IniReader.h \ HEADERS += lib/IniReader.h \
lib/UrlLabel.h \ lib/UrlLabel.h \
mainwindow.h \ mainwindow.h \
PwManager.h \ PwManager.h \
pwsafe.h \
crypto/rijndael.h \ crypto/rijndael.h \
lib/SecString.h \ lib/SecString.h \
crypto/sha256.h \ crypto/sha256.h \
crypto/twoclass.h \ crypto/twoclass.h \
crypto/twofish.h \ crypto/twofish.h \
ListViews.h \
import/Import_PwManager.h \ import/Import_PwManager.h \
crypto/blowfish.h \ crypto/blowfish.h \
crypto/sha1.h \ crypto/sha1.h \
@ -51,21 +49,21 @@ HEADERS += lib/IniReader.h \
dialogs/PasswordGenDlg.h \ dialogs/PasswordGenDlg.h \
lib/random.h \ lib/random.h \
Database.h \ Database.h \
lib/PwmTime.h \
lib/KdePlugin.h \ lib/KdePlugin.h \
global.h global.h \
main.h \
lib/GroupView.h \
lib/EntryView.h
SOURCES += lib/IniReader.cpp \ SOURCES += lib/IniReader.cpp \
lib/UrlLabel.cpp \ lib/UrlLabel.cpp \
main.cpp \ main.cpp \
mainwindow.cpp \ mainwindow.cpp \
PwManager.cpp \ PwManager.cpp \
pwsafe.cpp \
crypto/rijndael.cpp \ crypto/rijndael.cpp \
lib/SecString.cpp \ lib/SecString.cpp \
crypto/sha256.c \ crypto/sha256.c \
crypto/twoclass.cpp \ crypto/twoclass.cpp \
crypto/twofish.cpp \ crypto/twofish.cpp \
ListViews.cpp \
import/Import_PwManager.cpp \ import/Import_PwManager.cpp \
crypto/blowfish.cpp \ crypto/blowfish.cpp \
crypto/sha1.cpp \ crypto/sha1.cpp \
@ -84,12 +82,16 @@ SOURCES += lib/IniReader.cpp \
dialogs/PasswordGenDlg.cpp \ dialogs/PasswordGenDlg.cpp \
lib/random.cpp \ lib/random.cpp \
Database.cpp \ Database.cpp \
lib/PwmTime.cpp \ lib/KdePlugin.cpp \
lib/KdePlugin.cpp lib/GroupView.cpp \
lib/EntryView.cpp
QT += xml \
qt3support
MOC_DIR = ../build/moc MOC_DIR = ../build/moc
UI_DIR = ../build/ui UI_DIR = ../build/ui
OBJECTS_DIR = ../build/ OBJECTS_DIR = ../build/
TARGET = ../bin/keepass TARGET = ../bin/keepass
INCLUDEPATH += ./
CONFIG += debug \ CONFIG += debug \
warn_off \ warn_off \
qt \ qt \
@ -97,8 +99,3 @@ thread \
exceptions \ exceptions \
stl stl
TEMPLATE = app TEMPLATE = app
#The following line was inserted by qt3to4
QT += xml qt3support
#The following line was inserted by qt3to4
CONFIG += uic3

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff