Auto-Type: Only match non-empty associations

Previously empty associations matched any window but since you can
use a wildcard (*) if you specifically want that this change makes
it possible to define multiple sequences for the global search
if you need to.

Additionally show empty associations in the list as "(empty)" to
better differentiate between rows if no title is set.
This commit is contained in:
Toni Spets 2022-02-07 09:16:17 +02:00 committed by Jonathan White
parent 86ba58da06
commit 5927821896
3 changed files with 8 additions and 1 deletions

View File

@ -656,6 +656,10 @@
<source>Default sequence</source>
<translation>Default sequence</translation>
</message>
<message>
<source>(empty)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AutoTypeMatchModel</name>

View File

@ -328,7 +328,7 @@ QList<QString> Entry::autoTypeSequences(const QString& windowTitle) const
const auto assocList = autoTypeAssociations()->getAll();
for (const auto& assoc : assocList) {
auto window = resolveMultiplePlaceholders(assoc.window);
if (windowMatches(window)) {
if (!assoc.window.isEmpty() && windowMatches(window)) {
if (!assoc.sequence.isEmpty()) {
sequenceList << assoc.sequence;
} else {

View File

@ -92,6 +92,9 @@ QVariant AutoTypeAssociationsModel::data(const QModelIndex& index, int role) con
if (role == Qt::DisplayRole) {
if (index.column() == 0) {
QString window = m_autoTypeAssociations->get(index.row()).window;
if (window.isEmpty()) {
return tr("(empty)");
}
if (m_entry) {
window = m_entry->maskPasswordPlaceholders(window);
window = m_entry->resolveMultiplePlaceholders(window);