diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 8a455e27a..5d4304552 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -91,6 +91,7 @@ void Config::init(const QString& fileName) m_defaults.insert("OpenPreviousDatabasesOnStartup", true); m_defaults.insert("ModifiedOnExpandedStateChanges", true); m_defaults.insert("AutoSaveAfterEveryChange", false); + m_defaults.insert("AutoReloadOnChange", true); m_defaults.insert("AutoSaveOnExit", false); m_defaults.insert("ShowToolbar", true); m_defaults.insert("MinimizeOnCopy", false); diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index f22f33885..601dd5b87 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -621,7 +621,8 @@ void DatabaseWidget::openDatabase(bool accepted) m_databaseOpenWidget = Q_NULLPTR; delete m_keepass1OpenWidget; m_keepass1OpenWidget = Q_NULLPTR; - m_file_watcher.watchFile( m_filename ); + if (config()->get("AutoReloadOnChange").toBool() ) + m_file_watcher.watchFile( m_filename ); } else { m_file_watcher.stopWatching(); @@ -878,6 +879,9 @@ void DatabaseWidget::databaseModifedExternally() if ( database() == Q_NULLPTR ) return; + if ( ! config()->get("AutoReloadOnChange").toBool() ) + return; + KeePass2Reader reader; QFile file(m_filename); if (!file.open(QIODevice::ReadOnly)) { diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp index 374e52d97..d45696d1a 100644 --- a/src/gui/SettingsWidget.cpp +++ b/src/gui/SettingsWidget.cpp @@ -66,6 +66,7 @@ void SettingsWidget::loadSettings() m_generalUi->modifiedExpandedChangedCheckBox->setChecked(config()->get("ModifiedOnExpandedStateChanges").toBool()); m_generalUi->autoSaveAfterEveryChangeCheckBox->setChecked(config()->get("AutoSaveAfterEveryChange").toBool()); m_generalUi->autoSaveOnExitCheckBox->setChecked(config()->get("AutoSaveOnExit").toBool()); + m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get("AutoReloadOnChange").toBool()); m_generalUi->minimizeOnCopyCheckBox->setChecked(config()->get("MinimizeOnCopy").toBool()); m_generalUi->useGroupIconOnEntryCreationCheckBox->setChecked(config()->get("UseGroupIconOnEntryCreation").toBool()); m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get("AutoTypeEntryTitleMatch").toBool()); @@ -110,6 +111,7 @@ void SettingsWidget::saveSettings() config()->set("AutoSaveAfterEveryChange", m_generalUi->autoSaveAfterEveryChangeCheckBox->isChecked()); config()->set("AutoSaveOnExit", m_generalUi->autoSaveOnExitCheckBox->isChecked()); + config()->set("AutoReloadOnChange", m_generalUi->autoReloadOnChangeCheckBox->isChecked()); config()->set("MinimizeOnCopy", m_generalUi->minimizeOnCopyCheckBox->isChecked()); config()->set("UseGroupIconOnEntryCreation", m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked()); diff --git a/src/gui/SettingsWidgetGeneral.ui b/src/gui/SettingsWidgetGeneral.ui index f3dc079e2..865ad6dc3 100644 --- a/src/gui/SettingsWidgetGeneral.ui +++ b/src/gui/SettingsWidgetGeneral.ui @@ -6,8 +6,8 @@ 0 0 - 456 - 288 + 541 + 311 @@ -55,47 +55,54 @@ - + Minimize when copying to clipboard - + Use group icon on entry creation - + Global Auto-Type shortcut - + - + Use entry title to match windows for global auto-type - + Language - + + + + + Automatically reload when the database is expernally modified + + +