mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01: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:
committed by
Jonathan White
parent
0701d1d6cd
commit
bfbc0e5ec6
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user