Attica 5.109.0
|
Attica ProviderManager. More...
#include <Attica/ProviderManager>
Public Types | |
enum | ProviderFlag { NoFlags = 0x0 , DisablePlugins = 0x1 } |
typedef QFlags< ProviderFlag > | ProviderFlags |
Signals | |
void | authenticationCredentialsMissing (const Provider &provider) |
void | defaultProvidersLoaded () |
void | failedToLoad (const QUrl &provider, QNetworkReply::NetworkError error) |
void | providerAdded (const Attica::Provider &provider) |
Public Member Functions | |
ProviderManager (const ProviderFlags &flags=NoFlags) | |
void | addProviderFile (const QUrl &file) |
void | addProviderFileToDefaultProviders (const QUrl &url) |
Add a provider file to the default providers (xml that contains provider descriptions). | |
void | addProviderFromXml (const QString &providerXml) |
Parse a xml file containing a provider description. | |
void | clear () |
Remove all providers and provider files that have been loaded. | |
bool | contains (const QUrl &provider) const |
QList< QUrl > | defaultProviderFiles () |
The list of provider files that get loaded by loadDefaultProviders. | |
void | loadDefaultProviders () |
Load available providers from configuration. | |
Provider | providerByUrl (const QUrl &url) const |
QList< QUrl > | providerFiles () const |
Provider | providerFor (const QUrl &url) const |
QList< Provider > | providers () const |
void | removeProviderFileFromDefaultProviders (const QUrl &url) |
void | setAuthenticationSuppressed (bool suppressed) |
Suppresses the authentication, so that the application can take care of authenticating itself. | |
This class is the primary access to Attica's functions. Use the ProviderManager to load Open Collaboration Service providers, either the default system ones, or from XML or custom locations.
Provider files are defined here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services
See addProviderFileToDefaultProviders(const QUrl &url) for an example of what the provider file sohuld look like. You can add providers to the ProviderManager as either raw XML data using addProviderFromXml(const QString &providerXml), or from a file somewhere on the system through addProviderFile(const QUrl &file), or you can simply load the default providers provided by your system (which generally means KDE's provider opendesktop.org).
Importantly, to be able to detect when the ProviderManager is ready to manage things, before initialising it you will want to connect to the providerAdded(const Attica::Provider &provider) signal, which is fired every time a new provider is added to the manager.
If you manually add all providers from XML, you can expect this to happen immediately. This means that once you have added your providers that way, you can access them through the providers() function, which returns a list of all loaded Providers.
Once you have loaded a Provider, you can use its functions to access the services offered by that provider.
void Attica::ProviderManager::addProviderFileToDefaultProviders | ( | const QUrl & | url | ) |
Add a provider file to the default providers (xml that contains provider descriptions).
Provider files contain information about each provider:
<providers> <provider> <id>opendesktop</id> <location>https://api.opendesktop.org/v1/</location> <name>openDesktop.org</name> <icon></icon> <termsofuse>https://opendesktop.org/terms/</termsofuse> <register>https://opendesktop.org/usermanager/new.php</register> <services> <person ocsversion="1.3" > <friend ocsversion="1.3" > <message ocsversion="1.3" > <activity ocsversion="1.3" > <content ocsversion="1.3" > <fan ocsversion="1.3" > <knowledgebase ocsversion="1.3" > <event ocsversion="1.3" > </services> </provider> </providers>
url | the url of the provider file |
void Attica::ProviderManager::addProviderFromXml | ( | const QString & | providerXml | ) |
Parse a xml file containing a provider description.
void Attica::ProviderManager::clear | ( | ) |
Remove all providers and provider files that have been loaded.
bool Attica::ProviderManager::contains | ( | const QUrl & | provider | ) | const |
provider
QList< QUrl > Attica::ProviderManager::defaultProviderFiles | ( | ) |
The list of provider files that get loaded by loadDefaultProviders.
Each of these files can contain multiple providers.
void Attica::ProviderManager::loadDefaultProviders | ( | ) |
Load available providers from configuration.
Provider Attica::ProviderManager::providerByUrl | ( | const QUrl & | url | ) | const |
url
base url. Provider Attica::ProviderManager::providerFor | ( | const QUrl & | url | ) | const |
url
. QList< Provider > Attica::ProviderManager::providers | ( | ) | const |
void Attica::ProviderManager::setAuthenticationSuppressed | ( | bool | suppressed | ) |
Suppresses the authentication, so that the application can take care of authenticating itself.