| platformdependent.h | | platformdependent.h | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| #include <QtCore/QList> | | #include <QtCore/QList> | |
| #include <QtCore/QtPlugin> | | #include <QtCore/QtPlugin> | |
| | | | |
| class QByteArray; | | class QByteArray; | |
| class QIODevice; | | class QIODevice; | |
| class QNetworkAccessManager; | | class QNetworkAccessManager; | |
| class QNetworkReply; | | class QNetworkReply; | |
| class QNetworkRequest; | | class QNetworkRequest; | |
| class QString; | | class QString; | |
| class QUrl; | | class QUrl; | |
|
| | | class QStringList; | |
| | | | |
| namespace Attica { | | namespace Attica { | |
| | | | |
| class PlatformDependent | | class PlatformDependent | |
| { | | { | |
| public: | | public: | |
| virtual ~PlatformDependent() {} | | virtual ~PlatformDependent() {} | |
| virtual QList<QUrl> getDefaultProviderFiles() const = 0; | | virtual QList<QUrl> getDefaultProviderFiles() const = 0; | |
|
| | | virtual void addDefaultProviderFile(const QUrl& url) = 0; | |
| | | virtual void removeDefaultProviderFile(const QUrl& url) = 0; | |
| | | | |
| | | /** | |
| | | * Providers are enabled by default. Use this call to disable or enable | |
| | | them later. | |
| | | */ | |
| | | virtual void enableProvider(const QUrl& baseUrl, bool enabled) const = | |
| | | 0; | |
| | | virtual bool isEnabled(const QUrl& baseUrl) const = 0; | |
| | | | |
| virtual bool hasCredentials(const QUrl& baseUrl) const = 0; | | virtual bool hasCredentials(const QUrl& baseUrl) const = 0; | |
| virtual bool loadCredentials(const QUrl& baseUrl, QString& user, QStrin
g& password) = 0; | | virtual bool loadCredentials(const QUrl& baseUrl, QString& user, QStrin
g& password) = 0; | |
| virtual bool askForCredentials(const QUrl& baseUrl, QString& user, QStr
ing& password) = 0; | | virtual bool askForCredentials(const QUrl& baseUrl, QString& user, QStr
ing& password) = 0; | |
| virtual bool saveCredentials(const QUrl& baseUrl, const QString& user,
const QString& password) = 0; | | virtual bool saveCredentials(const QUrl& baseUrl, const QString& user,
const QString& password) = 0; | |
| virtual QNetworkReply* get(const QNetworkRequest& request) = 0; | | virtual QNetworkReply* get(const QNetworkRequest& request) = 0; | |
| virtual QNetworkReply* post(const QNetworkRequest& request, QIODevice*
data) = 0; | | virtual QNetworkReply* post(const QNetworkRequest& request, QIODevice*
data) = 0; | |
| virtual QNetworkReply* post(const QNetworkRequest& request, const QByte
Array& data) = 0; | | virtual QNetworkReply* post(const QNetworkRequest& request, const QByte
Array& data) = 0; | |
| virtual QNetworkAccessManager* nam() = 0; | | virtual QNetworkAccessManager* nam() = 0; | |
| }; | | }; | |
| | | | |
| } | | } | |
| | | | |
|
| Q_DECLARE_INTERFACE(Attica::PlatformDependent, "org.kde.Attica.Internals/1.
0") | | Q_DECLARE_INTERFACE(Attica::PlatformDependent, "org.kde.Attica.Internals/1.
2") | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 13 lines changed or added | |
|
| provider.h | | provider.h | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| class PostJob; | | class PostJob; | |
| class Provider; | | class Provider; | |
| class AccountBalance; | | class AccountBalance; | |
| | | | |
| /** | | /** | |
| * The Provider class represents one Open Collaboration Service provider. | | * The Provider class represents one Open Collaboration Service provider. | |
| * Use the ProviderManager to instanciate a Provider. | | * Use the ProviderManager to instanciate a Provider. | |
| * | | * | |
| * Accessing functions of the Provider returns a Job class that | | * Accessing functions of the Provider returns a Job class that | |
| * takes care of accessing the server and parsing the result. | | * takes care of accessing the server and parsing the result. | |
|
| | | * | |
| | | * Provider files are xml of the form: | |
| | | <pre> | |
| | | <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" /> | |
| | | <comment ocsversion="1.2" /> | |
| | | </services> | |
| | | </provider> | |
| | | </pre> | |
| | | * The server provides the services specified in the services section, not | |
| | | necessarily all of them. | |
| */ | | */ | |
| class ATTICA_EXPORT Provider | | class ATTICA_EXPORT Provider | |
| { | | { | |
| public: | | public: | |
| Provider(); | | Provider(); | |
| Provider(const Provider& other); | | Provider(const Provider& other); | |
| Provider& operator=(const Provider& other); | | Provider& operator=(const Provider& other); | |
| ~Provider(); | | ~Provider(); | |
| | | | |
|
| | | /** | |
| | | Returns true if the provider has been set up and can be used. | |
| | | */ | |
| bool isValid() const; | | bool isValid() const; | |
|
| | | | |
| | | /** | |
| | | Test if the provider is enabled by the settings. | |
| | | The application can choose to ignore this, but the user settings should | |
| | | be respected. | |
| | | */ | |
| | | bool isEnabled() const; | |
| | | void setEnabled(bool enabled); | |
| | | | |
| | | /** | |
| | | A url that identifies this provider. | |
| | | This should be used as identifier when refering to this provider but yo | |
| | | u don't want to use the full provider object. | |
| | | */ | |
| QUrl baseUrl() const; | | QUrl baseUrl() const; | |
|
| | | | |
| | | /** | |
| | | A name for the provider that can be displayed to the user | |
| | | */ | |
| QString name() const; | | QString name() const; | |
| | | | |
| enum SortMode { | | enum SortMode { | |
| Newest, | | Newest, | |
| Alphabetical, | | Alphabetical, | |
| Rating, | | Rating, | |
| Downloads | | Downloads | |
| }; | | }; | |
| | | | |
|
| bool hasCredentials(); | | /** | |
| | | Test if the server supports the person part of the API | |
| | | */ | |
| | | bool hasPersonService() const; | |
| | | /** | |
| | | Version of the person part of the API | |
| | | */ | |
| | | QString personServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the server supports the friend part of the API | |
| | | */ | |
| | | bool hasFriendService() const; | |
| | | | |
| | | /** | |
| | | Version of the friend part of the API | |
| | | */ | |
| | | QString friendServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the server supports the message part of the API | |
| | | */ | |
| | | bool hasMessageService() const; | |
| | | /** | |
| | | Version of the message part of the API | |
| | | */ | |
| | | QString messageServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the server supports the activity part of the API | |
| | | */ | |
| | | bool hasActivityService() const; | |
| | | /** | |
| | | Version of the activity part of the API | |
| | | */ | |
| | | QString activityServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the server supports the content part of the API | |
| | | */ | |
| | | bool hasContentService() const; | |
| | | /** | |
| | | Version of the content part of the API | |
| | | */ | |
| | | QString contentServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the server supports the fan part of the API | |
| | | */ | |
| | | bool hasFanService() const; | |
| | | /** | |
| | | Version of the fan part of the API | |
| | | */ | |
| | | QString fanServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the server supports the knowledgebase part of the API | |
| | | */ | |
| | | bool hasKnowledgebaseService() const; | |
| | | /** | |
| | | Version of the knowledgebase part of the API | |
| | | */ | |
| | | QString knowledgebaseServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the server supports the comments part of the API | |
| | | */ | |
| | | bool hasCommentService() const; | |
| | | /** | |
| | | Version of the comments part of the API | |
| | | */ | |
| | | QString commentServiceVersion() const; | |
| | | | |
| | | /** | |
| | | Test if the provider has user name/password available. | |
| | | This does not yet open kwallet in case the KDE plugin is used. | |
| | | @return true if the provider has login information | |
| | | */ | |
| bool hasCredentials() const; | | bool hasCredentials() const; | |
|
| | | bool hasCredentials(); | |
| | | | |
| | | /** | |
| | | Load user name and password from the store. | |
| | | Attica will remember the loaded values and use them from this point o | |
| | | n. | |
| | | @param user reference that returns the user name | |
| | | @param password reference that returns the password | |
| | | @return if credentials could be loaded | |
| | | */ | |
| bool loadCredentials(QString& user, QString& password); | | bool loadCredentials(QString& user, QString& password); | |
|
| | | | |
| | | /** | |
| | | Sets (and remembers) user name and password for this provider. | |
| | | To remove the data an empty username should be passed. | |
| | | @param user the user (login) name | |
| | | @param password the password | |
| | | @return if credentials could be saved | |
| | | */ | |
| bool saveCredentials(const QString& user, const QString& password); | | bool saveCredentials(const QString& user, const QString& password); | |
| | | | |
|
| | | /** | |
| | | Test if the server accepts the login/password. | |
| | | This function does not actually set the credentials. Use saveCredenti | |
| | | als for that purpose. | |
| | | @param user the user (login) name | |
| | | @param password the password | |
| | | @return the job that will contain the success of the login as metadat | |
| | | a | |
| | | */ | |
| PostJob* checkLogin(const QString& user, const QString& password); | | PostJob* checkLogin(const QString& user, const QString& password); | |
| | | | |
| // Person part of OCS | | // Person part of OCS | |
| | | | |
| PostJob* registerAccount(const QString& id, const QString& password, co
nst QString& mail, const QString& firstName, const QString& lastName); | | PostJob* registerAccount(const QString& id, const QString& password, co
nst QString& mail, const QString& firstName, const QString& lastName); | |
| ItemJob<Person>* requestPerson(const QString& id); | | ItemJob<Person>* requestPerson(const QString& id); | |
| ItemJob<Person>* requestPersonSelf(); | | ItemJob<Person>* requestPersonSelf(); | |
| ItemJob<AccountBalance>* requestAccountBalance(); | | ItemJob<AccountBalance>* requestAccountBalance(); | |
| ListJob<Person>* requestPersonSearchByName(const QString& name); | | ListJob<Person>* requestPersonSearchByName(const QString& name); | |
| ListJob<Person>* requestPersonSearchByLocation(qreal latitude, qreal lo
ngitude, qreal distance = 0.0, int page = 0, int pageSize = 20); | | ListJob<Person>* requestPersonSearchByLocation(qreal latitude, qreal lo
ngitude, qreal distance = 0.0, int page = 0, int pageSize = 20); | |
| | | | |
| skipping to change at line 221 | | skipping to change at line 365 | |
| ItemJob<AccountBalance>* doRequestAccountBalance(const QUrl& url); | | ItemJob<AccountBalance>* doRequestAccountBalance(const QUrl& url); | |
| ListJob<Person>* doRequestPersonList(const QUrl& url); | | ListJob<Person>* doRequestPersonList(const QUrl& url); | |
| ListJob<Activity>* doRequestActivityList(const QUrl& url); | | ListJob<Activity>* doRequestActivityList(const QUrl& url); | |
| ListJob<Folder>* doRequestFolderList(const QUrl& url); | | ListJob<Folder>* doRequestFolderList(const QUrl& url); | |
| ListJob<Message>* doRequestMessageList(const QUrl& url); | | ListJob<Message>* doRequestMessageList(const QUrl& url); | |
| | | | |
| private: | | private: | |
| class Private; | | class Private; | |
| QExplicitlySharedDataPointer<Private> d; | | QExplicitlySharedDataPointer<Private> d; | |
| | | | |
|
| // old constructor: used to pass internals as QSharedPointer, but chang | | | |
| ed to pointer | | | |
| // deleting the root objects of plugins is evil (see QPluginLoaded docs | | | |
| ) | | | |
| Provider(const QSharedPointer<PlatformDependent>& internals, const QUrl | | | |
| & baseUrl, const QString& name, const QUrl& icon = QUrl()); | | | |
| // FIXME use baseUrl as id | | | |
| Provider(PlatformDependent* internals, const QUrl& baseUrl, const QStri
ng& name, const QUrl& icon = QUrl()); | | Provider(PlatformDependent* internals, const QUrl& baseUrl, const QStri
ng& name, const QUrl& icon = QUrl()); | |
|
| | | Provider(PlatformDependent* internals, const QUrl& baseUrl, const QStri | |
| | | ng& name, const QUrl& icon, | |
| | | const QString& person, const QString& friendV, const QString& | |
| | | message, | |
| | | const QString& activity, const QString& content, const QString | |
| | | & fan, | |
| | | const QString& knowledgebase, const QString& event, const QStr | |
| | | ing& comment); | |
| | | | |
|
| // TODO remove | | friend class ProviderManager; | |
| friend class ProviderManager; | | | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 11 change blocks. |
| 10 lines changed or deleted | | 160 lines changed or added | |
|
| providermanager.h | | providermanager.h | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| public: | | public: | |
| ProviderManager(); | | ProviderManager(); | |
| ~ProviderManager(); | | ~ProviderManager(); | |
| | | | |
| /** | | /** | |
| * Load available providers from configuration | | * Load available providers from configuration | |
| */ | | */ | |
| void loadDefaultProviders(); | | void loadDefaultProviders(); | |
| | | | |
| /** | | /** | |
|
| | | * The list of provider files that get loaded by loadDefaultProviders. | |
| | | * Each of these files can contain multiple providers. | |
| | | * @return list of provider file urls | |
| | | */ | |
| | | QList<QUrl> defaultProviderFiles(); | |
| | | | |
| | | /** | |
| | | * Add a provider file to the default providers (xml that contains provi | |
| | | der descriptions). | |
| | | Provider files contain information about each provider: | |
| | | <pre> | |
| | | <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> | |
| | | </pre> | |
| | | * @param url the url of the provider file | |
| | | */ | |
| | | void addProviderFileToDefaultProviders(const QUrl& url); | |
| | | | |
| | | void removeProviderFileFromDefaultProviders(const QUrl& url); | |
| | | | |
| | | /** | |
| * Suppresses the authentication, so that the application can take care
of authenticating itself | | * Suppresses the authentication, so that the application can take care
of authenticating itself | |
| */ | | */ | |
| void setAuthenticationSuppressed(bool suppressed); | | void setAuthenticationSuppressed(bool suppressed); | |
| | | | |
| /** | | /** | |
|
| * Remove all providers that have been loaded | | * Remove all providers and provider files that have been loaded | |
| */ | | */ | |
| void clear(); | | void clear(); | |
| | | | |
| /** | | /** | |
| * Parse a xml file containing a provider description | | * Parse a xml file containing a provider description | |
| */ | | */ | |
| void addProviderFromXml(const QString& providerXml); | | void addProviderFromXml(const QString& providerXml); | |
| void addProviderFile(const QUrl& file); | | void addProviderFile(const QUrl& file); | |
| QList<QUrl> providerFiles() const; | | QList<QUrl> providerFiles() const; | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 40 lines changed or added | |
|