Attica

providermanager.h
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2009 Eckhart W├Ârner <[email protected]>
5  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8 */
9 
10 #ifndef ATTICA_PROVIDERMANAGER_H
11 #define ATTICA_PROVIDERMANAGER_H
12 
13 #include <QUrl>
14 #include <QNetworkReply>
15 
16 #include "provider.h"
17 #include "attica_export.h"
18 
19 namespace Attica
20 {
21 
55 class ATTICA_EXPORT ProviderManager : public QObject
56 {
57  Q_OBJECT
58 
59 public:
60 
61  enum ProviderFlag {
62  NoFlags = 0x0,
63  DisablePlugins = 0x1
64  };
65  Q_DECLARE_FLAGS(ProviderFlags, ProviderFlag)
66 
67  ProviderManager(const ProviderFlags &flags = NoFlags);
68  ~ProviderManager();
69 
73  void loadDefaultProviders();
74 
80  QList<QUrl> defaultProviderFiles();
81 
109  void addProviderFileToDefaultProviders(const QUrl &url);
110 
111  void removeProviderFileFromDefaultProviders(const QUrl &url);
112 
116  void setAuthenticationSuppressed(bool suppressed);
117 
121  void clear();
122 
126  void addProviderFromXml(const QString &providerXml);
127  void addProviderFile(const QUrl &file);
128  QList<QUrl> providerFiles() const;
129 
133  QList<Provider> providers() const;
134 
135 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 23)
136 
139  ATTICA_DEPRECATED_VERSION(5, 23, "Use ProviderManager::contains(const QUrl&)")
140  bool contains(const QString &provider) const;
141 #endif
142 
146  bool contains(const QUrl &provider) const;
147 
151  Provider providerByUrl(const QUrl &url) const;
152 
156  Provider providerFor(const QUrl &url) const;
157 
158 Q_SIGNALS:
159  void providerAdded(const Attica::Provider &provider);
160  void defaultProvidersLoaded();
161  void authenticationCredentialsMissing(const Provider &provider);
162  void failedToLoad(const QUrl& provider, QNetworkReply::NetworkError error);
163 
164 private Q_SLOTS:
165  void fileFinished(const QString &url);
166  void authenticate(QNetworkReply *, QAuthenticator *);
167  void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
168  void slotLoadDefaultProvidersInternal();
169 
170 private:
171  ProviderManager(const ProviderManager &other);
172  ProviderManager &operator=(const ProviderManager &other);
173 
174  void initNetworkAccesssManager();
175  PlatformDependent *loadPlatformDependent(const ProviderFlags &flags);
176 
177  void parseProviderFile(const QString &xmlString, const QUrl &url);
178 
179  class Private;
180  Private *const d;
181 };
182 
183 Q_DECLARE_OPERATORS_FOR_FLAGS(ProviderManager::ProviderFlags)
184 
185 }
186 
187 #endif
QCA_EXPORT ProviderList providers()
Attica ProviderManager.
The Provider class represents one Open Collaboration Service provider.
Definition: provider.h:95
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 23:06:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.