2
This file is part of KDE.
4
Copyright (c) 2009 Eckhart Wörner <ewoerner@kde.org>
5
Copyright (c) 2009 Frederik Gladhorn <gladhorn@kde.org>
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) version 3, or any
11
later version accepted by the membership of KDE e.V. (or its
12
successor approved by the membership of KDE e.V.), which shall
13
act as a proxy defined in Section 6 of version 3 of the license.
15
This library is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
Lesser General Public License for more details.
20
You should have received a copy of the GNU Lesser General Public
21
License along with this library. If not, see <http://www.gnu.org/licenses/>.
25
#ifndef ATTICA_PROVIDERMANAGER_H
26
#define ATTICA_PROVIDERMANAGER_H
28
#include <QtCore/QUrl>
31
#include "atticaclient_export.h"
37
* Attica ProviderManager
39
* This class is the primary access to Attica's functions.
40
* Use the ProviderManager to load Open Collaboration Service providers,
41
* either the default system ones, or from XML or custom locations.
43
* \section providerfiles Provider Files
44
* Provider files are defined here:
45
* http://www.freedesktop.org/wiki/Specifications/open-collaboration-services
51
* Once you have loaded a Provider, use its functions to access the service.
53
class ATTICA_EXPORT ProviderManager : public QObject
63
Q_DECLARE_FLAGS(ProviderFlags, ProviderFlag)
65
ProviderManager(const ProviderFlags &flags = NoFlags);
69
* Load available providers from configuration
71
void loadDefaultProviders();
74
* The list of provider files that get loaded by loadDefaultProviders.
75
* Each of these files can contain multiple providers.
76
* @return list of provider file urls
78
QList<QUrl> defaultProviderFiles();
81
* Add a provider file to the default providers (xml that contains provider descriptions).
82
Provider files contain information about each provider:
87
<location>https://api.opendesktop.org/v1/</location>
88
<name>openDesktop.org</name>
90
<termsofuse>https://opendesktop.org/terms/</termsofuse>
91
<register>https://opendesktop.org/usermanager/new.php</register>
93
<person ocsversion="1.3" />
94
<friend ocsversion="1.3" />
95
<message ocsversion="1.3" />
96
<activity ocsversion="1.3" />
97
<content ocsversion="1.3" />
98
<fan ocsversion="1.3" />
99
<knowledgebase ocsversion="1.3" />
100
<event ocsversion="1.3" />
105
* @param url the url of the provider file
107
void addProviderFileToDefaultProviders(const QUrl &url);
109
void removeProviderFileFromDefaultProviders(const QUrl &url);
112
* Suppresses the authentication, so that the application can take care of authenticating itself
114
void setAuthenticationSuppressed(bool suppressed);
117
* Remove all providers and provider files that have been loaded
122
* Parse a xml file containing a provider description
124
void addProviderFromXml(const QString &providerXml);
125
void addProviderFile(const QUrl &file);
126
QList<QUrl> providerFiles() const;
128
QList<Provider> providers() const;
129
bool contains(const QString &provider) const;
130
Provider providerByUrl(const QUrl &url) const;
133
void providerAdded(const Attica::Provider &provider);
134
void defaultProvidersLoaded();
135
void authenticationCredentialsMissing(const Provider &provider);
138
void fileFinished(const QString &url);
139
void authenticate(QNetworkReply *, QAuthenticator *);
140
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
141
void slotLoadDefaultProvidersInternal();
144
ProviderManager(const ProviderManager &other);
145
ProviderManager &operator=(const ProviderManager &other);
147
void initNetworkAccesssManager();
148
PlatformDependent *loadPlatformDependent(const ProviderFlags &flags);
150
void parseProviderFile(const QString &xmlString, const QString &url);
158
Q_DECLARE_OPERATORS_FOR_FLAGS(Attica::ProviderManager::ProviderFlags)