mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-03 01:50:10 -05:00
Use search for showing expired entries on unlock
* Fix #8036 - use search interface to display expiring entries on first unlock.
This commit is contained in:
parent
dfee59742f
commit
e5bd5f39fb
@ -1128,13 +1128,13 @@ void DatabaseWidget::loadDatabase(bool accepted)
|
|||||||
// Only show expired entries if first unlock and option is enabled
|
// Only show expired entries if first unlock and option is enabled
|
||||||
if (m_groupBeforeLock.isNull() && config()->get(Config::GUI_ShowExpiredEntriesOnDatabaseUnlock).toBool()) {
|
if (m_groupBeforeLock.isNull() && config()->get(Config::GUI_ShowExpiredEntriesOnDatabaseUnlock).toBool()) {
|
||||||
int expirationOffset = config()->get(Config::GUI_ShowExpiredEntriesOnDatabaseUnlockOffsetDays).toInt();
|
int expirationOffset = config()->get(Config::GUI_ShowExpiredEntriesOnDatabaseUnlockOffsetDays).toInt();
|
||||||
|
if (expirationOffset <= 0) {
|
||||||
|
m_nextSearchLabelText = tr("Expired entries");
|
||||||
|
} else {
|
||||||
|
m_nextSearchLabelText =
|
||||||
|
tr("Entries expiring within %1 day(s)", "", expirationOffset).arg(expirationOffset);
|
||||||
|
}
|
||||||
requestSearch(QString("is:expired-%1").arg(expirationOffset));
|
requestSearch(QString("is:expired-%1").arg(expirationOffset));
|
||||||
QTimer::singleShot(150, this, [=] {
|
|
||||||
m_searchingLabel->setText(
|
|
||||||
expirationOffset == 0
|
|
||||||
? tr("Expired entries")
|
|
||||||
: tr("Entries expiring within %1 day(s)", "", expirationOffset).arg(expirationOffset));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_groupBeforeLock = QUuid();
|
m_groupBeforeLock = QUuid();
|
||||||
@ -1426,7 +1426,10 @@ void DatabaseWidget::search(const QString& searchtext)
|
|||||||
m_lastSearchText = searchtext;
|
m_lastSearchText = searchtext;
|
||||||
|
|
||||||
// Display a label detailing our search results
|
// Display a label detailing our search results
|
||||||
if (!searchResult.isEmpty()) {
|
if (!m_nextSearchLabelText.isEmpty()) {
|
||||||
|
m_searchingLabel->setText(m_nextSearchLabelText);
|
||||||
|
m_nextSearchLabelText.clear();
|
||||||
|
} else if (!searchResult.isEmpty()) {
|
||||||
m_searchingLabel->setText(tr("Search Results (%1)").arg(searchResult.size()));
|
m_searchingLabel->setText(tr("Search Results (%1)").arg(searchResult.size()));
|
||||||
} else {
|
} else {
|
||||||
m_searchingLabel->setText(tr("No Results"));
|
m_searchingLabel->setText(tr("No Results"));
|
||||||
@ -1545,6 +1548,7 @@ void DatabaseWidget::endSearch()
|
|||||||
m_searchingLabel->setText(tr("Searching…"));
|
m_searchingLabel->setText(tr("Searching…"));
|
||||||
|
|
||||||
m_lastSearchText.clear();
|
m_lastSearchText.clear();
|
||||||
|
m_nextSearchLabelText.clear();
|
||||||
|
|
||||||
// Tell the search widget to clear
|
// Tell the search widget to clear
|
||||||
emit clearSearch();
|
emit clearSearch();
|
||||||
|
@ -302,6 +302,7 @@ private:
|
|||||||
// Search state
|
// Search state
|
||||||
QScopedPointer<EntrySearcher> m_entrySearcher;
|
QScopedPointer<EntrySearcher> m_entrySearcher;
|
||||||
QString m_lastSearchText;
|
QString m_lastSearchText;
|
||||||
|
QString m_nextSearchLabelText;
|
||||||
bool m_searchLimitGroup;
|
bool m_searchLimitGroup;
|
||||||
|
|
||||||
// Autoreload
|
// Autoreload
|
||||||
|
@ -111,6 +111,8 @@ void TestGui::init()
|
|||||||
config()->set(Config::Security_QuickUnlock, false);
|
config()->set(Config::Security_QuickUnlock, false);
|
||||||
// Disable atomic saves to prevent transient errors on some platforms
|
// Disable atomic saves to prevent transient errors on some platforms
|
||||||
config()->set(Config::UseAtomicSaves, false);
|
config()->set(Config::UseAtomicSaves, false);
|
||||||
|
// Disable showing expired entries on unlock
|
||||||
|
config()->set(Config::GUI_ShowExpiredEntriesOnDatabaseUnlock, false);
|
||||||
|
|
||||||
// Copy the test database file to the temporary file
|
// Copy the test database file to the temporary file
|
||||||
auto origFilePath = QDir(KEEPASSX_TEST_DATA_DIR).absoluteFilePath("NewDatabase.kdbx");
|
auto origFilePath = QDir(KEEPASSX_TEST_DATA_DIR).absoluteFilePath("NewDatabase.kdbx");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user