Skip to content

Commit

Permalink
Allow hiding expired entries from Auto-Type
Browse files Browse the repository at this point in the history
* Add setting to hide expired entries from Auto-Type
* Expired entries will not be shown in selection dialogs or be auto-picked for use
* Fixes #1855
  • Loading branch information
Colfenor authored and droidmonkey committed Aug 29, 2020
1 parent 5c2a1a4 commit 8ca6ab1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,14 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
}

QList<AutoTypeMatch> matchList;
bool hideExpired = config()->get(Config::AutoTypeHideExpiredEntry).toBool();

for (const auto& db : dbList) {
const QList<Entry*> dbEntries = db->rootGroup()->entriesRecursive();
for (Entry* entry : dbEntries) {
if (hideExpired && entry->isExpired()) {
continue;
}
const QSet<QString> sequences = autoTypeSequences(entry, m_windowTitleForGlobal).toSet();
for (const QString& sequence : sequences) {
if (!sequence.isEmpty()) {
Expand Down
1 change: 1 addition & 0 deletions src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::AutoTypeEntryURLMatch,{QS("AutoTypeEntryURLMatch"), Roaming, true}},
{Config::AutoTypeDelay,{QS("AutoTypeDelay"), Roaming, 25}},
{Config::AutoTypeStartDelay,{QS("AutoTypeStartDelay"), Roaming, 500}},
{Config::AutoTypeHideExpiredEntry,{QS("AutoTypeHideExpiredEntry"), Roaming, false}},
{Config::GlobalAutoTypeKey,{QS("GlobalAutoTypeKey"), Roaming, 0}},
{Config::GlobalAutoTypeModifiers,{QS("GlobalAutoTypeModifiers"), Roaming, 0}},
{Config::FaviconDownloadTimeout,{QS("FaviconDownloadTimeout"), Roaming, 10}},
Expand Down
1 change: 1 addition & 0 deletions src/core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Config : public QObject
AutoTypeEntryURLMatch,
AutoTypeDelay,
AutoTypeStartDelay,
AutoTypeHideExpiredEntry,
GlobalAutoTypeKey,
GlobalAutoTypeModifiers,
FaviconDownloadTimeout,
Expand Down
2 changes: 2 additions & 0 deletions src/gui/ApplicationSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ void ApplicationSettingsWidget::loadSettings()
config()->get(Config::UseGroupIconOnEntryCreation).toBool());
m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryTitleMatch).toBool());
m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryURLMatch).toBool());
m_generalUi->autoTypeHideExpiredEntryCheckBox->setChecked(config()->get(Config::AutoTypeHideExpiredEntry).toBool());
m_generalUi->faviconTimeoutSpinBox->setValue(config()->get(Config::FaviconDownloadTimeout).toInt());

m_generalUi->languageComboBox->clear();
Expand Down Expand Up @@ -324,6 +325,7 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::UseGroupIconOnEntryCreation, m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked());
config()->set(Config::AutoTypeEntryTitleMatch, m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
config()->set(Config::AutoTypeEntryURLMatch, m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked());
config()->set(Config::AutoTypeHideExpiredEntry, m_generalUi->autoTypeHideExpiredEntryCheckBox->isChecked());
config()->set(Config::FaviconDownloadTimeout, m_generalUi->faviconTimeoutSpinBox->value());

auto language = m_generalUi->languageComboBox->currentData().toString();
Expand Down
7 changes: 7 additions & 0 deletions src/gui/ApplicationSettingsWidgetGeneral.ui
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoTypeHideExpiredEntryCheckBox">
<property name="text">
<string>Hide expired entries from Auto-Type</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
Expand Down

0 comments on commit 8ca6ab1

Please sign in to comment.