File indexing completed on 2024-12-08 03:37:14
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 SPDX-FileCopyrightText: 2012 Jeff Mitchell <mitchell@kde.org> 0007 0008 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0009 */ 0010 0011 #ifndef ATTICA_QTPLATFORMDEPENDENT_P_H 0012 #define ATTICA_QTPLATFORMDEPENDENT_P_H 0013 0014 #include "platformdependent_v2.h" 0015 0016 #include <QHash> 0017 #include <QMutex> 0018 #include <QNetworkAccessManager> 0019 #include <QSet> 0020 #include <QThread> 0021 0022 namespace Attica 0023 { 0024 class QtPlatformDependent : public Attica::PlatformDependentV2 0025 { 0026 public: 0027 QtPlatformDependent(); 0028 ~QtPlatformDependent() override; 0029 0030 void setNam(QNetworkAccessManager *nam) override; 0031 QNetworkAccessManager *nam() override; 0032 0033 QList<QUrl> getDefaultProviderFiles() const override; 0034 void addDefaultProviderFile(const QUrl &url) override; 0035 void removeDefaultProviderFile(const QUrl &url) override; 0036 void enableProvider(const QUrl &baseUrl, bool enabled) const override; 0037 bool isEnabled(const QUrl &baseUrl) const override; 0038 0039 QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data) override; 0040 QNetworkReply *post(const QNetworkRequest &request, QIODevice *data) override; 0041 QNetworkReply *get(const QNetworkRequest &request) override; 0042 bool hasCredentials(const QUrl &baseUrl) const override; 0043 bool saveCredentials(const QUrl &baseUrl, const QString &user, const QString &password) override; 0044 bool loadCredentials(const QUrl &baseUrl, QString &user, QString &password) override; 0045 bool askForCredentials(const QUrl &baseUrl, QString &user, QString &password) override; 0046 QNetworkReply *deleteResource(const QNetworkRequest &request) override; 0047 QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data) override; 0048 QNetworkReply *put(const QNetworkRequest &request, QIODevice *data) override; 0049 0050 private: 0051 QMutex m_accessMutex; 0052 QHash<QThread *, QNetworkAccessManager *> m_threadNamHash; 0053 QSet<QThread *> m_ourNamSet; 0054 QHash<QString, QPair<QString, QString>> m_passwords; 0055 }; 0056 0057 } 0058 0059 #endif