added KeePassX_XML export,

PwManager import works again,
text export works again.

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@125 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 18 years ago
parent 28ba242090
commit 50a39d726a
  1. 5
      src/dialogs/EditEntryDlg.cpp
  2. 52
      src/dialogs/SimplePasswordDlg.cpp
  3. 20
      src/dialogs/SimplePasswordDlg.h
  4. 7
      src/export/Export_Txt.cpp
  5. 11
      src/export/Export_Txt.h
  6. 474
      src/forms/EditEntryDlg.ui
  7. 84
      src/forms/MainWindow.ui
  8. 156
      src/forms/SimplePasswordDlg.ui
  9. 12
      src/import/Import_KWalletXml.cpp
  10. 274
      src/import/Import_PwManager.cpp
  11. 35
      src/import/Import_PwManager.h
  12. 174
      src/mainwindow.cpp
  13. 7
      src/mainwindow.h
  14. 12
      src/src.pro

@ -60,12 +60,12 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
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(buttonBox->button(QDialogButtonBox::Cancel), 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(buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),this,SLOT(OnButtonOK()));
connect(CheckBox_ExpiresNever,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxExpiresNeverChanged(int)));
connect(Button_CustomIcons,SIGNAL(clicked()),this,SLOT(OnCustomIcons()));
@ -139,6 +139,7 @@ if(event->spontaneous()==false){
//Added resize event
void CEditEntryDlg::resizeEvent(QResizeEvent *event){
createBanner(&BannerPixmap,Icon_Key32x32,tr("Test 2"),width());
QDialog::resizeEvent(event);
}

@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2005 by Tarek Saidi *
* mail@tarek-saidi.de *
* Copyright (C) 2005-2007 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 *
@ -18,46 +18,50 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <qlineedit.h>
#include <qpushbutton.h>
#include <QLineEdit>
#include <QPushButton>
#include "main.h"
#include "PwmConfig.h"
#include "SimplePasswordDlg.h"
CSimplePasswordDialog::CSimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl)
SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl)
: QDialog(parent,fl)
{
setupUi(this);
if(!config.ShowPasswords)Button_HidePassword->toggle();
connect(ButtonOK,SIGNAL(clicked()),this,SLOT(OnOK()));
connect(ButtonCancel,SIGNAL(clicked()),this,SLOT(OnCancel()));
connect(Button_HidePassword,SIGNAL(toggled(bool)),this,SLOT(OnHidePasswordToggled(bool)));
setupUi(this);
if(!config.ShowPasswords)Button_HidePassword->toggle();
connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnOK()));
connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(OnCancel()));
connect(Button_HidePassword,SIGNAL(toggled(bool)),this,SLOT(OnHidePasswordToggled(bool)));
connect(EditPassword,SIGNAL(textChanged(const QString&)),this,SLOT(OnTextChanged(const QString&)));
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
}
CSimplePasswordDialog::~CSimplePasswordDialog()
SimplePasswordDialog::~SimplePasswordDialog()
{
}
void CSimplePasswordDialog::OnCancel()
{
done(0);
void SimplePasswordDialog::OnTextChanged(const QString& txt){
if(txt==QString())
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
else
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
void CSimplePasswordDialog::OnOK()
void SimplePasswordDialog::OnCancel()
{
password=EditPassword->text();
done(1);
done(0);
}
void CSimplePasswordDialog::OnHidePasswordToggled(bool state)
void SimplePasswordDialog::OnOK()
{
if(state)EditPassword->setEchoMode(QLineEdit::Password);
else EditPassword->setEchoMode(QLineEdit::Normal);
password=EditPassword->text();
done(1);
}
/*$SPECIALIZATION$*/
void SimplePasswordDialog::OnHidePasswordToggled(bool state)
{
if(state)EditPassword->setEchoMode(QLineEdit::Password);
else EditPassword->setEchoMode(QLineEdit::Normal);
}

@ -23,31 +23,21 @@
#include "ui_SimplePasswordDlg.h"
class CSimplePasswordDialog : public QDialog, public Ui_SimplePasswordDialog
class SimplePasswordDialog : public QDialog, public Ui_SimplePasswordDialog
{
Q_OBJECT
public:
CSimplePasswordDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CSimplePasswordDialog();
/*$PUBLIC_FUNCTIONS$*/
SimplePasswordDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~SimplePasswordDialog();
public slots:
/*$PUBLIC_SLOTS$*/
protected:
/*$PROTECTED_FUNCTIONS$*/
protected slots:
/*$PROTECTED_SLOTS$*/
public: QString password;
public: QString password;
public slots:
virtual void OnCancel();
public slots:
virtual void OnOK();
public slots:
virtual void OnHidePasswordToggled(bool state);
virtual void OnTextChanged(const QString&);
};
#endif

@ -37,7 +37,9 @@ QString GroupTemplate=QString("\n\
*** Group: %1 ***\n\
");
QString Export_Txt::exportDatabase(QWidget* GuiParent, IDatabase* db, QIODevice* file){
bool Export_Txt::exportDatabase(QWidget* GuiParent, IDatabase* db){
QFile *file=openFile(GuiParent,identifier(),QStringList()<<tr("All Files (*)") << tr("Text Files (*.txt)"));
if(!file)return false;
QList<IGroupHandle*> groups=db->sortedGroups();
for(int g=0;g<groups.size();g++){
file->write(GroupTemplate.arg(groups[g]->title()).toUtf8());
@ -54,5 +56,6 @@ QString Export_Txt::exportDatabase(QWidget* GuiParent, IDatabase* db, QIODevice*
password.lock();
}
}
return QString();
delete file;
return true;
}

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005-2006 by Tarek Saidi *
* Copyright (C) 2005-2007 by Tarek Saidi *
* tarek.saidi@arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
@ -21,12 +21,13 @@
#define _EXPORT_TXT_H_
#include <QObject>
#include "IExport.h"
#include "Export.h"
class Export_Txt:public QObject, public IExport{
class Export_Txt:public IExport, public ExporterBase{
public:
virtual QString exportDatabase(QWidget* GuiParent, IDatabase* Database, QIODevice* Dest);
virtual QString name(){return QString("Txt");}
virtual bool exportDatabase(QWidget* GuiParent, IDatabase* Database);
virtual QString identifier(){return "e_txt";}
virtual QString title(){return "Text File";}
};
#endif

@ -1,7 +1,5 @@
<ui version="4.0" >
<author>Tarek Saidi</author>
<comment></comment>
<exportmacro></exportmacro>
<class>EditEntryDialog</class>
<widget class="QDialog" name="EditEntryDialog" >
<property name="geometry" >
@ -48,23 +46,7 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3" >
<item rowspan="2" row="5" column="1" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
@ -72,22 +54,8 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="6" column="0" >
<widget class="QLabel" name="textLabel9" >
<property name="text" >
<string>Quality:</string>
</property>
</widget>
</item>
<item row="9" column="0" >
<widget class="QLabel" name="textLabel12" >
<property name="text" >
<string>Attachment:</string>
</property>
</widget>
</item>
<item row="4" column="5" >
<widget class="QToolButton" name="ButtonEchoMode" >
<item row="1" column="1" >
<widget class="QToolButton" name="ButtonGenPw" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
@ -109,53 +77,15 @@
</size>
</property>
<property name="text" >
<string>...</string>
<string>Ge&amp;n.</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="textLabel4" >
<property name="text" >
<string>Title:</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="textLabel5" >
<property name="text" >
<string>Username:</string>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QLabel" name="textLabel10" >
<property name="text" >
<string>Comment:</string>
</property>
</widget>
</item>
<item row="8" column="1" >
<widget class="QDateTimeEdit" name="DateTime_Expire" />
</item>
<item row="10" column="1" >
<widget class="QLabel" name="Label_AttachmentSize" >
<property name="text" >
<string>%1</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="4" >
<widget class="QLineEdit" name="Edit_Password" />
</item>
<item row="3" column="0" >
<widget class="QLabel" name="textLabel7" >
<property name="text" >
<string>URL:</string>
</property>
</widget>
<widget class="QLineEdit" name="Edit_Password_w" />
</item>
<item row="5" column="5" >
<widget class="QToolButton" name="ButtonGenPw" >
<item row="0" column="1" >
<widget class="QToolButton" name="ButtonEchoMode" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
@ -177,24 +107,203 @@
</size>
</property>
<property name="text" >
<string>Ge&amp;n.</string>
<string>...</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="4" >
<widget class="QLineEdit" name="Edit_Password_w" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel3" >
<property name="text" >
<string>Group:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="5" >
<widget class="QLineEdit" name="Edit_Title" />
<widget class="QLineEdit" name="Edit_Password" />
</item>
<item row="9" column="1" colspan="3" >
</layout>
</item>
<item row="7" column="0" >
<widget class="QLabel" name="textLabel9" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Quality:</string>
</property>
</widget>
</item>
<item row="10" column="0" >
<widget class="QLabel" name="textLabel12" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Attachment:</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="textLabel4" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Title:</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="textLabel5" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Username:</string>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QLabel" name="textLabel10" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Comment:</string>
</property>
</widget>
</item>
<item row="11" column="1" >
<widget class="QLabel" name="Label_AttachmentSize" >
<property name="text" >
<string>%1</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="textLabel7" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>URL:</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="textLabel3" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Group:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="Edit_Title" />
</item>
<item row="3" column="1" >
<widget class="QLineEdit" name="Edit_UserName" />
</item>
<item row="6" column="0" >
<widget class="QLabel" name="textLabel8" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Password Repet.:</string>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="textLabel6" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Password:</string>
</property>
</widget>
</item>
<item row="9" column="0" >
<widget class="QLabel" name="textLabel11" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Expires:</string>
</property>
</widget>
</item>
<item row="8" column="1" >
<widget class="QTextEdit" name="Edit_Comment" />
</item>
<item row="12" column="0" colspan="2" >
<widget class="Line" name="line1" >
<property name="frameShape" >
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="10" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLineEdit" name="Edit_Attachment" >
<property name="enabled" >
<bool>false</bool>
@ -209,107 +318,67 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="5" >
<widget class="QLineEdit" name="Edit_UserName" />
</item>
<item row="5" column="0" >
<widget class="QLabel" name="textLabel8" >
<item>
<widget class="QToolButton" name="ButtonOpenAttachment" >
<property name="text" >
<string>Password Repet.:</string>
<string/>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="Combo_Group" />
</item>
<item row="3" column="1" colspan="5" >
<widget class="QLineEdit" name="Edit_URL" />
</item>
<item row="4" column="0" >
<widget class="QLabel" name="textLabel6" >
<property name="text" >
<string>Password:</string>
<property name="icon" >
<iconset/>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QLabel" name="textLabel11" >
<item>
<widget class="QToolButton" name="ButtonSaveAttachment" >
<property name="text" >
<string>Expires:</string>
<string/>
</property>
<property name="icon" >
<iconset/>
</property>
</widget>
</item>
<item row="7" column="1" colspan="5" >
<widget class="QTextEdit" name="Edit_Comment" />
</item>
<item row="11" column="0" colspan="6" >
<widget class="Line" name="line1" >
<property name="frameShape" >
<enum>QFrame::HLine</enum>
<item>
<widget class="QToolButton" name="ButtonDeleteAttachment" >
<property name="text" >
<string/>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<property name="icon" >
<iconset/>
</property>
</widget>
</item>
<item row="9" column="4" colspan="2" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QToolButton" name="ButtonOpenAttachment" >
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="ButtonSaveAttachment" >
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="ButtonDeleteAttachment" >
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset/>
</property>
</widget>
</item>
</layout>
</layout>
</item>
<item row="9" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QDateTimeEdit" name="DateTime_Expire" />
</item>
<item row="8" column="2" colspan="4" >
<item>
<widget class="QCheckBox" name="CheckBox_ExpiresNever" >
<property name="text" >
<string>Never</string>
</property>
</widget>
</item>
<item row="6" column="5" >
<widget class="QLabel" name="Label_Bits" >
<property name="text" >
<string>%1 Bit</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="4" >
</layout>
</item>
<item row="7" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QProgressBar" name="Progress_Quali" >
<property name="minimumSize" >
<size>
@ -334,7 +403,30 @@
</property>
</widget>
</item>
<item row="0" column="3" >
<item>
<widget class="QLabel" name="Label_Bits" >
<property name="text" >
<string>%1 Bit</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1" >
<widget class="QLineEdit" name="Edit_URL" />
</item>
<item row="1" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QComboBox" name="Combo_Group" />
</item>
<item>
<widget class="QLabel" name="textLabel1" >
<property name="text" >
<string>Icon:</string>
@ -344,10 +436,10 @@
</property>
</widget>
</item>
<item row="0" column="4" >
<item>
<widget class="QComboBox" name="Combo_IconPicker" />
</item>
<item row="0" column="5" >
<item>
<widget class="QToolButton" name="Button_CustomIcons" >
<property name="text" >
<string>></string>
@ -356,35 +448,28 @@
</item>
</layout>
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="ButtonCancel" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="shortcut" >
<string>Alt+C</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="ButtonOK" >
<property name="text" >
<string>O&amp;K</string>
<item row="13" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="shortcut" >
<string>Alt+K</string>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="2" column="0" >
<item row="0" column="0" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
@ -392,7 +477,6 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<tabstops>
<tabstop>Combo_Group</tabstop>
<tabstop>Combo_IconPicker</tabstop>

@ -137,38 +137,6 @@
<addaction name="EditSearchAction" />
<addaction name="EditGroupSearchAction" />
</widget>
<widget class="QMenu" name="menuDatei" >
<property name="title" >
<string>&amp;File</string>
</property>
<widget class="QMenu" name="menuImportieren_aus" >
<property name="title" >
<string>&amp;Import from...</string>
</property>
<addaction name="FileImpPwmAction" />
<addaction name="FileImpKWalletXmlAction" />
</widget>
<widget class="QMenu" name="menuExport_to" >
<property name="title" >
<string>&amp;Export to...</string>
</property>
<addaction name="FileExpPlainTextAction" />
</widget>
<addaction name="FileNewAction" />
<addaction name="FileOpenAction" />
<addaction name="FileCloseAction" />
<addaction name="separator" />
<addaction name="FileSaveAction" />
<addaction name="FileSaveAsAction" />
<addaction name="separator" />
<addaction name="FileSettingsAction" />
<addaction name="FileChangeKeyAction" />
<addaction name="separator" />
<addaction name="menuImportieren_aus" />
<addaction name="menuExport_to" />
<addaction name="separator" />
<addaction name="FileExitAction" />
</widget>
<widget class="QMenu" name="ViewMenu" >
<property name="title" >
<string>&amp;View</string>
@ -221,6 +189,35 @@
<addaction name="ExtrasSettingsAction" />
<addaction name="ExtrasPasswordGenAction" />
</widget>
<widget class="QMenu" name="menuDatei" >
<property name="title" >
<string>&amp;File</string>
</property>
<widget class="QMenu" name="menuExport" >
<property name="title" >
<string>&amp;Export to...</string>
</property>
</widget>
<widget class="QMenu" name="menuImport" >
<property name="title" >
<string>&amp;Import from...</string>
</property>
</widget>
<addaction name="FileNewAction" />
<addaction name="FileOpenAction" />
<addaction name="FileCloseAction" />
<addaction name="separator" />
<addaction name="FileSaveAction" />
<addaction name="FileSaveAsAction" />
<addaction name="separator" />
<addaction name="FileSettingsAction" />
<addaction name="FileChangeKeyAction" />
<addaction name="separator" />
<addaction name="menuImport" />
<addaction name="menuExport" />
<addaction name="separator" />
<addaction name="FileExitAction" />
</widget>
<addaction name="menuDatei" />
<addaction name="menuBearbeiten" />
<addaction name="ViewMenu" />
@ -262,16 +259,6 @@
<string>E&amp;xit</string>
</property>
</action>
<action name="FileImpPwmAction" >
<property name="text" >
<string>PwManager File (*.pwm)</string>
</property>
</action>
<action name="FileImpKWalletXmlAction" >
<property name="text" >
<string>KWallet XML-File (*.xml)</string>
</property>
</action>
<action name="EditNewGroupAction" >
<property name="text" >
<string>Add New Group...</string>
@ -464,11 +451,6 @@
<string>&amp;KeePassX Handbook...</string>
</property>
</action>
<action name="FileExpPlainTextAction" >
<property name="text" >
<string>Plain Text (*.txt)</string>
</property>
</action>
<action name="HideSearchResultsAction" >
<property name="text" >
<string>Hide</string>
@ -526,14 +508,14 @@
</widget>
<customwidgets>
<customwidget>
<class>KeepassGroupView</class>
<class>KeepassEntryView</class>
<extends>QTreeWidget</extends>
<header>../../src/lib/GroupView.h</header>
<header>../../src/lib/EntryView.h</header>
</customwidget>
<customwidget>
<class>KeepassEntryView</class>
<class>KeepassGroupView</class>
<extends>QTreeWidget</extends>
<header>../../src/lib/EntryView.h</header>
<header>../../src/lib/GroupView.h</header>
</customwidget>
</customwidgets>
<resources/>

@ -1,7 +1,4 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>SimplePasswordDialog</class>
<widget class="QDialog" name="SimplePasswordDialog" >
<property name="geometry" >
@ -15,7 +12,7 @@
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -28,87 +25,92 @@
</property>
<property name="maximumSize" >
<size>
<width>345</width>
<width>16777215</width>
<height>90</height>
</size>
</property>
<property name="windowTitle" >
<string>Enter your Password</string>
</property>
<widget class="QLabel" name="textLabel1" >
<property name="geometry" >
<rect>
<x>10</x>
<y>20</y>
<width>60</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Password:</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonOK" >
<property name="geometry" >
<rect>
<x>170</x>
<y>60</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>O&amp;K</string>
</property>
<property name="shortcut" >
<string>Alt+K</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonCancel" >
<property name="geometry" >
<rect>
<x>257</x>
<y>60</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="shortcut" >
<string>Alt+C</string>
</property>
</widget>
<widget class="QLineEdit" name="EditPassword" >
<property name="geometry" >
<rect>
<x>80</x>
<y>20</y>
<width>240</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="Button_HidePassword" >
<property name="geometry" >
<rect>
<x>320</x>
<y>20</y>
<width>20</width>
<height>21</height>
</rect>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="shortcut" >
<string/>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="checkable" >
<bool>true</bool>
<property name="spacing" >
<number>6</number>
</property>
</widget>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel1" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="EditPassword" />
</item>
<item>
<widget class="QPushButton" name="Button_HidePassword" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>28</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>28</width>
<height>16777215</height>
</size>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>

@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2005 by Tarek Saidi *
* mail@tarek-saidi.de *
* Copyright (C) 2005-2007 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 *
@ -19,11 +19,9 @@
***************************************************************************/
#include "Import_KWalletXml.h"
#include <iostream>
#include <qobject.h>
#include <qfile.h>
#include <qdom.h>
using namespace std;
#include <QFile>
#include <QtXml>
/*
bool Import_KWalletXml::importFile(QString FileName,StandardDatabase* pwm,QString& err){

@ -18,150 +18,152 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <qobject.h>
#include <qfile.h>
#include <QFile>
#include <iostream>
#include <qdom.h>
//#include "crypto/blowfish.h"
//#include "crypto/sha1.h"
#include <QMessageBox>
#include <QtXml>
#include "crypto/blowfish.h"
#include "crypto/sha1.h"
#include "Import_PwManager.h"
using namespace std;
/*
bool Import_PwManager::importFile(QString filename, QString password, StandardDatabase* db, QString& err){
database=db;
QFile file(filename);
char* buffer=NULL;
int offset=0;
int len=0;
if(!file.exists()){err+=QObject::tr("File not found."); return false;}
if(!file.open(QIODevice::ReadOnly)){err+=QObject::tr("Could not open file."); return false;}
if(len=file.size()) buffer=new char[len];
else {err+=QObject::tr("File is empty."); return false;}
file.read(buffer,len);
file.close();
if(QString::fromAscii(buffer,17)!="PWM_PASSWORD_FILE")
{err+=QObject::tr("File is no valid PwManager file."); return false;}
offset+=17;
if(buffer[offset]!=0x05)
{err+=QObject::tr("Unsupported file version."); return false;}
offset++;
if(buffer[offset]!=0x01)
{err+=QObject::tr("Unsupported hash algorithm."); return false;}
offset++;
if(buffer[offset]!=0x01)
{err+=QObject::tr("Unsupported hash algorithm."); return false;}
offset++;
if(buffer[offset]!=0x01)
{err+=QObject::tr("Unsupported encryption algorithm."); return false;}
offset++;
if(buffer[offset]==0x00)Compression=0;
if(buffer[offset]==0x01)Compression=1;
if(buffer[offset]==0x02)Compression=2;
///@TODO Compression
if(buffer[offset])
{err+=QObject::tr("Compressed files are not supported yet."); return false;}
offset++;
if(buffer[offset]==0x00)KeyFlag=true;
else KeyFlag=false;
offset++;
//Reserved Bytes (64)
offset+=64;
memcpy(KeyHash,buffer+offset,20);
offset+=20;
memcpy(DataHash,buffer+offset,20);
offset+=20;
Blowfish blowfish;
int pwlen=password.length();
byte* Key=new byte[pwlen];
byte* xml=new byte[len-offset+1];
xml[len-offset]=0;
memcpy(Key,password.toAscii(),pwlen);
char* key_hash=new char[20];
CSHA1 sha;
sha.Update(Key,pwlen);
sha.Final();
sha.GetHash((unsigned char*)key_hash);
if(memcmp(key_hash,KeyHash,20)){
delete[] Key; delete [] key_hash; delete [] buffer;
err+=QObject::tr("Wrong password.");
return false;
}
delete [] key_hash;
blowfish.bf_setkey(Key,password.length());
blowfish.bf_decrypt(xml,(byte*)buffer+offset,len-offset);
delete [] Key;
delete [] buffer;
char* content_hash=new char[20];
sha.Reset();
sha.Update(xml,strlen((char*)xml)-1);
sha.Final();
sha.GetHash((unsigned char*)content_hash);
if(memcmp(content_hash,DataHash,20)){
delete [] content_hash; delete [] xml;
err+=QObject::tr("File is damaged (hash test failed).");
return false;
}
delete[] content_hash;
if(!parseXmlContent((char*)xml)){
delete [] xml;
err+=QObject::tr("Invalid XML data (see stdout for details)."); return false;}
database->CalcMasterKeyByPassword(password);
return true;
bool Import_PwManager::importDatabase(QWidget* GuiParent, IDatabase* db){
database=db;
QFile* file=openFile(GuiParent,identifier(),QStringList()<<tr("PwManager Files (*.pwm)")<<tr("All Files (*)"));
if(!file)return false;
QString password=getPassword(GuiParent);
if(password==QString()){delete file; return false;}
char* buffer=NULL;
int offset=0;
int len=0;
if(len=file->size()) buffer=new char[len];
else {QMessageBox::critical(GuiParent,tr("Import Failed"),tr("File is empty.")); delete file; return false;}
file->read(buffer,len);
file->close();
delete file;
if(QString::fromAscii(buffer,17)!="PWM_PASSWORD_FILE")
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("File is no valid PwManager file.")); return false;}
offset+=17;
if(buffer[offset]!=0x05)
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Unsupported file version.")); return false;}
offset++;
if(buffer[offset]!=0x01)
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Unsupported hash algorithm.")); return false;}
offset++;
if(buffer[offset]!=0x01)
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Unsupported hash algorithm.")); return false;}
offset++;
if(buffer[offset]!=0x01)
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Unsupported encryption algorithm.")); return false;}
offset++;
if(buffer[offset]==0x00)Compression=0;
if(buffer[offset]==0x01)Compression=1;
if(buffer[offset]==0x02)Compression=2;
///@TODO Compression
if(buffer[offset])
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Compressed files are not supported yet.")); return false;}
offset++;
if(buffer[offset]==0x00)KeyFlag=true;
else KeyFlag=false;
offset++;
//Reserved Bytes (64)
offset+=64;
memcpy(KeyHash,buffer+offset,20);
offset+=20;
memcpy(DataHash,buffer+offset,20);
offset+=20;
Blowfish blowfish;
int pwlen=password.length();
byte* Key=new byte[pwlen];
byte* xml=new byte[len-offset+1];
xml[len-offset]=0;
memcpy(Key,password.toAscii(),pwlen);
char* key_hash=new char[20];
CSHA1 sha;
sha.Update(Key,pwlen);
sha.Final();
sha.GetHash((unsigned char*)key_hash);
if(memcmp(key_hash,KeyHash,20)){
delete[] Key; delete [] key_hash; delete [] buffer;
QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Wrong password."));
return false;
}
delete [] key_hash;
blowfish.bf_setkey(Key,password.length());
blowfish.bf_decrypt(xml,(byte*)buffer+offset,len-offset);
delete [] Key;
delete [] buffer;
char* content_hash=new char[20];
sha.Reset();
sha.Update(xml,strlen((char*)xml)-1);
sha.Final();
sha.GetHash((unsigned char*)content_hash);
if(memcmp(content_hash,DataHash,20)){
delete [] content_hash; delete [] xml;
QMessageBox::critical(GuiParent,tr("Import Failed"),tr("File is damaged (hash test failed)."));
return false;
}
delete[] content_hash;
if(!parseXmlContent((char*)xml)){
delete [] xml;
QMessageBox::critical(GuiParent,tr("Import Failed"),tr("Invalid XML data (see stdout for details).")); return false;}
dynamic_cast<IFilePasswordAuth*>(database)->authByPwd(password);
return true;
}
bool Import_PwManager::parseXmlContent(char* content){
QDomDocument db;
QString err;
int col,line;
if(!db.setContent(QString::fromUtf8(content,strlen(content)-1),false,&err,&line,&col)){
qWarning("Import_PwManager::parseXmlContent():\n");
qWarning(((err+" (Line:%1 Column:%2)").arg(line).arg(col)+QString('\n')).toAscii());
return false;}
QDomElement root=db.documentElement();
if(root.tagName()!="P")return false;
//Achtung! Kommentare und Kategorien haben das selbe Tag "c"
if(!root.elementsByTagName("c").item(0).isElement())return false;
QDomElement groups=root.elementsByTagName("c").item(0).toElement();
int i=0;
while(1){
QDomElement CurrGroup;
if(!groups.elementsByTagName("c"+QString::number(i)).length())break;
if(groups.elementsByTagName("c"+QString::number(i)).length()>1)return false;
if(!groups.elementsByTagName("c"+QString::number(i)).item(0).isElement())return false;
CurrGroup=groups.elementsByTagName("c"+QString::number(i)).item(0).toElement();
if(!CurrGroup.hasAttribute("n"))return false;
IGroupHandle* NewGroup=database->addGroup(NULL);
NewGroup->Name=CurrGroup.attribute("n");
int j=0;
QDomDocument db;
QString err;
int col,line;
if(!db.setContent(QString::fromUtf8(content,strlen(content)-1),false,&err,&line,&col)){
qWarning("Import_PwManager::parseXmlContent():\n");
qWarning(((err+" (Line:%1 Column:%2)").arg(line).arg(col)+QString('\n')).toAscii());
return false;}
QDomElement root=db.documentElement();
if(root.tagName()!="P")return false;
//Achtung! Kommentare und Kategorien haben das selbe Tag "c"
if(!root.elementsByTagName("c").item(0).isElement())return false;
QDomElement groups=root.elementsByTagName("c").item(0).toElement();
int i=0;
while(1){
QDomElement CurrEntry;
if(!CurrGroup.elementsByTagName("e"+QString::number(j)).length())break;
if(CurrGroup.elementsByTagName("e"+QString::number(j)).length()>1)return false;
if(!CurrGroup.elementsByTagName("e"+QString::number(j)).item(0).isElement())return false;
CurrEntry=CurrGroup.elementsByTagName("e"+QString::number(j)).item(0).toElement();
if(!xml_parseEntryAttributes(&CurrEntry,NewGroup))return false;
j++;
QDomElement CurrGroup;
if(!groups.elementsByTagName("c"+QString::number(i)).length())break;
if(groups.elementsByTagName("c"+QString::number(i)).length()>1)return false;
if(!groups.elementsByTagName("c"+QString::number(i)).item(0).isElement())return false;
CurrGroup=groups.elementsByTagName("c"+QString::number(i)).item(0).toElement();
if(!CurrGroup.hasAttribute("n"))return false;
IGroupHandle* NewGroup=database->addGroup(&CGroup(),NULL);
NewGroup->setTitle(CurrGroup.attribute("n"));
int j=0;
while(1){
QDomElement CurrEntry;
if(!CurrGroup.elementsByTagName("e"+QString::number(j)).length())break;
if(CurrGroup.elementsByTagName("e"+QString::number(j)).length()>1)return false;
if(!CurrGroup.elementsByTagName("e"+QString::number(j)).item(0).isElement())return false;
CurrEntry=CurrGroup.elementsByTagName("e"+QString::number(j)).item(0).toElement();
if(!xml_parseEntryAttributes(&CurrEntry,NewGroup))return false;
j++;
}
i++;
}
i++;
return true;
}
return true;
}
bool Import_PwManager::xml_parseEntryAttributes(QDomElement* EntryElement,IGroupHandle* NewGroup){/*
IEntryHandle* e=database->addEntry();
e->Title=EntryElement->elementsByTagName("d").item(0).toElement().text();
e->UserName=EntryElement->elementsByTagName("n").item(0).toElement().text();
QString pw=EntryElement->elementsByTagName("p").item(0).toElement().text();
e->Password.setString(pw,true);
e->Additional=EntryElement->elementsByTagName("c").item(0).toElement().text();
e->Additional=e->Additional.replace("$>--endl--<$","\n");
e->URL=EntryElement->elementsByTagName("u").item(0).toElement().text();
e->GroupID=NewGroup->ID;
return true;
}
*/
bool Import_PwManager::xml_parseEntryAttributes(QDomElement* EntryElement,IGroupHandle* NewGroup){
IEntryHandle* e=database->newEntry(NewGroup);
e->setTitle(EntryElement->elementsByTagName