Display an error message when opening the database fails.

Closes #462
This commit is contained in:
Felix Geyer 2016-05-20 16:49:32 +02:00
parent 57c1a0f4b6
commit 48eca3e11f
4 changed files with 8 additions and 6 deletions

View File

@ -99,7 +99,8 @@ void DatabaseOpenWidget::openDatabase()
QFile file(m_filename);
if (!file.open(QIODevice::ReadOnly)) {
// TODO: error message
MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
.append(file.errorString()));
return;
}
if (m_db) {

View File

@ -60,7 +60,8 @@ void DatabaseRepairWidget::openDatabase()
QFile file(m_filename);
if (!file.open(QIODevice::ReadOnly)) {
// TODO: error message
MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
.append(file.errorString()));
Q_EMIT editFinished(false);
return;
}

View File

@ -131,11 +131,10 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
// test if we can read/write or read the file
QFile file(fileName);
// TODO: error handling
if (!file.open(QIODevice::ReadWrite)) {
if (!file.open(QIODevice::ReadOnly)) {
// can't open
// TODO: error message
MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
.append(file.errorString()));
return;
}
else {

View File

@ -49,7 +49,8 @@ void KeePass1OpenWidget::openDatabase()
QFile file(m_filename);
if (!file.open(QIODevice::ReadOnly)) {
// TODO: error message
MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
.append(file.errorString()));
return;
}
if (m_db) {