Introduce security option to enable copy on doubleclick (#6433)

* Fix #1575 - option is disabled by default
This commit is contained in:
Xavier Valls 2021-04-24 17:35:01 +02:00 committed by GitHub
parent 5c709f0da3
commit 7b7f52c8af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 2 deletions

View file

@ -286,6 +286,8 @@ void ApplicationSettingsWidget::loadSettings()
m_secUi->hideNotesCheckBox->setChecked(config()->get(Config::Security_HideNotes).toBool());
m_secUi->NoConfirmMoveEntryToRecycleBinCheckBox->setChecked(
config()->get(Config::Security_NoConfirmMoveEntryToRecycleBin).toBool());
m_secUi->EnableCopyOnDoubleClickCheckBox->setChecked(
config()->get(Config::Security_EnableCopyOnDoubleClick).toBool());
m_secUi->touchIDResetCheckBox->setChecked(config()->get(Config::Security_ResetTouchId).toBool());
m_secUi->touchIDResetSpinBox->setValue(config()->get(Config::Security_ResetTouchIdTimeout).toInt());
@ -387,6 +389,7 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::Security_HideNotes, m_secUi->hideNotesCheckBox->isChecked());
config()->set(Config::Security_NoConfirmMoveEntryToRecycleBin,
m_secUi->NoConfirmMoveEntryToRecycleBinCheckBox->isChecked());
config()->set(Config::Security_EnableCopyOnDoubleClick, m_secUi->EnableCopyOnDoubleClickCheckBox->isChecked());
config()->set(Config::Security_ResetTouchId, m_secUi->touchIDResetCheckBox->isChecked());
config()->set(Config::Security_ResetTouchIdTimeout, m_secUi->touchIDResetSpinBox->value());

View file

@ -264,6 +264,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="EnableCopyOnDoubleClickCheckBox">
<property name="text">
<string>Enable double click to copy the username/password entry columns</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View file

@ -1195,10 +1195,18 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod
// Implement 'copy-on-doubleclick' functionality for certain columns
switch (column) {
case EntryModel::Username:
setClipboardTextAndMinimize(entry->resolveMultiplePlaceholders(entry->username()));
if (config()->get(Config::Security_EnableCopyOnDoubleClick).toBool()) {
setClipboardTextAndMinimize(entry->resolveMultiplePlaceholders(entry->username()));
} else {
switchToEntryEdit(entry);
}
break;
case EntryModel::Password:
setClipboardTextAndMinimize(entry->resolveMultiplePlaceholders(entry->password()));
if (config()->get(Config::Security_EnableCopyOnDoubleClick).toBool()) {
setClipboardTextAndMinimize(entry->resolveMultiplePlaceholders(entry->password()));
} else {
switchToEntryEdit(entry);
}
break;
case EntryModel::Url:
if (!entry->url().isEmpty()) {