Implement GUI to import KeePass 1 databases.

Closes #2
This commit is contained in:
Felix Geyer 2012-05-12 10:08:41 +02:00
parent 4807ec3368
commit 05c41c083e
11 changed files with 170 additions and 19 deletions

View file

@ -235,15 +235,9 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
return db.take();
}
Database* KeePass1Reader::readDatabase(const QString& filename, const QString& password,
Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& password,
const QString& keyfileName)
{
QFile dbFile(filename);
if (!dbFile.open(QFile::ReadOnly)) {
raiseError(dbFile.errorString());
return 0;
}
QScopedPointer<QFile> keyFile;
if (!keyfileName.isEmpty()) {
keyFile.reset(new QFile(keyfileName));
@ -253,14 +247,28 @@ Database* KeePass1Reader::readDatabase(const QString& filename, const QString& p
}
}
QScopedPointer<Database> db(readDatabase(&dbFile, password, keyFile.data()));
QScopedPointer<Database> db(readDatabase(device, password, keyFile.data()));
return db.take();
}
Database* KeePass1Reader::readDatabase(const QString& filename, const QString& password,
const QString& keyfileName)
{
QFile dbFile(filename);
if (!dbFile.open(QFile::ReadOnly)) {
raiseError(dbFile.errorString());
return 0;
}
Database* db = readDatabase(&dbFile, password, keyfileName);
if (dbFile.error() != QFile::NoError) {
raiseError(dbFile.errorString());
return 0;
}
return db.take();
return db;
}
bool KeePass1Reader::hasError()