Warning, file /frameworks/attica/src/platformdependent.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2009 Eckhart W├Ârner <ewoerner@kde.org>
0005     SPDX-FileCopyrightText: 2011 Laszlo Papp <djszapi@archlinux.us>
0006 
0007     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0008 */
0009 
0010 #ifndef ATTICA_PLATFORMDEPENDENT_H
0011 #define ATTICA_PLATFORMDEPENDENT_H
0012 
0013 #include <QList>
0014 #include <QtPlugin>
0015 
0016 class QByteArray;
0017 class QIODevice;
0018 class QNetworkAccessManager;
0019 class QNetworkReply;
0020 class QNetworkRequest;
0021 class QString;
0022 class QUrl;
0023 
0024 namespace Attica
0025 {
0026 class PlatformDependent
0027 {
0028 public:
0029     virtual ~PlatformDependent()
0030     {
0031     }
0032     virtual QList<QUrl> getDefaultProviderFiles() const = 0;
0033     virtual void addDefaultProviderFile(const QUrl &url) = 0;
0034     virtual void removeDefaultProviderFile(const QUrl &url) = 0;
0035 
0036     /**
0037      * Providers are enabled by default. Use this call to disable or enable them later.
0038      */
0039     virtual void enableProvider(const QUrl &baseUrl, bool enabled) const = 0;
0040     virtual bool isEnabled(const QUrl &baseUrl) const = 0;
0041 
0042     /**
0043      * Asks the PlatformDependent plugin if it have a credentials for baseUrl
0044      */
0045     virtual bool hasCredentials(const QUrl &baseUrl) const = 0;
0046 
0047     /**
0048      * Asks the PlatformDependent plugin to load credentials from storage,
0049      * and save it in user, password.
0050      */
0051     virtual bool loadCredentials(const QUrl &baseUrl, QString &user, QString &password) = 0;
0052 
0053     /**
0054      * Asks the PlatformDependent plugin to ask user to login and expects it to be stored in
0055      * user and password.
0056      * TODO KF6: Remove, askForCredentials and loadCredentials is essentially same, loadCredentials
0057      * can itself ask for credentials if it is not present in store.
0058      */
0059     virtual bool askForCredentials(const QUrl &baseUrl, QString &user, QString &password) = 0;
0060 
0061     /**
0062      * Method to be called by attica to store the user and password in storage used by PlatformDependent
0063      * plugin.
0064      * TODO KF6: Remove, if you let platform plugin ask for credentials, you don't want to save credentials
0065      * yourself and let plugin handle it.
0066      */
0067     virtual bool saveCredentials(const QUrl &baseUrl, const QString &user, const QString &password) = 0;
0068 
0069     virtual QNetworkReply *get(const QNetworkRequest &request) = 0;
0070     virtual QNetworkReply *post(const QNetworkRequest &request, QIODevice *data) = 0;
0071     virtual QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data) = 0;
0072     virtual void setNam(QNetworkAccessManager *)
0073     {
0074     }
0075     virtual QNetworkAccessManager *nam() = 0;
0076 };
0077 
0078 }
0079 
0080 Q_DECLARE_INTERFACE(Attica::PlatformDependent, "org.kde.Attica.Internals/1.2")
0081 
0082 #endif