KWallet

kwalletfreedesktopprompt.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 _KWALLETFREEDESKTOPPROMPT_H_
8#define _KWALLETFREEDESKTOPPROMPT_H_
9
10#include "kwalletfreedesktopservice.h"
11
12#define FDO_SECRET_SERVICE_PROMPT_PATH FDO_SECRETS_SERVICE_OBJECT "/prompt/"
13
14class KWalletD;
15
16enum class PromptType {
17 Open,
18 Create,
19};
20
21class KWalletFreedesktopPrompt : public QObject, protected FDO_DBUS_CONTEXT
22{
24
25 struct CollectionProperties {
26 QString collectionLabel;
27 QDBusObjectPath objectPath;
28 QString alias;
29 };
30
31public:
32 KWalletFreedesktopPrompt(KWalletFreedesktopService *service, QDBusObjectPath objectPath, PromptType type, QString responseBusName);
33
34 KWalletFreedesktopPrompt(const KWalletFreedesktopPrompt &) = delete;
35 KWalletFreedesktopPrompt &operator=(const KWalletFreedesktopPrompt &) = delete;
36
37 KWalletFreedesktopPrompt(KWalletFreedesktopPrompt &&) = delete;
38 KWalletFreedesktopPrompt &operator=(KWalletFreedesktopPrompt &&) = delete;
39
40 KWalletFreedesktopService *fdoService() const;
41 KWalletD *backend() const;
42 QDBusObjectPath fdoObjectPath() const;
43
44 void subscribeForWalletAsyncOpened();
45 void appendProperties(const QString &label, const QDBusObjectPath &objectPath = QDBusObjectPath("/"), const QString &alias = {});
46
47public Q_SLOTS:
48 void walletAsyncOpened(int transactionId, int walletHandle);
49
50private:
51 KWalletFreedesktopService *m_service;
52 QDBusObjectPath m_objectPath;
53 PromptType m_type;
54 QSet<int> m_transactionIds;
56 QList<CollectionProperties> m_propertiesList;
57 std::map<int, CollectionProperties> m_transactionIdToCollectionProperties;
58 QString m_responseBusName;
59
60 /* Freedesktop API */
61
62 /* org.freedesktop.Secret.Prompt methods */
63public Q_SLOTS:
64 void Dismiss();
65 void Prompt(const QString &window_id);
66
67 /* org.freedesktop.Secret.Prompt signals */
69 /* Emitted manually now */
70 void Completed(bool dismissed, const QDBusVariant &result);
71};
72
73#endif
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:12:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.