1 | // -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*- |
2 | /* |
3 | This file is part of the KDE Wallet Daemon |
4 | |
5 | Copyright (c) 2008 Michael Leupold <lemma@confuego.org> |
6 | |
7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. |
11 | |
12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. |
21 | */ |
22 | |
23 | #ifndef _KWALLETSESSIONSTORE_H_ |
24 | #define _KWALLETSESSIONSTORE_H_ |
25 | |
26 | #include <QPair> |
27 | #include <QString> |
28 | #include <QList> |
29 | #include <QHash> |
30 | #include <QStringList> |
31 | |
32 | typedef QPair<QString,int> KWalletAppHandlePair; |
33 | |
34 | class KWalletSessionStore |
35 | { |
36 | public: |
37 | KWalletSessionStore(); |
38 | ~KWalletSessionStore(); |
39 | |
40 | // add a new session |
41 | void addSession(const QString &appid, const QString &service, int handle); |
42 | // check if the application has a session using that handle |
43 | bool hasSession(const QString &appid, int handle = -1) const; |
44 | // find all sessions a service has |
45 | QList<KWalletAppHandlePair> findSessions(const QString &service) const; |
46 | // remove a specific session |
47 | bool removeSession(const QString &appid, const QString &service, int handle); |
48 | // remove all sessions an application has to a specific handle |
49 | int removeAllSessions(const QString &appid, int handle); |
50 | // remove all sessions related to a handle |
51 | int removeAllSessions(int handle); |
52 | // get all applications using a handle |
53 | QStringList getApplications(int handle) const; |
54 | |
55 | private: |
56 | class Session; |
57 | QHash< QString,QList<Session*> > m_sessions; // appid => session |
58 | }; |
59 | |
60 | #endif // _KWALLETSESSIONSTORE_H_ |
61 | |