added autoopen functionality (#477)

This commit is contained in:
Bernhard Rieder 2017-10-09 13:26:24 +02:00
parent 549fef8eb5
commit 6d569a86f9
2 changed files with 52 additions and 4 deletions

View file

@ -897,8 +897,13 @@ void DatabaseWidget::switchToDatabaseSettings()
void DatabaseWidget::switchToOpenDatabase(const QString& fileName)
{
updateFilename(fileName);
m_databaseOpenWidget->load(fileName);
setCurrentWidget(m_databaseOpenWidget);
if (m_databaseOpenWidget) {
m_databaseOpenWidget->load(fileName);
setCurrentWidget(m_databaseOpenWidget);
} else if (m_unlockDatabaseWidget) {
m_unlockDatabaseWidget->load(fileName);
setCurrentWidget(m_unlockDatabaseWidget);
}
}
void DatabaseWidget::switchToOpenDatabase(const QString& fileName, const QString& password,
@ -906,7 +911,11 @@ void DatabaseWidget::switchToOpenDatabase(const QString& fileName, const QString
{
updateFilename(fileName);
switchToOpenDatabase(fileName);
m_databaseOpenWidget->enterKey(password, keyFile);
if (m_databaseOpenWidget) {
m_databaseOpenWidget->enterKey(password, keyFile);
} else if (m_unlockDatabaseWidget) {
m_unlockDatabaseWidget->enterKey(password, keyFile);
}
}
void DatabaseWidget::switchToImportCsv(const QString& fileName)