File indexing completed on 2024-05-05 04:48:36
0001 /*************************************************************************** 0002 * Copyright (C) 2009, 2010 by Richard J. Moore <rich@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 0018 ***************************************************************************/ 0019 0020 #ifndef NETWORKACCESSVIEWER_H 0021 #define NETWORKACCESSVIEWER_H 0022 0023 #include "ui_NetworkRequests.h" 0024 0025 #include <qobject.h> 0026 #include <qmap.h> 0027 #include <qpair.h> 0028 #include <qlist.h> 0029 #include <qbytearray.h> 0030 #include <qnetworkaccessmanager.h> 0031 0032 class QDialog; 0033 class QTreeWidgetItem; 0034 class QSignalMapper; 0035 0036 class NetworkAccessViewer : public QObject 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 explicit NetworkAccessViewer( QWidget *parent = nullptr ); 0042 ~NetworkAccessViewer(); 0043 0044 void addRequest( QNetworkAccessManager::Operation op, const QNetworkRequest&req, QIODevice *outgoingData, QNetworkReply *reply ); 0045 0046 void show(); 0047 void hide(); 0048 0049 private Q_SLOTS: 0050 void clear(); 0051 void requestFinished( QObject *replyObject ); 0052 void showItemDetails( QTreeWidgetItem *item ); 0053 0054 private: 0055 QDialog *dialog; 0056 Ui::NetworkRequestsDialog *networkRequestsDialog; 0057 QMap<QNetworkReply *, QNetworkRequest> requestMap; 0058 QMap<QTreeWidgetItem *, QNetworkRequest> itemRequestMap; 0059 QMap<QNetworkReply *, QTreeWidgetItem *> itemMap; 0060 QMap<QTreeWidgetItem *, QPair< QList<QByteArray>, QList<QByteArray> > > itemReplyMap; 0061 QSignalMapper *mapper; 0062 }; 0063 0064 #endif // NETWORKACCESSVIEWER_H