Akonadi

agentbase/accountsintegration.h
1 /*
2  SPDX-FileCopyrightText: 2019 Daniel Vr├ítil <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "akonadiagentbase_export.h"
10 #include <QObject>
11 
12 #include <functional>
13 #include <optional>
14 
15 class Akonadi__AccountsAdaptor;
16 namespace Akonadi
17 {
18 class AKONADIAGENTBASE_EXPORT AccountsIntegration : public QObject
19 {
20  Q_OBJECT
21 
22  friend class ::Akonadi__AccountsAdaptor;
23 
24 public:
25  explicit AccountsIntegration();
26  ~AccountsIntegration() override = default;
27 
28  /**
29  * Returns whether Accounts integration is enabled.
30  */
31  Q_REQUIRED_RESULT bool isEnabled() const;
32 
33  using AuthDataCallback = std::function<void(const QVariantMap &)>;
34  using ErrorCallback = std::function<void(const QString &)>;
35  void requestAuthData(const QString &serviceType, AuthDataCallback &&cb, ErrorCallback &&err);
36 
37  std::optional<QString> accountName() const;
38 public Q_SLOTS:
39  std::optional<quint32> accountId() const;
40  void setAccountId(quint32 accountId);
41 
42 Q_SIGNALS:
43  void accountChanged();
44 
45 private:
46  // For DBus adaptor which doesn't understand std::optional
47  quint32 getAccountId() const;
48 
49  std::optional<quint32> mAccountId;
50 };
51 
52 } // namespace Akonadi
53 
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.