File indexing completed on 2025-02-16 13:03:26
0001 /* 0002 This file is part of the KDE project, module kdesu 0003 SPDX-FileCopyrightText: 1999, 2000 Geert Jansen <jansen@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-only 0006 */ 0007 0008 #ifndef KDESUKCOOKIE_H 0009 #define KDESUKCOOKIE_H 0010 0011 #include <QByteArray> 0012 0013 #include <config-kdesu.h> 0014 0015 #include <memory> 0016 0017 namespace KDESu 0018 { 0019 namespace KDESuPrivate 0020 { 0021 /** 0022 * Utility class to access the authentication tokens needed to run a KDE 0023 * program (X11 cookies on X11, for instance). 0024 * @internal 0025 */ 0026 0027 class KCookie 0028 { 0029 public: 0030 KCookie(); 0031 ~KCookie(); 0032 0033 KCookie(const KCookie &) = delete; 0034 KCookie &operator=(const KCookie &) = delete; 0035 0036 /** 0037 * Returns the X11 display. 0038 */ 0039 QByteArray display() const; 0040 0041 #if HAVE_X11 0042 /** 0043 * Returns the X11 magic cookie, if available. 0044 */ 0045 QByteArray displayAuth() const; 0046 #endif 0047 0048 private: 0049 void getXCookie(); 0050 0051 private: 0052 std::unique_ptr<class KCookiePrivate> const d; 0053 }; 0054 0055 } 0056 } 0057 0058 #endif // KDESUKCOOKIE_H