1 | /* |
2 | This file is part of the KDE project, module kdesu |
3 | SPDX-FileCopyrightText: 1999, 2000 Geert Jansen <jansen@kde.org> |
4 | |
5 | SPDX-License-Identifier: GPL-2.0-only |
6 | */ |
7 | |
8 | #ifndef KDESUKCOOKIE_H |
9 | #define KDESUKCOOKIE_H |
10 | |
11 | #include <QByteArray> |
12 | |
13 | #include <config-kdesu.h> |
14 | |
15 | #include <memory> |
16 | |
17 | namespace KDESu |
18 | { |
19 | namespace KDESuPrivate |
20 | { |
21 | /** |
22 | * Utility class to access the authentication tokens needed to run a KDE |
23 | * program (X11 cookies on X11, for instance). |
24 | * @internal |
25 | */ |
26 | |
27 | class KCookie |
28 | { |
29 | public: |
30 | KCookie(); |
31 | ~KCookie(); |
32 | |
33 | KCookie(const KCookie &) = delete; |
34 | KCookie &operator=(const KCookie &) = delete; |
35 | |
36 | /** |
37 | * Returns the X11 display. |
38 | */ |
39 | QByteArray display() const; |
40 | |
41 | #if HAVE_X11 |
42 | /** |
43 | * Returns the X11 magic cookie, if available. |
44 | */ |
45 | QByteArray displayAuth() const; |
46 | #endif |
47 | |
48 | private: |
49 | void getXCookie(); |
50 | |
51 | private: |
52 | std::unique_ptr<class KCookiePrivate> const d; |
53 | }; |
54 | |
55 | } |
56 | } |
57 | |
58 | #endif // KDESUKCOOKIE_H |
59 | |