kutils: attempt to re-open the password store after the timeout

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-05 07:34:44 +03:00
parent 3716b1ffe5
commit b3c1452d4e

View file

@ -98,7 +98,7 @@ bool KPasswdStoreImpl::isOpen() const
bool KPasswdStoreImpl::openStore(const qlonglong windowid) bool KPasswdStoreImpl::openStore(const qlonglong windowid)
{ {
if (m_cacheonly) { if (m_cacheonly && m_passwdtimer.elapsed() < m_timeout) {
return false; return false;
} }
@ -111,9 +111,14 @@ bool KPasswdStoreImpl::openStore(const qlonglong windowid)
} }
} }
if (!hasPasswd()) { if (!hasPasswd()) {
KMessageBox::error(widgetForWindowID(windowid), i18n("The storage could not be open, no passwords will be permanently stored")); KMessageBox::error(
widgetForWindowID(windowid),
i18n("The storage could not be open, passwords will not be permanently stored until the store is open")
);
setCacheOnly(true); setCacheOnly(true);
return false; return false;
} else {
setCacheOnly(false);
} }
return true; return true;
} }
@ -188,7 +193,7 @@ bool KPasswdStoreImpl::ensurePasswd(const qlonglong windowid, const bool showerr
if (!m_passwd.isEmpty() && m_passwdtimer.elapsed() >= m_timeout) { if (!m_passwd.isEmpty() && m_passwdtimer.elapsed() >= m_timeout) {
m_passwd.clear(); m_passwd.clear();
} }
m_passwdtimer.restart(); m_passwdtimer.start();
if (m_passwd.isEmpty()) { if (m_passwd.isEmpty()) {
QByteArray kpasswddialogpass; QByteArray kpasswddialogpass;