Fix confusing behavior when leaving window title empty in Auto-Type

- Modified Entry::autoTypeSequences() to treat empty window titles as catch-all associations
- Empty window title associations now match any window instead of being ignored
- Added comprehensive test case to verify the new behavior
- Fixes issue where empty window title associations only appeared during search

Co-authored-by: droidmonkey <[email protected]>
This commit is contained in:
copilot-swe-agent[bot]anddroidmonkey authored and Jonathan White committed 2025-06-19 10:24:06 -04:00
1 parent aedd4ae08e
commit 2a931231c1
3 files changed
+38 -1

No files matched your search

+33
View File
@@ -125,6 +125,14 @@ void TestAutoType::init()
m_entry5->setPassword("example5");
m_entry5->setTitle("some title");
m_entry5->setUrl("http://example.org");
// Entry with empty window title (should act as default/catch-all)
m_entry6 = new Entry();
m_entry6->setGroup(m_group);
m_entry6->setPassword("empty_window_test");
association.window = ""; // Empty window title
association.sequence = "empty_window_sequence";
m_entry6->autoTypeAssociations()->add(association);
}
void TestAutoType::cleanup()
@@ -280,6 +288,31 @@ void TestAutoType::testGlobalAutoTypeRegExp()
m_test->clearActions();
}
void TestAutoType::testGlobalAutoTypeEmptyWindow()
{
// Test that empty window title associations work as default/catch-all
// This should match any window since the association has an empty window title
m_test->setActiveWindowTitle("any random window title");
emit osUtils->globalShortcutTriggered("autotype");
m_autoType->performGlobalAutoType(m_dbList);
QCOMPARE(m_test->actionChars(), QString("empty_window_sequence"));
m_test->clearActions();
// Test with a different window title - should still match
m_test->setActiveWindowTitle("completely different title");
emit osUtils->globalShortcutTriggered("autotype");
m_autoType->performGlobalAutoType(m_dbList);
QCOMPARE(m_test->actionChars(), QString("empty_window_sequence"));
m_test->clearActions();
// Test with empty window title - should still match
m_test->setActiveWindowTitle("");
emit osUtils->globalShortcutTriggered("autotype");
m_autoType->performGlobalAutoType(m_dbList);
QCOMPARE(m_test->actionChars(), QString("empty_window_sequence"));
m_test->clearActions();
}
void TestAutoType::testAutoTypeResults()
{
QScopedPointer<Entry> entry(new Entry());