mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Auto-Type: Allow retyping with automatic relock
If relock after performing Auto-Type is enabled it will wait until specified timeout before doing so. Retype time is now configurable and is decreased from the old hardcoded 30 seconds down to 15 seconds to keep the default a bit more secure while still allowing the user to set it higher for their liking. To restore old behavior the user can set retype time to 0 which will make the database relock instantly. Auto-Type relock setting relocated to Auto-Type tab to group it better with the other Auto-Type settings.
This commit is contained in:
parent
0701d1d6cd
commit
bfbc0e5ec6
@ -476,6 +476,18 @@
|
||||
<source>will expire within </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> s</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Re-lock previously locked database after performing Auto-Type</source>
|
||||
<translation type="unfinished">Re-lock previously locked database after performing Auto-Type</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remember last typed entry for:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ApplicationSettingsWidgetSecurity</name>
|
||||
@ -520,10 +532,6 @@
|
||||
<source>Lock databases after minimizing the window</source>
|
||||
<translation>Lock databases after minimizing the window</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Re-lock previously locked database after performing Auto-Type</source>
|
||||
<translation>Re-lock previously locked database after performing Auto-Type</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hide passwords in the entry preview panel</source>
|
||||
<translation>Hide passwords in the entry preview panel</translation>
|
||||
|
@ -111,7 +111,6 @@ namespace
|
||||
{"f14", Qt::Key_F14},
|
||||
{"f15", Qt::Key_F15},
|
||||
{"f16", Qt::Key_F16}};
|
||||
static constexpr int rememberLastEntrySecs = 30;
|
||||
} // namespace
|
||||
|
||||
AutoType* AutoType::m_instance = nullptr;
|
||||
@ -124,8 +123,15 @@ AutoType::AutoType(QObject* parent, bool test)
|
||||
, m_windowState(WindowState::Normal)
|
||||
, m_windowForGlobal(0)
|
||||
, m_lastMatch(nullptr, QString())
|
||||
, m_lastMatchTime(0)
|
||||
, m_lastMatchRetypeTimer(nullptr)
|
||||
{
|
||||
// configure timer to reset last match
|
||||
m_lastMatchRetypeTimer.setSingleShot(true);
|
||||
connect(&m_lastMatchRetypeTimer, &QTimer::timeout, this, [this] {
|
||||
m_lastMatch = {nullptr, QString()};
|
||||
emit autotypeRetypeTimeout();
|
||||
});
|
||||
|
||||
// prevent crash when the plugin has unresolved symbols
|
||||
m_pluginLoader->setLoadHints(QLibrary::ResolveAllSymbolsHint);
|
||||
|
||||
@ -426,11 +432,6 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate last match if it's old enough
|
||||
if (m_lastMatch.first && (Clock::currentSecondsSinceEpoch() - m_lastMatchTime) > rememberLastEntrySecs) {
|
||||
m_lastMatch = {nullptr, QString()};
|
||||
}
|
||||
|
||||
QList<AutoTypeMatch> matchList;
|
||||
bool hideExpired = config()->get(Config::AutoTypeHideExpiredEntry).toBool();
|
||||
|
||||
@ -468,7 +469,7 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
|
||||
connect(getMainWindow(), &MainWindow::databaseLocked, selectDialog, &AutoTypeSelectDialog::reject);
|
||||
connect(selectDialog, &AutoTypeSelectDialog::matchActivated, this, [this](const AutoTypeMatch& match) {
|
||||
m_lastMatch = match;
|
||||
m_lastMatchTime = Clock::currentSecondsSinceEpoch();
|
||||
m_lastMatchRetypeTimer.start(config()->get(Config::GlobalAutoTypeRetypeTime).toInt() * 1000);
|
||||
executeAutoTypeActions(match.first, nullptr, match.second, m_windowForGlobal);
|
||||
resetAutoTypeState();
|
||||
});
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
#include "AutoTypeMatch.h"
|
||||
@ -61,6 +62,7 @@ signals:
|
||||
void globalAutoTypeTriggered(const QString& search);
|
||||
void autotypePerformed();
|
||||
void autotypeRejected();
|
||||
void autotypeRetypeTimeout();
|
||||
|
||||
private slots:
|
||||
void startGlobalAutoType(const QString& search);
|
||||
@ -98,7 +100,7 @@ private:
|
||||
WindowState m_windowState;
|
||||
WId m_windowForGlobal;
|
||||
AutoTypeMatch m_lastMatch;
|
||||
qint64 m_lastMatchTime;
|
||||
QTimer m_lastMatchRetypeTimer;
|
||||
|
||||
Q_DISABLE_COPY(AutoType)
|
||||
};
|
||||
|
@ -78,6 +78,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||
{Config::AutoTypeHideExpiredEntry,{QS("AutoTypeHideExpiredEntry"), Roaming, false}},
|
||||
{Config::GlobalAutoTypeKey,{QS("GlobalAutoTypeKey"), Roaming, 0}},
|
||||
{Config::GlobalAutoTypeModifiers,{QS("GlobalAutoTypeModifiers"), Roaming, 0}},
|
||||
{Config::GlobalAutoTypeRetypeTime,{QS("GlobalAutoTypeRetypeTime"), Roaming, 15}},
|
||||
{Config::FaviconDownloadTimeout,{QS("FaviconDownloadTimeout"), Roaming, 10}},
|
||||
{Config::UpdateCheckMessageShown,{QS("UpdateCheckMessageShown"), Roaming, false}},
|
||||
{Config::UseTouchID,{QS("UseTouchID"), Roaming, false}},
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
AutoTypeHideExpiredEntry,
|
||||
GlobalAutoTypeKey,
|
||||
GlobalAutoTypeModifiers,
|
||||
GlobalAutoTypeRetypeTime,
|
||||
FaviconDownloadTimeout,
|
||||
UpdateCheckMessageShown,
|
||||
UseTouchID,
|
||||
|
@ -260,6 +260,7 @@ void ApplicationSettingsWidget::loadSettings()
|
||||
showExpiredEntriesOnDatabaseUnlockToggled(m_generalUi->showExpiredEntriesOnDatabaseUnlockCheckBox->isChecked());
|
||||
|
||||
m_generalUi->autoTypeAskCheckBox->setChecked(config()->get(Config::Security_AutoTypeAsk).toBool());
|
||||
m_generalUi->autoTypeRelockDatabaseCheckBox->setChecked(config()->get(Config::Security_RelockAutoType).toBool());
|
||||
|
||||
if (autoType()->isAvailable()) {
|
||||
m_globalAutoTypeKey = static_cast<Qt::Key>(config()->get(Config::GlobalAutoTypeKey).toInt());
|
||||
@ -268,6 +269,7 @@ void ApplicationSettingsWidget::loadSettings()
|
||||
if (m_globalAutoTypeKey > 0 && m_globalAutoTypeModifiers > 0) {
|
||||
m_generalUi->autoTypeShortcutWidget->setShortcut(m_globalAutoTypeKey, m_globalAutoTypeModifiers);
|
||||
}
|
||||
m_generalUi->autoTypeRetypeTimeSpinBox->setValue(config()->get(Config::GlobalAutoTypeRetypeTime).toInt());
|
||||
m_generalUi->autoTypeShortcutWidget->setAttribute(Qt::WA_MacShowFocusRect, true);
|
||||
m_generalUi->autoTypeDelaySpinBox->setValue(config()->get(Config::AutoTypeDelay).toInt());
|
||||
m_generalUi->autoTypeStartDelaySpinBox->setValue(config()->get(Config::AutoTypeStartDelay).toInt());
|
||||
@ -297,7 +299,6 @@ void ApplicationSettingsWidget::loadSettings()
|
||||
m_secUi->lockDatabaseMinimizeCheckBox->setChecked(config()->get(Config::Security_LockDatabaseMinimize).toBool());
|
||||
m_secUi->lockDatabaseOnScreenLockCheckBox->setChecked(
|
||||
config()->get(Config::Security_LockDatabaseScreenLock).toBool());
|
||||
m_secUi->relockDatabaseAutoTypeCheckBox->setChecked(config()->get(Config::Security_RelockAutoType).toBool());
|
||||
m_secUi->fallbackToSearch->setChecked(config()->get(Config::Security_IconDownloadFallback).toBool());
|
||||
|
||||
m_secUi->passwordsHiddenCheckBox->setChecked(config()->get(Config::Security_PasswordsHidden).toBool());
|
||||
@ -392,11 +393,13 @@ void ApplicationSettingsWidget::saveSettings()
|
||||
m_generalUi->showExpiredEntriesOnDatabaseUnlockOffsetSpinBox->value());
|
||||
|
||||
config()->set(Config::Security_AutoTypeAsk, m_generalUi->autoTypeAskCheckBox->isChecked());
|
||||
config()->set(Config::Security_RelockAutoType, m_generalUi->autoTypeRelockDatabaseCheckBox->isChecked());
|
||||
|
||||
if (autoType()->isAvailable()) {
|
||||
config()->set(Config::GlobalAutoTypeKey, m_generalUi->autoTypeShortcutWidget->key());
|
||||
config()->set(Config::GlobalAutoTypeModifiers,
|
||||
static_cast<int>(m_generalUi->autoTypeShortcutWidget->modifiers()));
|
||||
config()->set(Config::GlobalAutoTypeRetypeTime, m_generalUi->autoTypeRetypeTimeSpinBox->value());
|
||||
config()->set(Config::AutoTypeDelay, m_generalUi->autoTypeDelaySpinBox->value());
|
||||
config()->set(Config::AutoTypeStartDelay, m_generalUi->autoTypeStartDelaySpinBox->value());
|
||||
}
|
||||
@ -410,7 +413,6 @@ void ApplicationSettingsWidget::saveSettings()
|
||||
config()->set(Config::Security_LockDatabaseIdleSeconds, m_secUi->lockDatabaseIdleSpinBox->value());
|
||||
config()->set(Config::Security_LockDatabaseMinimize, m_secUi->lockDatabaseMinimizeCheckBox->isChecked());
|
||||
config()->set(Config::Security_LockDatabaseScreenLock, m_secUi->lockDatabaseOnScreenLockCheckBox->isChecked());
|
||||
config()->set(Config::Security_RelockAutoType, m_secUi->relockDatabaseAutoTypeCheckBox->isChecked());
|
||||
config()->set(Config::Security_IconDownloadFallback, m_secUi->fallbackToSearch->isChecked());
|
||||
|
||||
config()->set(Config::Security_PasswordsHidden, m_secUi->passwordsHiddenCheckBox->isChecked());
|
||||
|
@ -266,12 +266,15 @@
|
||||
<property name="accessibleName">
|
||||
<string>On database unlock, show entries that </string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>will expire within </string>
|
||||
<property name="specialValueText">
|
||||
<string>are expired</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> days</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>will expire within </string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -281,9 +284,6 @@
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string>are expired</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
@ -1020,6 +1020,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoTypeRelockDatabaseCheckBox">
|
||||
<property name="text">
|
||||
<string>Re-lock previously locked database after performing Auto-Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
@ -1045,57 +1052,32 @@
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="autoTypeDelayLabel">
|
||||
<widget class="QLabel" name="autoTypeStartDelayLabel">
|
||||
<property name="text">
|
||||
<string>Auto-Type typing delay:</string>
|
||||
<string>Auto-Type start delay:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>autoTypeDelaySpinBox</cstring>
|
||||
<cstring>autoTypeStartDelaySpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ShortcutWidget" name="autoTypeShortcutWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="autoTypeShortcutLabel">
|
||||
<property name="text">
|
||||
<string>Global Auto-Type shortcut:</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Global auto-type shortcut</string>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>autoTypeShortcutWidget</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="autoTypeDelaySpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Auto-type character typing delay milliseconds</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string comment="Milliseconds"> ms</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="autoTypeStartDelaySpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -1126,29 +1108,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="autoTypeShortcutLabel">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="autoTypeDelayLabel">
|
||||
<property name="text">
|
||||
<string>Global Auto-Type shortcut:</string>
|
||||
<string>Auto-Type typing delay:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>autoTypeShortcutWidget</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="autoTypeStartDelayLabel">
|
||||
<property name="text">
|
||||
<string>Auto-Type start delay:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>autoTypeStartDelaySpinBox</cstring>
|
||||
<cstring>autoTypeDelaySpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1165,6 +1134,67 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ShortcutWidget" name="autoTypeShortcutWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Global auto-type shortcut</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="autoTypeDelaySpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Auto-type character typing delay milliseconds</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string comment="Milliseconds"> ms</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="autoTypeRetypeLabel">
|
||||
<property name="text">
|
||||
<string>Remember last typed entry for:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="autoTypeRetypeTimeSpinBox">
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>15</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -215,13 +215,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="relockDatabaseAutoTypeCheckBox">
|
||||
<property name="text">
|
||||
<string>Re-lock previously locked database after performing Auto-Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="passwordsRepeatVisibleCheckBox">
|
||||
<property name="text">
|
||||
@ -320,7 +313,6 @@
|
||||
<tabstop>lockDatabaseOnScreenLockCheckBox</tabstop>
|
||||
<tabstop>touchIDResetOnScreenLockCheckBox</tabstop>
|
||||
<tabstop>lockDatabaseMinimizeCheckBox</tabstop>
|
||||
<tabstop>relockDatabaseAutoTypeCheckBox</tabstop>
|
||||
<tabstop>passwordsRepeatVisibleCheckBox</tabstop>
|
||||
<tabstop>passwordsHiddenCheckBox</tabstop>
|
||||
<tabstop>passwordShowDotsCheckBox</tabstop>
|
||||
|
@ -52,7 +52,7 @@ DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
|
||||
connect(this, SIGNAL(activeDatabaseChanged(DatabaseWidget*)),
|
||||
m_dbWidgetStateSync, SLOT(setActive(DatabaseWidget*)));
|
||||
connect(autoType(), SIGNAL(globalAutoTypeTriggered(const QString&)), SLOT(performGlobalAutoType(const QString&)));
|
||||
connect(autoType(), SIGNAL(autotypePerformed()), SLOT(relockPendingDatabase()));
|
||||
connect(autoType(), SIGNAL(autotypeRetypeTimeout()), SLOT(relockPendingDatabase()));
|
||||
connect(autoType(), SIGNAL(autotypeRejected()), SLOT(relockPendingDatabase()));
|
||||
connect(m_databaseOpenDialog.data(), &DatabaseOpenDialog::dialogFinished,
|
||||
this, &DatabaseTabWidget::handleDatabaseUnlockDialogFinished);
|
||||
|
Loading…
Reference in New Issue
Block a user