Finished PasswordDlg,
Added Text Export git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@56 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
416c7d70d3
commit
6154859afc
|
@ -41,7 +41,7 @@ ini.ReadFile();
|
||||||
ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20);
|
ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20);
|
||||||
Toolbar=ini.GetValueB("UI","ShowToolbar",true);
|
Toolbar=ini.GetValueB("UI","ShowToolbar",true);
|
||||||
EntryDetails=ini.GetValueB("UI","ShowEntryDetails",true);
|
EntryDetails=ini.GetValueB("UI","ShowEntryDetails",true);
|
||||||
OpenLast=ini.GetValueB("Options","OpenLast",true);
|
OpenLast=ini.GetValueB("Options","RememberLastFile",true);
|
||||||
LastFile=ini.GetValue("Options","LastFile","").c_str();
|
LastFile=ini.GetValue("Options","LastFile","").c_str();
|
||||||
ParseColumnString(ini.GetValue("UI","Columns","1111100000").c_str(),Columns);
|
ParseColumnString(ini.GetValue("UI","Columns","1111100000").c_str(),Columns);
|
||||||
BannerColor1=ParseColorString(ini.GetValue("Options","BannerColor1","0,104,176").c_str());
|
BannerColor1=ParseColorString(ini.GetValue("Options","BannerColor1","0,104,176").c_str());
|
||||||
|
@ -68,7 +68,7 @@ AlternatingRowColors=ini.GetValueB("Options","AlternatingRowColors",true);
|
||||||
MountDir=ini.GetValue("Options","MountDir",DEFAULT_MOUNT_DIR).c_str();
|
MountDir=ini.GetValue("Options","MountDir",DEFAULT_MOUNT_DIR).c_str();
|
||||||
RememberLastKey=ini.GetValueB("Options","RememberLastKey",true);
|
RememberLastKey=ini.GetValueB("Options","RememberLastKey",true);
|
||||||
LastKeyLocation=ini.GetValue("Options","LastKeyLocation","").c_str();
|
LastKeyLocation=ini.GetValue("Options","LastKeyLocation","").c_str();
|
||||||
LastKeyType=(tKeyType)ini.GetValueI("Option","LastKeyType",(int)PASSWORD);
|
LastKeyType=(tKeyType)ini.GetValueI("Options","LastKeyType",(int)PASSWORD);
|
||||||
if(!OpenLast)RememberLastKey=false;
|
if(!OpenLast)RememberLastKey=false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ bool CConfig::saveToIni(QString filename){
|
||||||
ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut);
|
ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut);
|
||||||
ini.SetValueB("UI","ShowToolbar",Toolbar);
|
ini.SetValueB("UI","ShowToolbar",Toolbar);
|
||||||
ini.SetValueB("UI","ShowEntryDetails",EntryDetails);
|
ini.SetValueB("UI","ShowEntryDetails",EntryDetails);
|
||||||
|
ini.SetValueB("Options","RememberLastFile",OpenLast);
|
||||||
if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile);
|
if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile);
|
||||||
else ini.SetValue("Options","LastFile","");
|
else ini.SetValue("Options","LastFile","");
|
||||||
ini.SetValue("UI","Columns",(const char*)CreateColumnString(),true);
|
ini.SetValue("UI","Columns",(const char*)CreateColumnString(),true);
|
||||||
|
|
|
@ -36,6 +36,32 @@ CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal,
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
createBanner(Banner,Icon_Key32x32,tr("Database Key"));
|
createBanner(Banner,Icon_Key32x32,tr("Database Key"));
|
||||||
|
|
||||||
|
QDir media(config.MountDir);
|
||||||
|
if(media.exists()){
|
||||||
|
QStringList Paths;
|
||||||
|
Paths=media.entryList("*",QDir::Dirs);
|
||||||
|
Paths.erase(Paths.begin()); // delete "."
|
||||||
|
Paths.erase(Paths.begin()); // delete ".."
|
||||||
|
for(int i=0;i<Paths.count();i++)
|
||||||
|
Combo_Dirs->addItem(config.MountDir+Paths[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Combo_Dirs->setEditText(QString());
|
||||||
|
if(config.RememberLastKey){
|
||||||
|
switch(config.LastKeyType){
|
||||||
|
case PASSWORD: setStatePasswordOnly(); break;
|
||||||
|
case KEYFILE: setStateKeyFileOnly();
|
||||||
|
Combo_Dirs->setEditText(config.LastKeyLocation);
|
||||||
|
break;
|
||||||
|
case BOTH: setStateBoth();
|
||||||
|
CheckBox_Both->setChecked(true);
|
||||||
|
Combo_Dirs->setEditText(config.LastKeyLocation);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
|
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
|
||||||
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
|
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
|
||||||
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
|
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
|
||||||
|
@ -56,19 +82,6 @@ if(!ChangeKeyMode){
|
||||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
|
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QDir media(config.MountDir);
|
|
||||||
if(media.exists()){
|
|
||||||
QStringList Paths;
|
|
||||||
Paths=media.entryList("*",QDir::Dirs);
|
|
||||||
Paths.erase(Paths.begin()); // delete "."
|
|
||||||
Paths.erase(Paths.begin()); // delete ".."
|
|
||||||
for(int i=0;i<Paths.count();i++)
|
|
||||||
Combo_Dirs->addItem(config.MountDir+Paths[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Combo_Dirs->setEditText(QString());
|
|
||||||
if(!config.ShowPasswords)ChangeEchoMode();
|
if(!config.ShowPasswords)ChangeEchoMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +92,7 @@ ButtonBrowse->setEnabled(false);
|
||||||
Label_KeyFile->setEnabled(false);
|
Label_KeyFile->setEnabled(false);
|
||||||
Label_Password->setEnabled(true);
|
Label_Password->setEnabled(true);
|
||||||
Edit_Password->setEnabled(true);
|
Edit_Password->setEnabled(true);
|
||||||
|
Edit_PasswordRep->setEnabled(true);
|
||||||
ButtonChangeEchoMode->setEnabled(true);
|
ButtonChangeEchoMode->setEnabled(true);
|
||||||
KeyType=PASSWORD;
|
KeyType=PASSWORD;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +104,7 @@ ButtonBrowse->setEnabled(true);
|
||||||
Label_KeyFile->setEnabled(true);
|
Label_KeyFile->setEnabled(true);
|
||||||
Label_Password->setEnabled(false);
|
Label_Password->setEnabled(false);
|
||||||
Edit_Password->setEnabled(false);
|
Edit_Password->setEnabled(false);
|
||||||
|
Edit_PasswordRep->setEnabled(false);
|
||||||
ButtonChangeEchoMode->setEnabled(false);
|
ButtonChangeEchoMode->setEnabled(false);
|
||||||
KeyType=KEYFILE;
|
KeyType=KEYFILE;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +116,7 @@ ButtonBrowse->setEnabled(true);
|
||||||
Label_KeyFile->setEnabled(true);
|
Label_KeyFile->setEnabled(true);
|
||||||
Label_Password->setEnabled(true);
|
Label_Password->setEnabled(true);
|
||||||
Edit_Password->setEnabled(true);
|
Edit_Password->setEnabled(true);
|
||||||
|
Edit_PasswordRep->setEnabled(true);
|
||||||
ButtonChangeEchoMode->setEnabled(true);
|
ButtonChangeEchoMode->setEnabled(true);
|
||||||
KeyType=BOTH;
|
KeyType=BOTH;
|
||||||
}
|
}
|
||||||
|
@ -192,14 +208,22 @@ if(KeyType==BOTH || KeyType==KEYFILE){
|
||||||
return;}
|
return;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config.RememberLastKey){
|
||||||
|
config.LastKeyLocation=keyfile;
|
||||||
|
config.LastKeyType=KeyType;
|
||||||
|
}
|
||||||
done(1);
|
done(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPasswordDialog::OnOK_Set(){
|
void CPasswordDialog::OnOK_Set(){
|
||||||
password=Edit_Password->text();
|
password=Edit_Password->text();
|
||||||
|
if(password!=Edit_PasswordRep->text()){
|
||||||
|
QMessageBox::warning(this,tr("Warning"),tr("Password an password repetition are not equal.\nPlease check your input."),tr("OK"),"","",0,0);
|
||||||
|
return;}
|
||||||
keyfile=Combo_Dirs->currentText();
|
keyfile=Combo_Dirs->currentText();
|
||||||
if(password=="" && keyfile==""){
|
if(password=="" && keyfile==""){
|
||||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
|
QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
|
||||||
return;}
|
return;}
|
||||||
|
|
||||||
QFile file(keyfile);
|
QFile file(keyfile);
|
||||||
|
@ -224,10 +248,15 @@ if(QFileInfo(file).isDir()){
|
||||||
return;}
|
return;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(config.RememberLastKey){
|
||||||
|
config.LastKeyLocation=keyfile;
|
||||||
|
config.LastKeyType=KeyType;
|
||||||
|
}
|
||||||
done(1);
|
done(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPasswordDialog::OnPasswordChanged(const QString &txt){
|
void CPasswordDialog::OnPasswordChanged(const QString &txt){
|
||||||
|
Edit_PasswordRep->setText("");
|
||||||
if(CheckBox_Both->isChecked() || txt==QString())
|
if(CheckBox_Both->isChecked() || txt==QString())
|
||||||
setStateBoth();
|
setStateBoth();
|
||||||
else
|
else
|
||||||
|
@ -263,10 +292,12 @@ if(state==Qt::Unchecked){
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPasswordDialog::ChangeEchoMode(){
|
void CPasswordDialog::ChangeEchoMode(){
|
||||||
if(Edit_Password->echoMode()==QLineEdit::Normal)
|
if(Edit_Password->echoMode()==QLineEdit::Normal){
|
||||||
Edit_Password->setEchoMode(QLineEdit::Password);
|
Edit_Password->setEchoMode(QLineEdit::Password);
|
||||||
else
|
Edit_PasswordRep->setEchoMode(QLineEdit::Password);}
|
||||||
|
else{
|
||||||
Edit_Password->setEchoMode(QLineEdit::Normal);
|
Edit_Password->setEchoMode(QLineEdit::Normal);
|
||||||
|
Edit_PasswordRep->setEchoMode(QLineEdit::Normal);}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,12 @@ CSettingsDlg::CSettingsDlg(QWidget* parent, const char* name, bool modal, Qt::WF
|
||||||
: QDialog(parent,name, modal,fl)
|
: QDialog(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
|
connect(ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
|
||||||
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
|
connect(ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
|
||||||
connect( ButtonColor1, SIGNAL( clicked() ), this, SLOT( OnColor1() ) );
|
connect(ButtonColor1, SIGNAL( clicked() ), this, SLOT( OnColor1() ) );
|
||||||
connect( ButtonColor2, SIGNAL( clicked() ), this, SLOT( OnColor2() ) );
|
connect(ButtonColor2, SIGNAL( clicked() ), this, SLOT( OnColor2() ) );
|
||||||
connect( ButtonTextColor, SIGNAL( clicked() ), this, SLOT( OnTextColor() ) );
|
connect(ButtonTextColor, SIGNAL( clicked() ), this, SLOT( OnTextColor() ) );
|
||||||
|
connect(CheckBox_OpenLast,SIGNAL(stateChanged(int)),this,SLOT(OnCeckBoxOpenLastChanged(int)));
|
||||||
createBanner(Banner,Icon_Settings32x32,tr("Settings"));
|
createBanner(Banner,Icon_Settings32x32,tr("Settings"));
|
||||||
CheckBox_OpenLast->setChecked(config.OpenLast);
|
CheckBox_OpenLast->setChecked(config.OpenLast);
|
||||||
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
|
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
|
||||||
|
@ -58,13 +59,12 @@ pixmColor2->setPixmap(*px2);
|
||||||
color1=config.BannerColor1;
|
color1=config.BannerColor1;
|
||||||
color2=config.BannerColor2;
|
color2=config.BannerColor2;
|
||||||
textcolor=config.BannerTextColor;
|
textcolor=config.BannerTextColor;
|
||||||
|
|
||||||
CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
|
CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
|
||||||
Edit_BrowserCmd->setText(config.OpenUrlCommand);
|
Edit_BrowserCmd->setText(config.OpenUrlCommand);
|
||||||
CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree);
|
CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree);
|
||||||
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
|
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
|
||||||
Edit_MountDir->setText(config.MountDir);
|
Edit_MountDir->setText(config.MountDir);
|
||||||
|
CheckBox_RememberLastKey->setChecked(config.RememberLastKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingsDlg::~CSettingsDlg()
|
CSettingsDlg::~CSettingsDlg()
|
||||||
|
@ -85,6 +85,7 @@ config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
|
||||||
config.MountDir=Edit_MountDir->text();
|
config.MountDir=Edit_MountDir->text();
|
||||||
if(config.MountDir!="" && config.MountDir.right(1)!="/")
|
if(config.MountDir!="" && config.MountDir.right(1)!="/")
|
||||||
config.MountDir+="/";
|
config.MountDir+="/";
|
||||||
|
config.RememberLastKey=CheckBox_RememberLastKey->isChecked();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +133,14 @@ createBanner(Banner,Icon_Settings32x32,tr("Settings"),color1,color2,textcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettingsDlg::OnCeckBoxOpenLastChanged(int state){
|
||||||
|
if(state==Qt::Checked){
|
||||||
|
CheckBox_RememberLastKey->setEnabled(true);
|
||||||
|
}else{
|
||||||
|
CheckBox_RememberLastKey->setEnabled(false);
|
||||||
|
CheckBox_RememberLastKey->setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*$SPECIALIZATION$*/
|
/*$SPECIALIZATION$*/
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "main.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>
|
||||||
|
|
||||||
|
@ -31,24 +30,14 @@ class CSettingsDlg : public QDialog, public Ui_SettingsDialog
|
||||||
public:
|
public:
|
||||||
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 slots:
|
|
||||||
/*$PUBLIC_SLOTS$*/
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/*$PROTECTED_FUNCTIONS$*/
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
/*$PROTECTED_SLOTS$*/
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void OnCancel();
|
virtual void OnCancel();
|
||||||
public slots:
|
|
||||||
virtual void OnOK();
|
virtual void OnOK();
|
||||||
virtual void OnTextColor();
|
virtual void OnTextColor();
|
||||||
virtual void OnColor2();
|
virtual void OnColor2();
|
||||||
virtual void OnColor1();
|
virtual void OnColor1();
|
||||||
|
void OnCeckBoxOpenLastChanged(int state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor color1,color2,textcolor;
|
QColor color1,color2,textcolor;
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005-2006 by Tarek Saidi *
|
||||||
|
* tarek.saidi@arcor.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QFile>
|
||||||
|
#include "main.h"
|
||||||
|
#include "../lib/SecString.h"
|
||||||
|
#include "Export_Txt.h"
|
||||||
|
|
||||||
|
QString EntryTemplate=QString("\n\
|
||||||
|
Title: %1\n\
|
||||||
|
Username: %2\n\
|
||||||
|
Url: %3\n\
|
||||||
|
Password: %4\n\
|
||||||
|
Comment: %5\n\
|
||||||
|
");
|
||||||
|
|
||||||
|
QString GroupTemplate=QString("\n\
|
||||||
|
*** Group: %1 ***\n\
|
||||||
|
");
|
||||||
|
|
||||||
|
bool Export_Txt::exportFile(const QString& filename,PwDatabase* db,QString& err){
|
||||||
|
QFile file(filename);
|
||||||
|
if(!file.open(QIODevice::Truncate | QIODevice::WriteOnly)){
|
||||||
|
err+=tr("Could not open file (FileError=%1)").arg(file.error());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int g=0;g<db->Groups.size();g++){
|
||||||
|
file.write(GroupTemplate.arg(db->Groups[g].Name).utf8());
|
||||||
|
for(int e=0;e<db->Entries.size();e++){
|
||||||
|
if(db->Groups[g].ID==db->Entries[e].GroupID){
|
||||||
|
db->Entries[e].Password.unlock();
|
||||||
|
file.write(EntryTemplate.arg(db->Entries[e].Title)
|
||||||
|
.arg(db->Entries[e].UserName)
|
||||||
|
.arg(db->Entries[e].URL)
|
||||||
|
.arg(db->Entries[e].Password.string())
|
||||||
|
.arg(db->Entries[e].Additional)
|
||||||
|
.utf8());
|
||||||
|
db->Entries[e].Password.lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005-2006 by Tarek Saidi *
|
||||||
|
* tarek.saidi@arcor.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef _EXPORT_TXT_H_
|
||||||
|
#define _EXPORT_TXT_H_
|
||||||
|
#include <QObject>
|
||||||
|
#include "PwManager.h"
|
||||||
|
|
||||||
|
class Export_Txt:public QObject{
|
||||||
|
public:
|
||||||
|
bool exportFile(const QString& filename,PwDatabase* db,QString& err);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -79,6 +79,9 @@
|
||||||
<property name="rootIsDecorated" >
|
<property name="rootIsDecorated" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sortingEnabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -509,16 +512,16 @@
|
||||||
<pixmapfunction></pixmapfunction>
|
<pixmapfunction></pixmapfunction>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>KeepassGroupView</class>
|
<class>KeepassEntryView</class>
|
||||||
<extends>QTreeWidget</extends>
|
<extends>QTreeWidget</extends>
|
||||||
<header>../../src/lib/GroupView.h</header>
|
<header>../../src/lib/EntryView.h</header>
|
||||||
<container>0</container>
|
<container>0</container>
|
||||||
<pixmap></pixmap>
|
<pixmap></pixmap>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>KeepassEntryView</class>
|
<class>KeepassGroupView</class>
|
||||||
<extends>QTreeWidget</extends>
|
<extends>QTreeWidget</extends>
|
||||||
<header>../../src/lib/EntryView.h</header>
|
<header>../../src/lib/GroupView.h</header>
|
||||||
<container>0</container>
|
<container>0</container>
|
||||||
<pixmap></pixmap>
|
<pixmap></pixmap>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
|
|
@ -137,7 +137,7 @@
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="" >
|
<widget class="QWidget" name="layoutWidget" >
|
||||||
<property name="geometry" >
|
<property name="geometry" >
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QLabel" name="Label_PasswordRep" >
|
<widget class="QLabel" name="Label_PasswordRep" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>TextLabel</string>
|
<string>Password Repet.:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -509,7 +509,7 @@
|
||||||
<string>Alt+Ö</string>
|
<string>Alt+Ö</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QCheckBox" name="CheckBox_RememberKey" >
|
<widget class="QCheckBox" name="CheckBox_RememberLastKey" >
|
||||||
<property name="geometry" >
|
<property name="geometry" >
|
||||||
<rect>
|
<rect>
|
||||||
<x>30</x>
|
<x>30</x>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2005-2006 by Tarek Saidi *
|
* Copyright (C) 2005-2006 by Tarek Saidi *
|
||||||
* tarek.saidi@arcor.de *
|
* tarek.saidi@arcor.de *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
|
KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
|
||||||
AutoResizeColumns=true;
|
AutoResizeColumns=true;
|
||||||
|
IsSearchGroup=false;
|
||||||
int sum=0;
|
int sum=0;
|
||||||
for(int i=0;i<NUM_COLUMNS;i++)
|
for(int i=0;i<NUM_COLUMNS;i++)
|
||||||
sum+=config.ColumnSizes[i];
|
sum+=config.ColumnSizes[i];
|
||||||
|
@ -97,6 +98,7 @@ updateItems(CurrentGroup);
|
||||||
|
|
||||||
|
|
||||||
void KeepassEntryView::updateItems(unsigned int GroupID){
|
void KeepassEntryView::updateItems(unsigned int GroupID){
|
||||||
|
IsSearchGroup=false;
|
||||||
clear();
|
clear();
|
||||||
Items.clear();
|
Items.clear();
|
||||||
if(!db)return;
|
if(!db)return;
|
||||||
|
@ -109,6 +111,7 @@ for(int i=0;i<db->Entries.size();i++){
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassEntryView::showSearchResults(QList<Q_UINT32>& results){
|
void KeepassEntryView::showSearchResults(QList<Q_UINT32>& results){
|
||||||
|
IsSearchGroup=true;
|
||||||
clear();
|
clear();
|
||||||
Items.clear();
|
Items.clear();
|
||||||
for(int j=0; j<results.size(); j++){
|
for(int j=0; j<results.size(); j++){
|
||||||
|
@ -301,6 +304,8 @@ QTreeWidget::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
|
void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
|
||||||
|
if(IsSearchGroup)
|
||||||
|
return;
|
||||||
if (!(event->buttons() & Qt::LeftButton))
|
if (!(event->buttons() & Qt::LeftButton))
|
||||||
return;
|
return;
|
||||||
if ((event->pos() - DragStartPos).manhattanLength() < QApplication::startDragDistance())
|
if ((event->pos() - DragStartPos).manhattanLength() < QApplication::startDragDistance())
|
||||||
|
|
|
@ -53,6 +53,7 @@ private:
|
||||||
QPoint DragStartPos;
|
QPoint DragStartPos;
|
||||||
QList<QTreeWidgetItem*> DragItems;
|
QList<QTreeWidgetItem*> DragItems;
|
||||||
QPixmap DragPixmap;
|
QPixmap DragPixmap;
|
||||||
|
bool IsSearchGroup;
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent(QContextMenuEvent *event);
|
virtual void contextMenuEvent(QContextMenuEvent *event);
|
||||||
virtual void paintEvent(QPaintEvent* event);
|
virtual void paintEvent(QPaintEvent* event);
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "lib/IniReader.h"
|
#include "lib/IniReader.h"
|
||||||
#include "import/Import_PwManager.h"
|
#include "import/Import_PwManager.h"
|
||||||
#include "import/Import_KWalletXml.h"
|
#include "import/Import_KWalletXml.h"
|
||||||
|
#include "export/Export_Txt.h"
|
||||||
|
|
||||||
#include "dialogs/AboutDlg.h"
|
#include "dialogs/AboutDlg.h"
|
||||||
#include "dialogs/EditGroupDlg.h"
|
#include "dialogs/EditGroupDlg.h"
|
||||||
|
@ -97,6 +98,7 @@ void KeepassMainWindow::setupConnections(){
|
||||||
connect(FileExitAction, SIGNAL(triggered()), this, SLOT(OnFileExit()));
|
connect(FileExitAction, SIGNAL(triggered()), this, SLOT(OnFileExit()));
|
||||||
connect(FileImpPwmAction, SIGNAL(triggered()), this, SLOT(OnImportFromPwm()));
|
connect(FileImpPwmAction, SIGNAL(triggered()), this, SLOT(OnImportFromPwm()));
|
||||||
connect(FileImpKWalletXmlAction, SIGNAL(triggered()), this,SLOT(OnImportFromKWalletXml()));
|
connect(FileImpKWalletXmlAction, SIGNAL(triggered()), this,SLOT(OnImportFromKWalletXml()));
|
||||||
|
connect(FileExpPlainTextAction,SIGNAL(triggered()),this,SLOT(OnExportToTxt()));
|
||||||
|
|
||||||
connect(EditNewGroupAction, SIGNAL(triggered()), this, SLOT(OnEditNewGroup()));
|
connect(EditNewGroupAction, SIGNAL(triggered()), this, SLOT(OnEditNewGroup()));
|
||||||
connect(EditEditGroupAction, SIGNAL(triggered()), this, SLOT(OnEditEditGroup()));
|
connect(EditEditGroupAction, SIGNAL(triggered()), this, SLOT(OnEditEditGroup()));
|
||||||
|
@ -587,6 +589,15 @@ void KeepassMainWindow::OnFileExit(){
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeepassMainWindow::OnExportToTxt(){
|
||||||
|
QString filename=QFileDialog::getSaveFileName(this,tr("Export To..."),QDir::homePath(),"*.txt");
|
||||||
|
if(filename==QString())return;
|
||||||
|
Export_Txt exp;
|
||||||
|
QString err;
|
||||||
|
exp.exportFile(filename,db,err);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::OnImportFromPwm(){
|
void KeepassMainWindow::OnImportFromPwm(){
|
||||||
if(FileOpen)
|
if(FileOpen)
|
||||||
if(!closeDatabase())return;
|
if(!closeDatabase())return;
|
||||||
|
@ -669,9 +680,24 @@ if(cur){
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::OnEntryItemDoubleClicked(QTreeWidgetItem* item,int column){
|
void KeepassMainWindow::OnEntryItemDoubleClicked(QTreeWidgetItem* item,int column){
|
||||||
if(column) return;
|
int i=0;
|
||||||
if(!config.Columns[0]) return;
|
int c=-1;
|
||||||
editEntry(static_cast<EntryViewItem*>(item)->pEntry);
|
for(i;i<NUM_COLUMNS;i++){
|
||||||
|
if(config.Columns[i])c++;
|
||||||
|
if(c==column)break;
|
||||||
|
}
|
||||||
|
if(c==-1)return;
|
||||||
|
CEntry* entry=static_cast<EntryViewItem*>(item)->pEntry;
|
||||||
|
switch(i){
|
||||||
|
case 0: editEntry(entry);
|
||||||
|
break;
|
||||||
|
case 1: OnEditUsernameToClipboard();
|
||||||
|
break;
|
||||||
|
case 2: OnEditOpenUrl();
|
||||||
|
break;
|
||||||
|
case 3: OnEditPasswordToClipboard();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::OnEntrySelectionChanged(){
|
void KeepassMainWindow::OnEntrySelectionChanged(){
|
||||||
|
|
|
@ -63,6 +63,7 @@ private slots:
|
||||||
void OnFileExit();
|
void OnFileExit();
|
||||||
void OnImportFromPwm();
|
void OnImportFromPwm();
|
||||||
void OnImportFromKWalletXml();
|
void OnImportFromKWalletXml();
|
||||||
|
void OnExportToTxt();
|
||||||
void OnEditNewGroup();
|
void OnEditNewGroup();
|
||||||
void OnEditEditGroup();
|
void OnEditEditGroup();
|
||||||
void OnEditDeleteGroup();
|
void OnEditDeleteGroup();
|
||||||
|
|
|
@ -35,6 +35,7 @@ HEADERS += lib/IniReader.h \
|
||||||
crypto/twoclass.h \
|
crypto/twoclass.h \
|
||||||
crypto/twofish.h \
|
crypto/twofish.h \
|
||||||
import/Import_PwManager.h \
|
import/Import_PwManager.h \
|
||||||
|
export/Export_Txt.h \
|
||||||
crypto/blowfish.h \
|
crypto/blowfish.h \
|
||||||
crypto/sha1.h \
|
crypto/sha1.h \
|
||||||
import/Import_KWalletXml.h \
|
import/Import_KWalletXml.h \
|
||||||
|
@ -68,6 +69,7 @@ SOURCES += lib/IniReader.cpp \
|
||||||
crypto/twoclass.cpp \
|
crypto/twoclass.cpp \
|
||||||
crypto/twofish.cpp \
|
crypto/twofish.cpp \
|
||||||
import/Import_PwManager.cpp \
|
import/Import_PwManager.cpp \
|
||||||
|
export/Export_Txt.cpp \
|
||||||
crypto/blowfish.cpp \
|
crypto/blowfish.cpp \
|
||||||
crypto/sha1.cpp \
|
crypto/sha1.cpp \
|
||||||
import/Import_KWalletXml.cpp \
|
import/Import_KWalletXml.cpp \
|
||||||
|
|
Loading…
Reference in New Issue