| 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 | class KCookie |
| 27 | { |
| 28 | public: |
| 29 | KCookie(); |
| 30 | ~KCookie(); |
| 31 | |
| 32 | KCookie(const KCookie &) = delete; |
| 33 | KCookie &operator=(const KCookie &) = delete; |
| 34 | |
| 35 | /*! |
| 36 | * Returns the X11 display. |
| 37 | */ |
| 38 | QByteArray display() const; |
| 39 | |
| 40 | #if HAVE_X11 |
| 41 | /*! |
| 42 | * Returns the X11 magic cookie, if available. |
| 43 | */ |
| 44 | QByteArray displayAuth() const; |
| 45 | #endif |
| 46 | |
| 47 | private: |
| 48 | void getXCookie(); |
| 49 | |
| 50 | private: |
| 51 | std::unique_ptr<class KCookiePrivate> const d; |
| 52 | }; |
| 53 | |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | #endif // KDESUKCOOKIE_H |
| 58 | |