KWallet

kwalletfreedesktopitem.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2021 Slava Aseev <nullptrnine@basealt.ru>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7#ifndef _KWALLETFREEDESKTOPITEM_H_
8#define _KWALLETFREEDESKTOPITEM_H_
9#include "kwalletfreedesktopservice.h"
10
11static inline constexpr auto FDO_SS_MAGICK = 0x4950414f44465353ULL;
12
13class KWalletD;
14class KWalletFreedesktopCollection;
15
16class KWalletFreedesktopItem : public QObject, protected FDO_DBUS_CONTEXT
17{
18 /* org.freedesktop.Secret.Item properties */
19public:
20 Q_PROPERTY(StrStrMap Attributes READ attributes WRITE setAttributes)
21 StrStrMap attributes() const;
22 void setAttributes(const StrStrMap &value);
23
24 Q_PROPERTY(qulonglong Created READ created)
25 qulonglong created() const;
26
27 Q_PROPERTY(QString Label READ label WRITE setLabel)
28 QString label() const;
29 void setLabel(const QString &value);
30
31 Q_PROPERTY(bool Locked READ locked)
32 bool locked() const;
33
34 Q_PROPERTY(qulonglong Modified READ modified)
35 qulonglong modified() const;
36
37 Q_PROPERTY(QString Type READ type WRITE setType)
38 QString type() const;
39 void setType(const QString &value);
40
42
43public:
44 KWalletFreedesktopItem(KWalletFreedesktopCollection *collection, FdoUniqueLabel uniqLabel, QDBusObjectPath path);
45 ~KWalletFreedesktopItem();
46
47 KWalletFreedesktopItem(const KWalletFreedesktopItem &) = delete;
48 KWalletFreedesktopItem &operator=(const KWalletFreedesktopItem &) = delete;
49
50 KWalletFreedesktopItem(KWalletFreedesktopItem &&) = delete;
51 KWalletFreedesktopItem &operator=(KWalletFreedesktopItem &&) = delete;
52
53 KWalletFreedesktopCollection *fdoCollection() const;
54 KWalletFreedesktopService *fdoService() const;
55 KWalletD *backend() const;
56 QDBusObjectPath fdoObjectPath() const;
57 const FdoUniqueLabel &uniqueLabel() const;
58 void uniqueLabel(const FdoUniqueLabel &uniqLabel);
59
60 /*
61 QVariantMap readMap() const;
62 void writeMap(const QVariantMap &data);
63 */
64
65 FreedesktopSecret getSecret(const QDBusConnection &connection, const QDBusMessage &message, const QDBusObjectPath &session);
66 void setDeleted();
67
68 /* Emitters */
69 void onPropertiesChanged(const QVariantMap &properties);
70 void enableFdoFormat();
71
72private:
73 KWalletFreedesktopCollection *m_collection;
74 FdoUniqueLabel m_uniqueLabel;
75 QDBusObjectPath m_path;
76 bool m_wasDeleted = false;
77
78 /* Freedesktop API */
79
80 /* org.freedesktop.Secret.Item methods */
81public Q_SLOTS:
82 QDBusObjectPath Delete();
83 FreedesktopSecret GetSecret(const QDBusObjectPath &session);
84 void SetSecret(const FreedesktopSecret &secret);
85};
86
87#endif
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:06 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.