Akonadi

akonadicontrol/accountsintegration.h
1 /***************************************************************************
2  * Copyright (c) 2019 Daniel Vrátil <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU Library General Public License as *
6  * published by the Free Software Foundation; either version 2 of the *
7  * License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU Library General Public *
15  * License along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18  ***************************************************************************/
19 
20 #ifndef ACCOUNTSINTEGRATION_H_
21 #define ACCOUNTSINTEGRATION_H_
22 
23 #include <QObject>
24 #include <QMap>
25 
26 #include <Accounts/Manager>
27 
28 #include <optional>
29 
30 namespace Accounts
31 {
32 class Account;
33 class Service;
34 }
35 
36 class AgentManager;
37 
38 class AccountsIntegration: public QObject
39 {
40  Q_OBJECT
41 public:
42  explicit AccountsIntegration(AgentManager &agentManager);
43 
44 private Q_SLOTS:
45  void onAccountAdded(Accounts::AccountId);
46  void onAccountRemoved(Accounts::AccountId);
47  void onAccountServiceEnabled(const QString &service, bool enabled);
48 
49 private:
50  void configureAgentInstance(const QString &identifier, Accounts::AccountId accountId, int attempt = 0);
51  std::optional<QString> agentForAccount(const QString &agentType, Accounts::AccountId accountId) const;
52  void createAgent(const QString &agentType, Accounts::AccountId accountId);
53  void removeAgentInstance(const QString &identifier);
54  void loadSupportedServices();
55 
56  AgentManager &mAgentManager;
57  Accounts::Manager mAccountsManager;
58 
59 
60  QMap<QString, QString /* agent type */> mSupportedServices;
61 };
62 
63 
64 
65 #endif
The agent manager has knowledge about all available agents (it scans for .desktop files in the agent ...
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 1 2020 23:07:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.