mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kutils: lock from all KPasswdStore methods
also the implementation internally opens the store if it is not open already Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
67d44cd10f
commit
fa41515d34
1 changed files with 13 additions and 6 deletions
|
@ -120,31 +120,38 @@ bool KPasswdStore::openStore(const qlonglong windowid)
|
||||||
void KPasswdStore::setCacheOnly(const bool cacheonly)
|
void KPasswdStore::setCacheOnly(const bool cacheonly)
|
||||||
{
|
{
|
||||||
d->ensureInterface();
|
d->ensureInterface();
|
||||||
|
KLockFile klockfile(getLockName(d->cookie, d->storeid));
|
||||||
|
klockfile.lock();
|
||||||
d->interface->call("setCacheOnly", d->cookie, d->storeid, cacheonly);
|
d->interface->call("setCacheOnly", d->cookie, d->storeid, cacheonly);
|
||||||
|
klockfile.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KPasswdStore::cacheOnly() const
|
bool KPasswdStore::cacheOnly() const
|
||||||
{
|
{
|
||||||
d->ensureInterface();
|
d->ensureInterface();
|
||||||
|
KLockFile klockfile(getLockName(d->cookie, d->storeid));
|
||||||
|
klockfile.lock();
|
||||||
QDBusReply<bool> result = d->interface->call("cacheOnly", d->cookie, d->storeid);
|
QDBusReply<bool> result = d->interface->call("cacheOnly", d->cookie, d->storeid);
|
||||||
|
klockfile.unlock();
|
||||||
return result.value();
|
return result.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KPasswdStore::getPasswd(const QByteArray &key, const qlonglong windowid)
|
QString KPasswdStore::getPasswd(const QByteArray &key, const qlonglong windowid)
|
||||||
{
|
{
|
||||||
if (!openStore(windowid) && !cacheOnly()) {
|
d->ensureInterface();
|
||||||
return QString();
|
KLockFile klockfile(getLockName(d->cookie, d->storeid));
|
||||||
}
|
klockfile.lock();
|
||||||
QDBusReply<QString> result = d->interface->call("getPasswd", d->cookie, d->storeid, key, windowid);
|
QDBusReply<QString> result = d->interface->call("getPasswd", d->cookie, d->storeid, key, windowid);
|
||||||
return result.value();
|
return result.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KPasswdStore::storePasswd(const QByteArray &key, const QString &passwd, const qlonglong windowid)
|
bool KPasswdStore::storePasswd(const QByteArray &key, const QString &passwd, const qlonglong windowid)
|
||||||
{
|
{
|
||||||
if (!openStore(windowid) && !cacheOnly()) {
|
d->ensureInterface();
|
||||||
return false;
|
KLockFile klockfile(getLockName(d->cookie, d->storeid));
|
||||||
}
|
klockfile.lock();
|
||||||
QDBusReply<bool> result = d->interface->call("storePasswd", d->cookie, d->storeid, key, passwd, windowid);
|
QDBusReply<bool> result = d->interface->call("storePasswd", d->cookie, d->storeid, key, passwd, windowid);
|
||||||
|
klockfile.unlock();
|
||||||
return result.value();
|
return result.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue