work on CPasswordDlg (incomplete)
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@54 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
853747bce1
commit
e0a2197b53
|
@ -24,6 +24,17 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#define DEFAULT_MOUNT_DIR "/Volumes/"
|
||||
#endif
|
||||
#ifdef Q_WS_X11
|
||||
#define DEFAULT_MOUNT_DIR "/media/"
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
#define DEFAULT_MOUNT_DIR "/"
|
||||
#endif
|
||||
|
||||
|
||||
bool CConfig::loadFromIni(QString filename){
|
||||
ini.SetPath((const char*)filename);
|
||||
ini.ReadFile();
|
||||
|
@ -54,6 +65,11 @@ MainWinSplit2=ini.GetValueI("UI","MainWinSplit2",300);
|
|||
ParseIntString(ini.GetValue("UI","ColumnSizes","15,10,10,10,10,10,10,10,10,10").c_str(),ColumnSizes,10);
|
||||
ShowStatusbar=ini.GetValueB("UI","ShowStatusbar",true);
|
||||
AlternatingRowColors=ini.GetValueB("Options","AlternatingRowColors",true);
|
||||
MountDir=ini.GetValue("Options","MountDir",DEFAULT_MOUNT_DIR).c_str();
|
||||
RememberLastKey=ini.GetValueB("Options","RememberLastKey",true);
|
||||
LastKeyLocation=ini.GetValue("Options","LastKeyLocation","").c_str();
|
||||
LastKeyType=(tKeyType)ini.GetValueI("Option","LastKeyType",(int)PASSWORD);
|
||||
if(!OpenLast)RememberLastKey=false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -85,6 +101,14 @@ ini.SetValueI("UI","MainWinSplit2",MainWinSplit2);
|
|||
ini.SetValue("UI","ColumnSizes",(const char*)CreateIntString(ColumnSizes,10),true);
|
||||
ini.SetValueB("UI","ShowStatusbar",ShowStatusbar);
|
||||
ini.SetValueB("Options","AlternatingRowColors",AlternatingRowColors);
|
||||
ini.SetValue("Options","MountDir",(const char*)MountDir);
|
||||
ini.SetValueB("Options","RememberLastKey",RememberLastKey);
|
||||
if(RememberLastKey){
|
||||
ini.SetValue("Options","LastKeyLocation",(const char*)LastKeyLocation);
|
||||
ini.SetValueI("Options","LastKeyType",LastKeyType);}
|
||||
else{
|
||||
ini.SetValue("Options","LastKeyLocation","");
|
||||
ini.SetValueI("Options","LastKeyType",0);}
|
||||
if(!ini.WriteFile())return false;
|
||||
else return true;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef _PWMCONFIG_H_
|
||||
#define _PWMCONFIG_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "lib/IniReader.h"
|
||||
#include <qcolor.h>
|
||||
|
||||
|
@ -53,6 +54,10 @@ public:
|
|||
int ColumnSizes[10];
|
||||
bool ShowStatusbar;
|
||||
bool AlternatingRowColors;
|
||||
QString MountDir;
|
||||
bool RememberLastKey; //location and type, not the key itself
|
||||
tKeyType LastKeyType;
|
||||
QString LastKeyLocation;
|
||||
|
||||
bool loadFromIni(QString filename);
|
||||
bool saveToIni(QString filename);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "PwManager.h"
|
||||
#include "../lib/random.h"
|
||||
#include "ChangeKeyDlg.h"
|
||||
|
@ -93,7 +94,7 @@ Q_UINT8 pw_key[32]={0};
|
|||
if(keyfile!=""){
|
||||
QFile file(keyfile);
|
||||
if(file.exists()){
|
||||
int r=QMessageBox::warning(this,tr("Overwrite?"),tr("A file with this name already exists.\nDo you want to replace it?"),"Yes","No",NULL,1,1);
|
||||
int r=QMessageBox::warning(this,tr("Overwrite?"),tr("A key file with this name already exists.\nDo you want to replace it?"),"Yes","No",NULL,1,1);
|
||||
if(r==1)return;}
|
||||
getRandomBytes(file_key,1,32,true);
|
||||
if(file.open(QIODevice::WriteOnly | QIODevice::Truncate)==false){
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "main.h"
|
||||
|
||||
#include "PwmConfig.h"
|
||||
#include <qpushbutton.h>
|
||||
#include <qpalette.h>
|
||||
#include <qfont.h>
|
||||
|
|
|
@ -19,30 +19,24 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include "PwmConfig.h"
|
||||
#include "PasswordDlg.h"
|
||||
#include <qdir.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <q3valuelist.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <q3filedialog.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
#include <QStringList>
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
|
||||
CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal, bool ShowExitButton, Qt::WFlags fl)
|
||||
CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal, bool ShowExitButton,bool ChangeKeyMode, Qt::WFlags fl)
|
||||
: QDialog(parent,name, modal,fl)
|
||||
{
|
||||
setupUi(this);
|
||||
ButtonExit->setVisible(ShowExitButton);
|
||||
createBanner(Banner,Icon_Key32x32,tr("Open Database"));
|
||||
Label_select=new LinkLabel((QWidget*)groupframe,"Select",tr("Select File Manually..."),410,100);
|
||||
connect( Combo_Dirs, SIGNAL( activated(int) ), this, SLOT( OnComboSelectionChanged(int) ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
|
||||
createBanner(Banner,Icon_Key32x32,tr("Database Key"));
|
||||
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
|
||||
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) ) );
|
||||
|
@ -50,99 +44,85 @@ connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoMode()
|
|||
connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
|
||||
connect( ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit()));
|
||||
|
||||
QDir media("/media");
|
||||
ButtonExit->setVisible(ShowExitButton);
|
||||
Mode_Set=ChangeKeyMode;
|
||||
if(!ChangeKeyMode){
|
||||
Edit_PasswordRep->hide();
|
||||
Label_PasswordRep->hide();
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
|
||||
}else{
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK_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++){
|
||||
Paths[i]="/media/"+Paths[i];
|
||||
}
|
||||
Paths.prepend(tr("< none >"));
|
||||
}
|
||||
for(int i=0;i<Paths.count();i++){
|
||||
Combo_Dirs->insertItem(0,Paths[i]);
|
||||
IsFile.append(false);
|
||||
for(int i=0;i<Paths.count();i++)
|
||||
Combo_Dirs->addItem(config.MountDir+Paths[i]);
|
||||
}
|
||||
|
||||
Combo_Dirs->setEditText(QString());
|
||||
if(!config.ShowPasswords)ChangeEchoMode();
|
||||
|
||||
}
|
||||
|
||||
CPasswordDialog::~CPasswordDialog()
|
||||
{
|
||||
delete Label_select;
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnComboSelectionChanged(int i)
|
||||
{
|
||||
if(i==0){
|
||||
keyfile="";
|
||||
void CPasswordDialog::setStatePasswordOnly(){
|
||||
Combo_Dirs->setEnabled(false);
|
||||
ButtonBrowse->setEnabled(false);
|
||||
Label_KeyFile->setEnabled(false);
|
||||
Label_Password->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);
|
||||
return;
|
||||
ButtonChangeEchoMode->setEnabled(true);
|
||||
KeyType=PASSWORD;
|
||||
}
|
||||
QFile file;
|
||||
if(IsFile[i]==true)file.setName(Paths[i]);
|
||||
else file.setName(Paths[i]+"/pwsafe.key");
|
||||
|
||||
if(file.exists()){
|
||||
keyfile=file.name();
|
||||
if(!CheckBox_Both->isChecked()){
|
||||
Edit_Password->setText("");
|
||||
Edit_Password->setDisabled(true);}
|
||||
return;
|
||||
|
||||
void CPasswordDialog::setStateKeyFileOnly(){
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Label_KeyFile->setEnabled(true);
|
||||
Label_Password->setEnabled(false);
|
||||
Edit_Password->setEnabled(false);
|
||||
ButtonChangeEchoMode->setEnabled(false);
|
||||
KeyType=KEYFILE;
|
||||
}
|
||||
QMessageBox::warning(this,tr("No key file found"),tr(
|
||||
"No key file could be found in the chosen directory.\n\
|
||||
Make sure that the volume is mounted correctly.\n\
|
||||
Please use the manual file selection for key files with a filename other than 'pwsafe.key'.")
|
||||
,tr("OK"),"","",0,0);
|
||||
|
||||
|
||||
void CPasswordDialog::setStateBoth(){
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Label_KeyFile->setEnabled(true);
|
||||
Label_Password->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);
|
||||
Combo_Dirs->setCurrentItem(0);
|
||||
return;
|
||||
ButtonChangeEchoMode->setEnabled(true);
|
||||
KeyType=BOTH;
|
||||
}
|
||||
|
||||
|
||||
void CPasswordDialog::OnButtonBrowse()
|
||||
{
|
||||
QString dir=Q3FileDialog::getExistingDirectory(QDir::homeDirPath(),NULL,tr("Browse..."));
|
||||
if(dir=="")return;
|
||||
QFile file(dir+"/pwsafe.key");
|
||||
QString filename=QFileDialog::getOpenFileName(this,tr("Select a Key File"),QDir::homeDirPath(),tr("*.key"));
|
||||
if(filename=="")return;
|
||||
QFile file(filename);
|
||||
if(file.exists()){
|
||||
keyfile=dir+"/pwsafe.key";
|
||||
Combo_Dirs->insertItem(dir);
|
||||
Combo_Dirs->setCurrentItem(Combo_Dirs->count()-1);
|
||||
if(!CheckBox_Both->isChecked()){
|
||||
Edit_Password->setDisabled(true);
|
||||
Edit_Password->setText("");
|
||||
password="";
|
||||
Combo_Dirs->setEditText(filename);
|
||||
return;
|
||||
}
|
||||
Paths.append(dir);
|
||||
IsFile.append(false);
|
||||
return;}
|
||||
QMessageBox::warning(this,tr("No key file found"),tr(
|
||||
"No key file could be found in the chosen directory.\n\
|
||||
Make sure that the volume is mounted correctly.\n\
|
||||
Please use the manual file selection for key files with a filename other than 'pwsafe.key'.")
|
||||
,tr("OK"),"","",0,0);
|
||||
QMessageBox::warning(this,tr("Error"),tr("Unexpected Error: File does not exist."),tr("OK"),"","",0,0);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnSelectClicked()
|
||||
void CPasswordDialog::OnButtonBrowse_Set()
|
||||
{
|
||||
if(ButtonBrowse->isEnabled()){
|
||||
keyfile=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,tr("Open Key File"));
|
||||
if(keyfile=="")return;
|
||||
Combo_Dirs->insertItem(keyfile);
|
||||
Combo_Dirs->setCurrentItem(Combo_Dirs->count()-1);
|
||||
if(!CheckBox_Both->isChecked()){
|
||||
Edit_Password->setDisabled(true);
|
||||
Edit_Password->setText("");
|
||||
password="";
|
||||
}
|
||||
Paths.append(keyfile);
|
||||
IsFile.append(true);
|
||||
}
|
||||
QString filename=QFileDialog::getSaveFileName(this,tr("Select a Key File"),QDir::homeDirPath(),tr("*.key"));
|
||||
if(filename=="")return;
|
||||
Combo_Dirs->setEditText(filename);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnCancel()
|
||||
|
@ -150,64 +130,119 @@ void CPasswordDialog::OnCancel()
|
|||
done(0);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnOK()
|
||||
{
|
||||
void CPasswordDialog::OnOK(){
|
||||
password=Edit_Password->text();
|
||||
keyfile=Combo_Dirs->currentText();
|
||||
|
||||
if(CheckBox_Both->isChecked()){
|
||||
if(password==""){QMessageBox::warning(this,tr("Error"),tr("Please enter a Password.")
|
||||
,tr("OK"),"","",0,0);
|
||||
if(password=="" && keyfile==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(keyfile==""){QMessageBox::warning(this,tr("Error"),tr("Please choose a key file.")
|
||||
,tr("OK"),"","",0,0);
|
||||
|
||||
if(KeyType==BOTH){
|
||||
if(password==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(keyfile==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(password=="" && keyfile==""){QMessageBox::warning(this,tr("Error")
|
||||
,tr("Please enter a Password or select a key file.")
|
||||
,tr("OK"),"","",0,0);
|
||||
|
||||
if(KeyType==BOTH || KeyType==KEYFILE){
|
||||
QFileInfo fileinfo(keyfile);
|
||||
if(!fileinfo.exists()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory does not exist."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
if(!fileinfo.isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory is not readable\n.Please check your permissions."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
if(fileinfo.isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
QFile file(keyfile+"pwsafe.key");
|
||||
if(!file.exists()){
|
||||
QDir dir(keyfile);
|
||||
QStringList files;
|
||||
files=dir.entryList("*.key",QDir::Files);
|
||||
if(!files.size()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The given directory does not contain any key files."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(files.size()>1){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The given directory contains more then one key file.\nPlease specify the key file directly."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
QFile file(keyfile+files[0]);
|
||||
Q_ASSERT(file.exists());
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
keyfile+=files[0];
|
||||
}else{
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
}else{
|
||||
QFile file(keyfile);
|
||||
if(!file.exists()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file could not be found."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
}
|
||||
done(1);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnPasswordChanged(const QString &txt)
|
||||
{
|
||||
password=Edit_Password->text();
|
||||
if(txt!="" && !(CheckBox_Both->isChecked())){
|
||||
Combo_Dirs->setDisabled(true);
|
||||
ButtonBrowse->setDisabled(true);}
|
||||
else{
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);}
|
||||
void CPasswordDialog::OnOK_Set(){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnCheckBox_BothChanged(int state)
|
||||
{
|
||||
if(state==QCheckBox::On){
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);}
|
||||
else{
|
||||
Edit_Password->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
void CPasswordDialog::ChangeEchoMode()
|
||||
{
|
||||
|
||||
if(Edit_Password->echoMode()==QLineEdit::Normal){
|
||||
Edit_Password->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
void CPasswordDialog::OnPasswordChanged(const QString &txt){
|
||||
if(CheckBox_Both->isChecked() || txt==QString())
|
||||
setStateBoth();
|
||||
else
|
||||
{
|
||||
Edit_Password->setEchoMode(QLineEdit::Normal);
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnComboTextChanged(const QString& txt){
|
||||
if(CheckBox_Both->isChecked() || txt==QString())
|
||||
setStateBoth();
|
||||
else
|
||||
setStateKeyFileOnly();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CPasswordDialog::OnCheckBox_BothChanged(int state){
|
||||
if(state==Qt::Checked)
|
||||
setStateBoth();
|
||||
if(state==Qt::Unchecked){
|
||||
if(Edit_Password->text()!=QString() && Combo_Dirs->currentText()!=QString()){
|
||||
Combo_Dirs->setEditText(QString());
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
else{
|
||||
if(Edit_Password->text()==QString())
|
||||
setStateKeyFileOnly();
|
||||
else
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CPasswordDialog::ChangeEchoMode(){
|
||||
if(Edit_Password->echoMode()==QLineEdit::Normal)
|
||||
Edit_Password->setEchoMode(QLineEdit::Password);
|
||||
else
|
||||
Edit_Password->setEchoMode(QLineEdit::Normal);
|
||||
}
|
||||
|
||||
|
||||
void CPasswordDialog::OnButtonExit(){
|
||||
done(2);
|
||||
|
|
|
@ -22,43 +22,36 @@
|
|||
#define PASSWORDDIALOG_H
|
||||
#include "lib/UrlLabel.h"
|
||||
#include "ui_PasswordDlg.h"
|
||||
//Added by qt3to4:
|
||||
#include <Q3ValueList>
|
||||
|
||||
class CPasswordDialog : public QDialog, public Ui_PasswordDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
int NumComboEntries;
|
||||
QStringList Paths;
|
||||
Q3ValueList<bool> IsFile;
|
||||
LinkLabel* Label_select;
|
||||
|
||||
bool Mode_Set; //true = Set, false = Get
|
||||
void setStatePasswordOnly();
|
||||
void setStateKeyFileOnly();
|
||||
void setStateBoth();
|
||||
|
||||
public:
|
||||
|
||||
QString keyfile;
|
||||
QString password;
|
||||
tKeyType KeyType;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
CPasswordDialog(QWidget* parent = 0, const char* name = 0, bool modal = false,
|
||||
bool ShowExitButton = false, Qt::WFlags fl = 0 );
|
||||
~CPasswordDialog();
|
||||
bool ShowExitButton = false, bool KeyMode_Set=false, Qt::WFlags fl = 0 );
|
||||
|
||||
public slots:
|
||||
virtual void OnOK();
|
||||
virtual void OnCancel();
|
||||
virtual void OnSelectClicked();
|
||||
virtual void OnButtonBrowse();
|
||||
virtual void OnButtonExit();
|
||||
virtual void OnComboSelectionChanged(int);
|
||||
virtual void OnPasswordChanged(const QString &txt);
|
||||
virtual void OnCheckBox_BothChanged(int state);
|
||||
virtual void ChangeEchoMode();
|
||||
|
||||
void OnOK();
|
||||
void OnOK_Set();
|
||||
void OnCancel();
|
||||
void OnButtonBrowse();
|
||||
void OnButtonBrowse_Set();
|
||||
void OnButtonExit();
|
||||
void OnPasswordChanged(const QString &txt);
|
||||
void OnCheckBox_BothChanged(int state);
|
||||
void ChangeEchoMode();
|
||||
void OnComboTextChanged(const QString&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "PwManager.h"
|
||||
#include "SearchDlg.h"
|
||||
#include <qlineedit.h>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include <qpixmap.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qspinbox.h>
|
||||
|
@ -62,6 +63,7 @@ CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
|
|||
Edit_BrowserCmd->setText(config.OpenUrlCommand);
|
||||
CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree);
|
||||
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
|
||||
Edit_MountDir->setText(config.MountDir);
|
||||
|
||||
}
|
||||
|
||||
|
@ -80,6 +82,9 @@ config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
|
|||
config.OpenUrlCommand=Edit_BrowserCmd->text();
|
||||
config.ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked();
|
||||
config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
|
||||
config.MountDir=Edit_MountDir->text();
|
||||
if(config.MountDir!="" && config.MountDir.right(1)!="/")
|
||||
config.MountDir+="/";
|
||||
close();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>578</width>
|
||||
<height>270</height>
|
||||
<height>275</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
|
@ -23,13 +23,13 @@
|
|||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>578</width>
|
||||
<height>270</height>
|
||||
<height>275</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>578</width>
|
||||
<height>270</height>
|
||||
<height>275</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -66,7 +66,7 @@
|
|||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>230</y>
|
||||
<y>240</y>
|
||||
<width>561</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
|
@ -114,34 +114,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>459</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>4</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Enter a Password and/or choose a key file.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Q3GroupBox" name="groupframe" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>561</width>
|
||||
<height>141</height>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
|
@ -158,16 +137,16 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<widget class="QWidget" name="" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>531</width>
|
||||
<height>30</height>
|
||||
<y>20</y>
|
||||
<width>541</width>
|
||||
<height>123</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -175,7 +154,25 @@
|
|||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel2" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="Label_PasswordRep" >
|
||||
<property name="text" >
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="Edit_Password" />
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="Label_Password" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
|
@ -189,27 +186,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="Edit_Password" />
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QToolButton" name="ButtonChangeEchoMode" >
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="Edit_PasswordRep" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>531</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
|
@ -218,7 +207,7 @@
|
|||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel3" >
|
||||
<widget class="QLabel" name="Label_KeyFile" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
|
@ -242,6 +231,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -263,16 +255,8 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>531</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
|
@ -309,8 +293,31 @@
|
|||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>459</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>4</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Enter a Password and/or choose a key file.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<pixmapfunction></pixmapfunction>
|
||||
|
|
|
@ -464,32 +464,49 @@
|
|||
<string>Alt+Ö</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget" >
|
||||
<widget class="QWidget" name="" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>531</width>
|
||||
<height>25</height>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1_4" >
|
||||
<item row="1" column="2" >
|
||||
<widget class="QPushButton" name="Button_MountDirBrowse" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Browser Command:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="Edit_MountDir" />
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="Edit_BrowserCmd" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Media Directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -514,7 +531,6 @@
|
|||
<tabstop>ButtonTextColor</tabstop>
|
||||
<tabstop>ButtonColor2</tabstop>
|
||||
<tabstop>CheckBox_OpenLast</tabstop>
|
||||
<tabstop>Edit_BrowserCmd</tabstop>
|
||||
<tabstop>ButtonOK</tabstop>
|
||||
<tabstop>ButtonCancel</tabstop>
|
||||
</tabstops>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDragMoveEvent>
|
||||
|
@ -29,6 +30,7 @@
|
|||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "EntryView.h"
|
||||
|
||||
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
#include <QString>
|
||||
#include <QColor>
|
||||
#include <QIcon>
|
||||
#include "PwmConfig.h"
|
||||
|
||||
#define KEEPASS_VERSION "0.2.0"
|
||||
#define NUM_CLIENT_ICONS 62
|
||||
|
||||
typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2};
|
||||
class CConfig;
|
||||
|
||||
void createBanner(QLabel *Banner,QPixmap* symbol,QString text);
|
||||
void createBanner(QLabel *Banner,QPixmap* symbol,QString text,QColor color1,QColor color2,QColor textcolor);
|
||||
void openBrowser(QString url);
|
||||
|
|
|
@ -246,7 +246,7 @@ CPasswordDialog PasswordDlg(this,"Password Dialog",true,s);
|
|||
PasswordDlg.setCaption(filename);
|
||||
int r=PasswordDlg.exec();
|
||||
if(r==0) return;
|
||||
if(r==2) {Start=false; close(); return;}
|
||||
if(r==2) {Start=false; return;}
|
||||
Q_ASSERT(r==1);
|
||||
db = new PwDatabase();
|
||||
GroupView->db=db;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue