mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-13 09:36:42 -04:00
Show Auto-Type select dialog even if window title is empty
* Fixes #11597 Add Tools::asSet
This commit is contained in:
parent
089d0ca2b7
commit
4034c68e67
@ -433,38 +433,33 @@ void AutoType::startGlobalAutoType(const QString& search)
|
|||||||
*/
|
*/
|
||||||
void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbList, const QString& search)
|
void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbList, const QString& search)
|
||||||
{
|
{
|
||||||
if (!m_plugin) {
|
if (!m_plugin || !m_inGlobalAutoTypeDialog.tryLock()) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_inGlobalAutoTypeDialog.tryLock()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_windowTitleForGlobal.isEmpty()) {
|
|
||||||
m_inGlobalAutoTypeDialog.unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<AutoTypeMatch> matchList;
|
QList<AutoTypeMatch> matchList;
|
||||||
bool hideExpired = config()->get(Config::AutoTypeHideExpiredEntry).toBool();
|
// Generate entry/sequence match list if there is a valid window title
|
||||||
|
if (!m_windowTitleForGlobal.isEmpty()) {
|
||||||
|
bool hideExpired = config()->get(Config::AutoTypeHideExpiredEntry).toBool();
|
||||||
|
for (const auto& db : dbList) {
|
||||||
|
const QList<Entry*> dbEntries = db->rootGroup()->entriesRecursive();
|
||||||
|
for (auto entry : dbEntries) {
|
||||||
|
auto group = entry->group();
|
||||||
|
if (!group || !group->resolveAutoTypeEnabled() || !entry->autoTypeEnabled()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& db : dbList) {
|
if (hideExpired && entry->isExpired()) {
|
||||||
const QList<Entry*> dbEntries = db->rootGroup()->entriesRecursive();
|
continue;
|
||||||
for (auto entry : dbEntries) {
|
}
|
||||||
auto group = entry->group();
|
const QSet<QString> sequences = Tools::asSet(entry->autoTypeSequences(m_windowTitleForGlobal));
|
||||||
if (!group || !group->resolveAutoTypeEnabled() || !entry->autoTypeEnabled()) {
|
for (const auto& sequence : sequences) {
|
||||||
continue;
|
matchList << AutoTypeMatch(entry, sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideExpired && entry->isExpired()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto sequences = entry->autoTypeSequences(m_windowTitleForGlobal).toSet();
|
|
||||||
for (const auto& sequence : sequences) {
|
|
||||||
matchList << AutoTypeMatch(entry, sequence);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
qWarning() << "Auto-Type: Window title was empty from the operating system";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the selection dialog if we always ask, have multiple matches, or no matches
|
// Show the selection dialog if we always ask, have multiple matches, or no matches
|
||||||
|
@ -47,6 +47,15 @@ namespace Tools
|
|||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment());
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment());
|
||||||
QString cleanFilename(QString filename);
|
QString cleanFilename(QString filename);
|
||||||
|
|
||||||
|
template <class T> QSet<T> asSet(const QList<T>& a)
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
|
return QSet<T>(a.begin(), a.end());
|
||||||
|
#else
|
||||||
|
return QSet<T>::fromList(a);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escapes all characters in regex such that they do not receive any special treatment when used
|
* Escapes all characters in regex such that they do not receive any special treatment when used
|
||||||
* in a regular expression. Essentially, this function escapes any characters not in a-zA-Z0-9.
|
* in a regular expression. Essentially, this function escapes any characters not in a-zA-Z0-9.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user