First commit for 0.2.3, some old functions still need to be ported to the new back-end api, i.e. import and export.

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@104 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
tarek_saidi
2006-10-14 22:33:41 +00:00
parent 0286b87a41
commit 21f0fea56a
67 changed files with 8909 additions and 6954 deletions

View File

@@ -24,8 +24,9 @@
#include <qfile.h>
#include <qdom.h>
using namespace std;
/*
bool Import_KWalletXml::importFile(QString FileName,Database* pwm,QString& err){
bool Import_KWalletXml::importFile(QString FileName,StandardDatabase* pwm,QString& err){
QFile file(FileName);
if(!file.exists()){
err+=QObject::tr("File not found.");
@@ -58,14 +59,14 @@ for(int i=0;i<groups.length();i++){
if(!groups.item(i).isElement()){err+=QObject::tr("Invalid XML file."); return false;}
QDomElement CurrGroup=groups.item(i).toElement();
if(!CurrGroup.hasAttribute("name")){err+=QObject::tr("Invalid XML file."); return false;}
CGroup* NewGroup=pwm->addGroup(NULL);
IGroupHandle* NewGroup=pwm->addGroup(NULL);
NewGroup->Name=CurrGroup.attribute("name");
QDomNodeList entries=CurrGroup.elementsByTagName("password");
for(int j=0;j<entries.length();j++){
if(!entries.item(j).isElement()){err+=QObject::tr("Invalid XML file."); return false;}
QDomElement CurrEntry=entries.item(j).toElement();
if(!CurrEntry.hasAttribute("name")){err+=QObject::tr("Invalid XML file."); return false;}
CEntry* NewEntry=pwm->addEntry();
IEntryHandle* NewEntry=pwm->addEntry();
NewEntry->Title=CurrEntry.attribute("name");
NewEntry->GroupID=NewGroup->ID;
QString pw=CurrEntry.text();
@@ -77,4 +78,4 @@ pwm->SearchGroupID=-1;
pwm->CryptoAlgorithmus=ALGO_AES;
pwm->KeyEncRounds=6000;
return true;
}
}*/

View File

@@ -20,11 +20,11 @@
#ifndef _IMPORT_KWALLET_H_
#define _IMPORT_KWALLET_H_
#include <qstring.h>
#include "PwManager.h"
#include "StandardDatabase.h"
class Import_KWalletXml{
public:
bool importFile(QString FileName,Database* db,QString& err);
bool importFile(QString FileName,StandardDatabase* db,QString& err);
private:
};

View File

@@ -22,12 +22,13 @@
#include <qfile.h>
#include <iostream>
#include <qdom.h>
#include "crypto/blowfish.h"
#include "crypto/sha1.h"
//#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){
bool Import_PwManager::importFile(QString filename, QString password, Database* db, QString& err){
database=db;
QFile file(filename);
char* buffer=NULL;
@@ -133,7 +134,7 @@ while(1){
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;
CGroup* NewGroup=database->addGroup(NULL);
IGroupHandle* NewGroup=database->addGroup(NULL);
NewGroup->Name=CurrGroup.attribute("n");
int j=0;
while(1){
@@ -151,8 +152,8 @@ while(1){
return true;
}
bool Import_PwManager::xml_parseEntryAttributes(QDomElement* EntryElement,CGroup* NewGroup){
CEntry* e=database->addEntry();
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();
@@ -163,4 +164,4 @@ e->URL=EntryElement->elementsByTagName("u").item(0).toElement().text();
e->GroupID=NewGroup->ID;
return true;
}
*/

View File

@@ -22,20 +22,21 @@
#define _IMPORT_PWMANAGER_
#include <qdom.h>
#include <qstring.h>
#include "PwManager.h"
#include "StandardDatabase.h"
/*
class Import_PwManager{
public:
bool importFile(QString FileName, QString Password,Database* db,QString& err);
bool importFile(QString FileName, QString Password,StandardDatabase* db,QString& err);
private:
bool KeyFlag; // true=Password, false=Chipcard
int Compression; // 0=none, 1=gzip, 2=bzip2
unsigned char KeyHash[20];
unsigned char DataHash[20];
Database* database;
StandardDatabase* database;
bool parseXmlContent(char* content);
bool xml_parseEntryAttributes(QDomElement* EntryTag,CGroup* parent);
bool xml_parseEntryAttributes(QDomElement* EntryTag,IGroupHandle* parent);
};
*/
#endif