nomsg
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@6 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
28c71dfe1e
commit
c83a68ed4e
|
@ -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,14 +43,77 @@
|
|||
|
||||
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
if(entry->pBinaryData==NULL){
|
||||
ButtonSaveAttachment->setDisabled(true);
|
||||
ButtonDeleteAttachment->setDisabled(true);}
|
||||
setCaption(entry->Title);
|
||||
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(!config.ShowPasswords)
|
||||
ChangeEchoMode();
|
||||
OnPasswordwLostFocus();
|
||||
int bits=(entry->Password.length()*8);
|
||||
Label_Bits->setText(QString::number(bits)+" Bit");
|
||||
if(bits>128)
|
||||
bits=128;
|
||||
Progress_Quali->setValue(100*bits/128);
|
||||
Edit_Attachment->setText(entry->BinaryDesc);
|
||||
Edit_Comment->setText(entry->Additional);
|
||||
InitGroupComboBox();
|
||||
InitIconComboBox();
|
||||
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);
|
||||
}
|
||||
if(entry->Expire==Date_Never){
|
||||
DateTime_Expire->setDisabled(true);
|
||||
CheckBox_ExpiresNever->setChecked(true);
|
||||
}
|
||||
else{
|
||||
DateTime_Expire->setDateTime(entry->Expire);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
CEditEntryDlg::~CEditEntryDlg()
|
||||
|
@ -63,52 +126,14 @@ CEditEntryDlg::~CEditEntryDlg()
|
|||
void CEditEntryDlg::showEvent(QShowEvent *event){
|
||||
|
||||
if(event->spontaneous()==false){
|
||||
if(entry->pBinaryData==NULL){
|
||||
ButtonSaveAttachment->setDisabled(true);
|
||||
ButtonDeleteAttachment->setDisabled(true);
|
||||
}
|
||||
setCaption(entry->Title);
|
||||
setIcon(mainwnd->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();
|
||||
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);
|
||||
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<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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||
: PasswordDlg(parent,name, modal,fl)
|
||||
: QDialog(parent,name, modal,fl)
|
||||
{
|
||||
parentwnd=((CMainWindow*)parentWidget());
|
||||
parentwnd->CreateBanner(Banner,parentwnd->Icon_Key32x32,trUtf8("Datenbank öffnen"));
|
||||
setupUi(this);
|
||||
createBanner(Banner,Icon_Key32x32,trUtf8("Datenbank öffnen"));
|
||||
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
|
||||
QDir media("/media");
|
||||
if(media.exists()){
|
||||
|
@ -57,7 +65,7 @@ Combo_Dirs->insertItem(0,Paths[i]);
|
|||
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()
|
||||
{
|
||||
if(Button_Browse->isEnabled()){
|
||||
if(ButtonBrowse->isEnabled()){
|
||||
keyfile=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Schlüsseldatei öffnen"));
|
||||
if(keyfile=="")return;
|
||||
Combo_Dirs->insertItem(keyfile);
|
||||
|
@ -133,13 +141,11 @@ IsFile.append(true);
|
|||
|
||||
void CPasswordDialog::OnCancel()
|
||||
{
|
||||
canceled=true;
|
||||
close();
|
||||
done(0);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnOK()
|
||||
{
|
||||
canceled=false;
|
||||
|
||||
if(CheckBox_Both->isChecked()){
|
||||
if(password==""){QMessageBox::warning(this,trUtf8("Fehler"),trUtf8("Bitte geben Sie ein Passwort ein.")
|
||||
|
@ -155,7 +161,7 @@ else
|
|||
,trUtf8("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
close();
|
||||
done(1);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnPasswordChanged(const QString &txt)
|
||||
|
@ -163,10 +169,10 @@ void CPasswordDialog::OnPasswordChanged(const QString &txt)
|
|||
password=Edit_Password->text();
|
||||
if(txt!="" && !(CheckBox_Both->isChecked())){
|
||||
Combo_Dirs->setDisabled(true);
|
||||
Button_Browse->setDisabled(true);}
|
||||
ButtonBrowse->setDisabled(true);}
|
||||
else{
|
||||
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){
|
||||
Combo_Dirs->setEnabled(true);
|
||||
Button_Browse->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);}
|
||||
else{
|
||||
Edit_Password->setText("");
|
||||
|
|
|
@ -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 PASSWORDDIALOG_H
|
||||
#define PASSWORDDIALOG_H
|
||||
#include "lib/UrlLabel.h"
|
||||
|
@ -25,12 +25,11 @@
|
|||
//Added by qt3to4:
|
||||
#include <Q3ValueList>
|
||||
|
||||
class CPasswordDialog : public PasswordDlg
|
||||
class CPasswordDialog : public QDialog, public Ui_PasswordDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
CMainWindow* parentwnd;
|
||||
int NumComboEntries;
|
||||
QStringList Paths;
|
||||
Q3ValueList<bool> IsFile;
|
||||
|
@ -41,7 +40,7 @@ public:
|
|||
|
||||
QString keyfile;
|
||||
QString password;
|
||||
bool canceled;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
@ -51,22 +50,21 @@ public:
|
|||
|
||||
public slots:
|
||||
/*$PUBLIC_SLOTS$*/
|
||||
|
||||
virtual void OnOK();
|
||||
virtual void OnCancel();
|
||||
virtual void OnSelectClicked();
|
||||
virtual void OnButtonBrowse();
|
||||
virtual void OnComboSelectionChanged(int);
|
||||
virtual void OnPasswordChanged(const QString &txt);
|
||||
virtual void OnCheckBox_BothChanged(int state);
|
||||
virtual void ChangeEchoMode();
|
||||
protected:
|
||||
/*$PROTECTED_FUNCTIONS$*/
|
||||
|
||||
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
|
||||
|
|
|
@ -25,29 +25,29 @@
|
|||
#include <qradiobutton.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <q3progressbar.h>
|
||||
#include <QProgressBar>
|
||||
|
||||
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());
|
||||
mainwnd->CreateBanner(Banner,mainwnd->Icon_Key32x32,QString::fromUtf8("Passwort generieren"));
|
||||
|
||||
|
||||
|
||||
setupUi(this);
|
||||
createBanner(Banner,Icon_Key32x32,QString::fromUtf8("Passwort generieren"));
|
||||
Radio_1->setChecked(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()
|
||||
{
|
||||
}
|
||||
|
||||
void CGenPwDialog::OnRadio1StateChanged(int state)
|
||||
void CGenPwDialog::OnRadio1StateChanged(bool state)
|
||||
{
|
||||
switch (state){
|
||||
case QCheckBox::On:
|
||||
if(state){
|
||||
Radio_2->setChecked(false);
|
||||
checkBox1->setEnabled(true);
|
||||
checkBox2->setEnabled(true);
|
||||
|
@ -57,8 +57,7 @@ switch (state){
|
|||
checkBox6->setEnabled(true);
|
||||
checkBox7->setEnabled(true);
|
||||
checkBox8->setEnabled(true);
|
||||
break;
|
||||
case QCheckBox::Off:
|
||||
}else{
|
||||
if(Radio_2->isChecked()==false)Radio_2->setChecked(true);
|
||||
checkBox1->setDisabled(true);
|
||||
checkBox2->setDisabled(true);
|
||||
|
@ -68,27 +67,19 @@ switch (state){
|
|||
checkBox6->setDisabled(true);
|
||||
checkBox7->setDisabled(true);
|
||||
checkBox8->setDisabled(true);
|
||||
|
||||
break;
|
||||
case QCheckBox::NoChange:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CGenPwDialog::OnRadio2StateChanged(int state)
|
||||
void CGenPwDialog::OnRadio2StateChanged(bool state)
|
||||
{
|
||||
switch (state){
|
||||
case QCheckBox::On:
|
||||
if(state){
|
||||
Radio_1->setChecked(false);
|
||||
Edit_chars->setEnabled(true);
|
||||
break;
|
||||
case QCheckBox::Off:
|
||||
}
|
||||
else{
|
||||
if(Radio_1->isChecked()==false)Radio_1->setChecked(true);
|
||||
Edit_chars->setDisabled(true);
|
||||
break;
|
||||
case QCheckBox::NoChange:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 GENPWDIALOG_H
|
||||
#define GENPWDIALOG_H
|
||||
#include "ui_PasswordGenDlg.h"
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
|
||||
|
||||
class CGenPwDialog : public GenPwDlg
|
||||
class CGenPwDialog : public QDialog, public Ui_GenPwDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
|
@ -44,14 +44,10 @@ protected:
|
|||
|
||||
protected slots:
|
||||
/*$PROTECTED_SLOTS$*/
|
||||
public:
|
||||
CMainWindow* mainwnd;
|
||||
public slots:
|
||||
virtual void OnGeneratePw();
|
||||
public slots:
|
||||
virtual void OnRadio2StateChanged(int);
|
||||
public slots:
|
||||
virtual void OnRadio1StateChanged(int);
|
||||
virtual void OnRadio2StateChanged(bool);
|
||||
virtual void OnRadio1StateChanged(bool);
|
||||
virtual void OnCancel();
|
||||
virtual void OnAccept();
|
||||
};
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "main.h"
|
||||
#include "PwManager.h"
|
||||
#include "SearchDlg.h"
|
||||
#include <qlineedit.h>
|
||||
|
@ -26,33 +27,30 @@
|
|||
#include <qmessagebox.h>
|
||||
|
||||
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;
|
||||
parentwnd->CreateBanner(Banner,parentwnd->Icon_Search32x32,tr("Suchen"));
|
||||
group=pGroup;
|
||||
pw=parentwnd->db;
|
||||
|
||||
checkBox_Cs->setChecked(parentwnd->config->SearchOptions[0]);
|
||||
checkBox_regExp->setChecked(parentwnd->config->SearchOptions[1]);
|
||||
checkBox_Title->setChecked(parentwnd->config->SearchOptions[2]);
|
||||
checkBox_Username->setChecked(parentwnd->config->SearchOptions[3]);
|
||||
checkBox_Password->setChecked(parentwnd->config->SearchOptions[4]);
|
||||
checkBox_Comment->setChecked(parentwnd->config->SearchOptions[5]);
|
||||
checkBox_URL->setChecked(parentwnd->config->SearchOptions[6]);
|
||||
checkBox_Attachment->setChecked(parentwnd->config->SearchOptions[7]);
|
||||
setupUi(this);
|
||||
createBanner(Banner,Icon_Search32x32,tr("Suchen"));
|
||||
checkBox_Cs->setChecked(config.SearchOptions[0]);
|
||||
checkBox_regExp->setChecked(config.SearchOptions[1]);
|
||||
checkBox_Title->setChecked(config.SearchOptions[2]);
|
||||
checkBox_Username->setChecked(config.SearchOptions[3]);
|
||||
checkBox_Password->setChecked(config.SearchOptions[4]);
|
||||
checkBox_Comment->setChecked(config.SearchOptions[5]);
|
||||
checkBox_URL->setChecked(config.SearchOptions[6]);
|
||||
checkBox_Attachment->setChecked(config.SearchOptions[7]);
|
||||
}
|
||||
|
||||
CSearchDlg::~CSearchDlg()
|
||||
{
|
||||
parentwnd->config->SearchOptions[0]=checkBox_Cs->isChecked();
|
||||
parentwnd->config->SearchOptions[1]=checkBox_regExp->isChecked();
|
||||
parentwnd->config->SearchOptions[2]=checkBox_Title->isChecked();
|
||||
parentwnd->config->SearchOptions[3]=checkBox_Username->isChecked();
|
||||
parentwnd->config->SearchOptions[4]=checkBox_Password->isChecked();
|
||||
parentwnd->config->SearchOptions[5]=checkBox_Comment->isChecked();
|
||||
parentwnd->config->SearchOptions[6]=checkBox_URL->isChecked();
|
||||
parentwnd->config->SearchOptions[7]=checkBox_Attachment->isChecked();
|
||||
config.SearchOptions[0]=checkBox_Cs->isChecked();
|
||||
config.SearchOptions[1]=checkBox_regExp->isChecked();
|
||||
config.SearchOptions[2]=checkBox_Title->isChecked();
|
||||
config.SearchOptions[3]=checkBox_Username->isChecked();
|
||||
config.SearchOptions[4]=checkBox_Password->isChecked();
|
||||
config.SearchOptions[5]=checkBox_Comment->isChecked();
|
||||
config.SearchOptions[6]=checkBox_URL->isChecked();
|
||||
config.SearchOptions[7]=checkBox_Attachment->isChecked();
|
||||
}
|
||||
|
||||
void CSearchDlg::OnButtonClose()
|
||||
|
@ -60,9 +58,9 @@ void CSearchDlg::OnButtonClose()
|
|||
done(0);
|
||||
}
|
||||
|
||||
|
||||
void CSearchDlg::OnButtonSearch()
|
||||
{
|
||||
/*
|
||||
txt=Edit_Search->text();
|
||||
regexp=checkBox_regExp->isChecked();
|
||||
if(txt==""){
|
||||
|
@ -81,8 +79,12 @@ for(int i=0;i<pw->Entries.size();i++){
|
|||
pw->Entries[i].Password.delRef();
|
||||
if(hit)hits.push_back(&pw->Entries[i]);
|
||||
}
|
||||
*/
|
||||
done(1);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
bool CSearchDlg::search(QString& str){
|
||||
if(regexp){
|
||||
QRegExp exp(txt,checkBox_Cs->isChecked());
|
||||
|
@ -90,7 +92,7 @@ if(regexp){
|
|||
else{
|
||||
if(str.contains(txt,checkBox_Cs->isChecked())==0)return false;}
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
/*$SPECIALIZATION$*/
|
||||
|
||||
|
|
|
@ -17,17 +17,18 @@
|
|||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "mainwindow.h"
|
||||
#ifndef SEARCHDLG_H
|
||||
#define 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
|
||||
|
||||
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();
|
||||
/*$PUBLIC_FUNCTIONS$*/
|
||||
|
||||
|
@ -45,18 +46,9 @@ public slots:
|
|||
public slots:
|
||||
virtual void OnButtonSearch();
|
||||
|
||||
|
||||
private:
|
||||
CMainWindow* parentwnd;
|
||||
CGroup* group;
|
||||
PwDatabase* pw;
|
||||
QString txt;
|
||||
bool regexp;
|
||||
bool search(QString&);
|
||||
|
||||
public:
|
||||
vector<CEntry*> hits;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 <qpixmap.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qspinbox.h>
|
||||
|
@ -27,30 +27,28 @@
|
|||
|
||||
|
||||
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;
|
||||
mainwnd=((CMainWindow*)parentWidget());
|
||||
mainwnd->CreateBanner(Banner,mainwnd->Icon_Settings32x32,trUtf8("Einstellungen"));
|
||||
|
||||
CheckBox_OpenLast->setChecked(mainwnd->config->OpenLast);
|
||||
SpinBox_ClipboardTime->setValue(mainwnd->config->ClipboardTimeOut);
|
||||
setupUi(this);
|
||||
createBanner(Banner,Icon_Settings32x32,trUtf8("Einstellungen"));
|
||||
CheckBox_OpenLast->setChecked(config.OpenLast);
|
||||
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
|
||||
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->pixmap()->fill(mainwnd->config->BannerColor1);
|
||||
//pixmColor1->pixmap()->fill(config.BannerColor1);
|
||||
|
||||
pixmColor2->setPixmap(*(new QPixmap(pixmColor2->width(),pixmColor2->height())));
|
||||
//pixmColor2->pixmap()->fill(mainwnd->config->BannerColor2);
|
||||
//pixmColor2->pixmap()->fill(config.BannerColor2);
|
||||
|
||||
color1=mainwnd->config->BannerColor1;
|
||||
color2=mainwnd->config->BannerColor2;
|
||||
textcolor=mainwnd->config->BannerTextColor;
|
||||
color1=config.BannerColor1;
|
||||
color2=config.BannerColor2;
|
||||
textcolor=config.BannerTextColor;
|
||||
|
||||
CheckBox_ShowPasswords->setChecked(mainwnd->config->ShowPasswords);
|
||||
Edit_BrowserCmd->setText(mainwnd->config->OpenUrlCommand);
|
||||
CheckBox_ExpandGroupTree->setChecked(mainwnd->config->ExpandGroupTree);
|
||||
CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
|
||||
Edit_BrowserCmd->setText(config.OpenUrlCommand);
|
||||
CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree);
|
||||
|
||||
}
|
||||
|
||||
|
@ -60,14 +58,14 @@ CSettingsDlg::~CSettingsDlg()
|
|||
|
||||
void CSettingsDlg::OnOK()
|
||||
{
|
||||
mainwnd->config->OpenLast=CheckBox_OpenLast->isChecked();
|
||||
mainwnd->config->ClipboardTimeOut=SpinBox_ClipboardTime->value();
|
||||
mainwnd->config->BannerColor1=color1;
|
||||
mainwnd->config->BannerColor2=color2;
|
||||
mainwnd->config->BannerTextColor=textcolor;
|
||||
mainwnd->config->ShowPasswords=CheckBox_ShowPasswords->isChecked();
|
||||
mainwnd->config->OpenUrlCommand=Edit_BrowserCmd->text();
|
||||
mainwnd->config->ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked();
|
||||
config.OpenLast=CheckBox_OpenLast->isChecked();
|
||||
config.ClipboardTimeOut=SpinBox_ClipboardTime->value();
|
||||
config.BannerColor1=color1;
|
||||
config.BannerColor2=color2;
|
||||
config.BannerTextColor=textcolor;
|
||||
config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
|
||||
config.OpenUrlCommand=Edit_BrowserCmd->text();
|
||||
config.ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked();
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -85,7 +83,7 @@ QPixmap *px=new QPixmap(pixmTextColor->width(),pixmTextColor->height());
|
|||
px->fill(c);
|
||||
pixmTextColor->clear();
|
||||
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);
|
||||
pixmColor2->clear();
|
||||
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);
|
||||
pixmColor1->clear();
|
||||
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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "mainwindow.h"
|
||||
#include "main.h"
|
||||
#ifndef SETTINGSDLG_H
|
||||
#define SETTINGSDLG_H
|
||||
|
||||
#include "ui_SettingsDlg.h"
|
||||
#include <qcolor.h>
|
||||
|
||||
class CSettingsDlg : public SettingsDialog
|
||||
class CSettingsDlg : public QDialog, public Ui_SettingsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMainWindow* mainwnd;
|
||||
PwDatabase* pw;
|
||||
CSettingsDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||
~CSettingsDlg();
|
||||
/*$PUBLIC_FUNCTIONS$*/
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
#include <qpushbutton.h>
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "ui_SimplePasswordDlg.h"
|
||||
|
||||
class CSimplePasswordDialog : public SimplePasswordDialog
|
||||
class CSimplePasswordDialog : public QDialog, public Ui_SimplePasswordDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "Import_KWalletXml.h"
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
#include <qobject.h>
|
||||
#include <qfile.h>
|
||||
#include <qdom.h>
|
||||
using namespace std;
|
||||
|
||||
bool Import_KWalletXml::importFile(QString FileName,PwDatabase* pwm,QString& err){
|
||||
QFile file(FileName);
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
#include <qobject.h>
|
||||
#include <qfile.h>
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
#include <qdom.h>
|
||||
#include "crypto/blowfish.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "Import_PwManager.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool Import_PwManager::importFile(QString filename, QString password, PwDatabase* db, QString& err){
|
||||
database=db;
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include "SecString.h"
|
||||
#include <qmessagebox.h>
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
#include "random.h"
|
||||
|
||||
using namespace std;
|
||||
Q_UINT8 SecString::Key[32]={0};
|
||||
|
||||
SecString::SecString(){
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define _LINKLABEL_H_
|
||||
#include <qlabel.h>
|
||||
#include <q3signal.h>
|
||||
//Added by qt3to4:
|
||||
#include <QMouseEvent>
|
||||
|
||||
class LinkLabel : public QLabel{
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
#include <fstream.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qobject.h>
|
||||
#include "random.h"
|
||||
using namespace std;
|
||||
|
||||
void getRandomBytes(void* buffer,int NumBlocks,int BlockSize,bool Strong){
|
||||
FILE *dev_random;
|
||||
|
|
317
src/main.cpp
317
src/main.cpp
|
@ -18,51 +18,58 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
#include <qapplication.h>
|
||||
#include <qlibrary.h>
|
||||
#include <qlocale.h>
|
||||
#include <qdir.h>
|
||||
#include <qmessagebox.h>
|
||||
//Added by qt3to4:
|
||||
#include <QMessageBox>
|
||||
#include <QTranslator>
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include "pwsafe.h"
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "lib/KdePlugin.h"
|
||||
#include "mainwindow.h"
|
||||
using namespace std;
|
||||
|
||||
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 option: " << argv[i] << endl;
|
||||
exit(1);}
|
||||
}
|
||||
CConfig config;
|
||||
QString AppDir;
|
||||
QPixmap *Icon_Key32x32;
|
||||
QPixmap *Icon_Settings32x32;
|
||||
QPixmap *Icon_Search32x32;
|
||||
QPixmap *Icon_I18n32x32;
|
||||
QPixmap *Icon_Ok16x16;
|
||||
QPixmap *EntryIcons;
|
||||
QIcon *Icon_FileNew;
|
||||
QIcon *Icon_FileOpen;
|
||||
QIcon *Icon_FileClose;
|
||||
QIcon *Icon_FileSave;
|
||||
QIcon *Icon_FileSaveAs;
|
||||
QIcon *Icon_Exit;
|
||||
QIcon *Icon_File_Export;
|
||||
QIcon *Icon_EditDelete;
|
||||
QString DateTimeFormat("no-format-string");
|
||||
|
||||
|
||||
inline void loadImages();
|
||||
inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg);
|
||||
CConfig config;
|
||||
|
||||
QApplication* app=new QApplication(argc,argv);
|
||||
AppDir=app->applicationDirPath();
|
||||
//Load Config
|
||||
if(ArgCfg==""){
|
||||
if(!QDir(QDir::homeDirPath()+"/.keepass").exists()){
|
||||
|
@ -73,41 +80,9 @@ if(ArgCfg==""){
|
|||
IniFilename=QDir::homeDirPath()+"/.keepass/config";
|
||||
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{
|
||||
app=new QApplication(argc,argv);
|
||||
}
|
||||
|
||||
IniFilename=ArgCfg;
|
||||
config.loadFromIni(IniFilename);}
|
||||
|
||||
|
||||
//Internationalization
|
||||
|
@ -129,6 +104,7 @@ if(config.Language==""){
|
|||
config.Language="english.qm";
|
||||
break;}
|
||||
}
|
||||
|
||||
if(config.Language!="_DEUTSCH_"){
|
||||
if(!translator->load(app->applicationDirPath()+"/../share/keepass/i18n/"+config.Language)){
|
||||
if(!translator->load(app->applicationDirPath()+"/share/i18n/"+config.Language)){
|
||||
|
@ -141,16 +117,16 @@ if(config.Language!="_DEUTSCH_"){
|
|||
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 );
|
||||
mainWin->show();
|
||||
int ret=app->exec();
|
||||
if(!config.saveToIni(IniFilename))
|
||||
KeepassMainWindow *mainWin = new KeepassMainWindow();
|
||||
mainWin->show();
|
||||
int r=app->exec();
|
||||
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);
|
||||
delete app;
|
||||
return ret;
|
||||
delete app;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,55 +136,154 @@ if(config.Language!="_DEUTSCH_"){
|
|||
|
||||
|
||||
|
||||
/********* KDE **************
|
||||
#include <kapplication.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <klocale.h>
|
||||
|
||||
static const char description[] =
|
||||
I18N_NOOP("A KDE KPart Application");
|
||||
|
||||
static const char version[] = "0.1";
|
||||
|
||||
static KCmdLineOptions options[] =
|
||||
{
|
||||
// { "+[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 createBanner(QLabel *Banner,QPixmap* symbol,QString text){
|
||||
createBanner(Banner,symbol,text,config.BannerColor1
|
||||
,config.BannerColor2
|
||||
,config.BannerTextColor); //call overloaded function
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void openBrowser(QString url){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
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"));
|
||||
}
|
||||
|
|
1446
src/mainwindow.cpp
1446
src/mainwindow.cpp
File diff suppressed because it is too large
Load Diff
184
src/mainwindow.h
184
src/mainwindow.h
|
@ -21,156 +21,68 @@
|
|||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#include <qimage.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qpainter.h>
|
||||
#include <qfont.h>
|
||||
#include <qlabel.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QFont>
|
||||
#include <QLabel>
|
||||
#include <QTime>
|
||||
#include <qapplication.h>
|
||||
//Added by qt3to4:
|
||||
#include <QShowEvent>
|
||||
#include <QTranslator>
|
||||
#include <QDropEvent>
|
||||
#include "ui_MainWindow.h"
|
||||
#include "ListViews.h"
|
||||
#include <QListWidget>
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
||||
#include "PwManager.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "lib/GroupView.h"
|
||||
|
||||
typedef vector<GroupItem*>::iterator GroupItemItr;
|
||||
typedef vector<EntryItem*>::iterator EntryItemItr;
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
class CMainWindow : public MainFrame{
|
||||
#define NO_ENTRY_SELECTED
|
||||
|
||||
class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/*$PUBLIC_FUNCTIONS$*/
|
||||
CMainWindow(QApplication* app,QString ArgFile,CConfig* config, QWidget* parent = 0,const char* name = 0, Qt::WFlags fl = 0 );
|
||||
~CMainWindow();
|
||||
protected:
|
||||
/*$PROTECTED_FUNCTIONS$*/
|
||||
KeepassMainWindow (QWidget *parent=0, Qt::WFlags flags=0);
|
||||
PwDatabase* db;
|
||||
|
||||
protected slots:
|
||||
/*$PROTECTED_SLOTS$*/
|
||||
virtual void showEvent(QShowEvent *e);
|
||||
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 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();
|
||||
|
||||
|
||||
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:
|
||||
bool isInSearchResults(CEntry*);
|
||||
void Search(CGroup* pGroup=NULL);
|
||||
QApplication* App;
|
||||
QTranslator* translator;
|
||||
bool modflag;
|
||||
void setModFlag(bool);
|
||||
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
|
47
src/src.pro
47
src/src.pro
|
@ -8,31 +8,29 @@ INSTALLS += Share \
|
|||
target.path = /usr/local/bin
|
||||
Share.files += ../share/keepass/*
|
||||
Share.path = /usr/local/share/keepass
|
||||
FORMS += forms/ui_EditGroupDlg.ui \
|
||||
forms/ui_SearchDlg.ui \
|
||||
forms/ui_AboutDlg.ui \
|
||||
forms/ui_LanguageDlg.ui \
|
||||
forms/ui_SettingsDlg.ui \
|
||||
forms/ui_ChangeKeyDlg.ui \
|
||||
forms/ui_MainWindow.ui \
|
||||
forms/ui_SimplePasswordDlg.ui \
|
||||
forms/ui_DatabaseSettingsDlg.ui \
|
||||
forms/ui_PasswordDlg.ui \
|
||||
forms/ui_EditEntryDlg.ui \
|
||||
forms/ui_PasswordGenDlg.ui
|
||||
FORMS += forms/EditGroupDlg.ui \
|
||||
forms/SearchDlg.ui \
|
||||
forms/AboutDlg.ui \
|
||||
forms/LanguageDlg.ui \
|
||||
forms/SettingsDlg.ui \
|
||||
forms/ChangeKeyDlg.ui \
|
||||
forms/MainWindow.ui \
|
||||
forms/SimplePasswordDlg.ui \
|
||||
forms/DatabaseSettingsDlg.ui \
|
||||
forms/PasswordDlg.ui \
|
||||
forms/EditEntryDlg.ui \
|
||||
forms/PasswordGenDlg.ui
|
||||
TRANSLATIONS += translations/english.ts \
|
||||
translations/russian.ts
|
||||
HEADERS += lib/IniReader.h \
|
||||
lib/UrlLabel.h \
|
||||
mainwindow.h \
|
||||
PwManager.h \
|
||||
pwsafe.h \
|
||||
crypto/rijndael.h \
|
||||
lib/SecString.h \
|
||||
crypto/sha256.h \
|
||||
crypto/twoclass.h \
|
||||
crypto/twofish.h \
|
||||
ListViews.h \
|
||||
import/Import_PwManager.h \
|
||||
crypto/blowfish.h \
|
||||
crypto/sha1.h \
|
||||
|
@ -51,21 +49,21 @@ HEADERS += lib/IniReader.h \
|
|||
dialogs/PasswordGenDlg.h \
|
||||
lib/random.h \
|
||||
Database.h \
|
||||
lib/PwmTime.h \
|
||||
lib/KdePlugin.h \
|
||||
global.h
|
||||
global.h \
|
||||
main.h \
|
||||
lib/GroupView.h \
|
||||
lib/EntryView.h
|
||||
SOURCES += lib/IniReader.cpp \
|
||||
lib/UrlLabel.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
PwManager.cpp \
|
||||
pwsafe.cpp \
|
||||
crypto/rijndael.cpp \
|
||||
lib/SecString.cpp \
|
||||
crypto/sha256.c \
|
||||
crypto/twoclass.cpp \
|
||||
crypto/twofish.cpp \
|
||||
ListViews.cpp \
|
||||
import/Import_PwManager.cpp \
|
||||
crypto/blowfish.cpp \
|
||||
crypto/sha1.cpp \
|
||||
|
@ -84,12 +82,16 @@ SOURCES += lib/IniReader.cpp \
|
|||
dialogs/PasswordGenDlg.cpp \
|
||||
lib/random.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
|
||||
UI_DIR = ../build/ui
|
||||
OBJECTS_DIR = ../build/
|
||||
TARGET = ../bin/keepass
|
||||
INCLUDEPATH += ./
|
||||
CONFIG += debug \
|
||||
warn_off \
|
||||
qt \
|
||||
|
@ -97,8 +99,3 @@ thread \
|
|||
exceptions \
|
||||
stl
|
||||
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
Loading…
Reference in New Issue