1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org>
5 SPDX-FileCopyrightText: 2011 Laszlo Papp <djszapi@archlinux.us>
6 SPDX-FileCopyrightText: 2012 Jeff Mitchell <mitchell@kde.org>
7
8 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
9*/
10
11#ifndef ATTICA_QTPLATFORMDEPENDENT_P_H
12#define ATTICA_QTPLATFORMDEPENDENT_P_H
13
14#include "platformdependent_v3.h"
15
16#include <QHash>
17#include <QMutex>
18#include <QNetworkAccessManager>
19#include <QSet>
20#include <QThread>
21
22namespace Attica
23{
24class QtPlatformDependent : public Attica::PlatformDependentV3
25{
26public:
27 QtPlatformDependent();
28 ~QtPlatformDependent() override;
29
30 void setNam(QNetworkAccessManager *nam) override;
31 QNetworkAccessManager *nam() override;
32
33 QList<QUrl> getDefaultProviderFiles() const override;
34 void addDefaultProviderFile(const QUrl &url) override;
35 void removeDefaultProviderFile(const QUrl &url) override;
36 void enableProvider(const QUrl &baseUrl, bool enabled) const override;
37 bool isEnabled(const QUrl &baseUrl) const override;
38
39 QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data) override;
40 QNetworkReply *post(const QNetworkRequest &request, QIODevice *data) override;
41 QNetworkReply *get(const QNetworkRequest &request) override;
42 bool hasCredentials(const QUrl &baseUrl) const override;
43 bool saveCredentials(const QUrl &baseUrl, const QString &user, const QString &password) override;
44 bool loadCredentials(const QUrl &baseUrl, QString &user, QString &password) override;
45 bool askForCredentials(const QUrl &baseUrl, QString &user, QString &password) override;
46 QNetworkReply *deleteResource(const QNetworkRequest &request) override;
47 QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data) override;
48 QNetworkReply *put(const QNetworkRequest &request, QIODevice *data) override;
49 [[nodiscard]] bool isReady() override;
50
51private:
52 QMutex m_accessMutex;
53 QHash<QThread *, QNetworkAccessManager *> m_threadNamHash;
54 QSet<QThread *> m_ourNamSet;
55 QHash<QString, QPair<QString, QString>> m_passwords;
56};
57
58}
59
60#endif
61

source code of attica/src/qtplatformdependent_p.h