8#include "kwalletsessionstore.h"
10class KWalletSessionStore::Session
17KWalletSessionStore::KWalletSessionStore()
21KWalletSessionStore::~KWalletSessionStore()
28void KWalletSessionStore::addSession(
const QString &appid,
const QString &service,
int handle)
31 sess->m_service = service;
32 sess->m_handle = handle;
33 m_sessions[appid].append(sess);
36bool KWalletSessionStore::hasSession(
const QString &appid,
int handle)
const
40 }
else if (handle == -1) {
46 for (it = m_sessions[appid].constBegin(); it !=
end; ++it) {
48 if ((*it)->m_handle == handle) {
60 for (
const QString &appid : sessionKeys) {
61 const auto lst = m_sessions[appid];
62 for (
const Session *sess : lst) {
64 if (sess->m_service == service) {
65 rc.
append(qMakePair(appid, sess->m_handle));
72bool KWalletSessionStore::removeSession(
const QString &appid,
const QString &service,
int handle)
80 for (it = m_sessions[appid].constBegin(); it !=
end; ++it) {
82 if ((*it)->m_service == service && (*it)->m_handle == handle) {
84 m_sessions[appid].removeAll(sess);
86 if (m_sessions[appid].isEmpty()) {
96int KWalletSessionStore::removeAllSessions(
const QString &appid,
int handle)
104 for (it = m_sessions[appid].
begin(); it !=
end; ++it) {
106 if ((*it)->m_handle == handle) {
112 int removed = m_sessions[appid].removeAll(
nullptr);
113 if (m_sessions[appid].isEmpty()) {
120int KWalletSessionStore::removeAllSessions(
int handle)
125 for (
const QString &appid : sessionKeys) {
128 for (it = m_sessions[appid].
begin(); it !=
end; ++it) {
130 if ((*it)->m_handle == handle) {
137 m_sessions[appid].removeAll(
nullptr);
138 if (m_sessions[appid].isEmpty()) {
144 for (
const QString &appid : std::as_const(appremove)) {
151QStringList KWalletSessionStore::getApplications(
int handle)
const
154 const auto lst = m_sessions.
keys();
155 for (
const QString &appid : lst) {
156 if (hasSession(appid, handle)) {
const QList< QKeySequence > & begin()
const QList< QKeySequence > & end()
const_iterator constEnd() const const
bool contains(const Key &key) const const
QList< Key > keys() const const
bool remove(const Key &key)
void append(QList< T > &&value)