New setting: enablin/disabling the automatic reload on changes

This commit is contained in:
Sebastien Fricker 2014-06-09 10:51:24 +02:00
parent 95fdefdcc7
commit 06e08557ac
4 changed files with 24 additions and 10 deletions

View File

@ -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);

View File

@ -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)) {

View File

@ -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());

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>456</width>
<height>288</height>
<width>541</width>
<height>311</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -55,47 +55,54 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="minimizeOnCopyCheckBox">
<property name="text">
<string>Minimize when copying to clipboard</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="useGroupIconOnEntryCreationCheckBox">
<property name="text">
<string>Use group icon on entry creation</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="autoTypeShortcutLabel">
<property name="text">
<string>Global Auto-Type shortcut</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="ShortcutWidget" name="autoTypeShortcutWidget"/>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QCheckBox" name="autoTypeEntryTitleMatchCheckBox">
<property name="text">
<string>Use entry title to match windows for global auto-type</string>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="languageLabel">
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="QComboBox" name="languageComboBox"/>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="autoReloadOnChangeCheckBox">
<property name="text">
<string>Automatically reload when the database is expernally modified</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>