1 /************************************************************************** 2 * Otter Browser: Web browser controlled by the user, not vice-versa. 3 * Copyright (C) 2018 Michal Dutkiewicz aka Emdek <michal@emdek.pl> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 **************************************************************************/ 19 20 #ifndef OTTER_LISTINGNETWORKREPLY_H 21 #define OTTER_LISTINGNETWORKREPLY_H 22 23 #include <QtCore/QMimeType> 24 #include <QtCore/QUrl> 25 #include <QtNetwork/QNetworkReply> 26 27 namespace Otter 28 { 29 30 class ListingNetworkReply : public QNetworkReply 31 { 32 Q_OBJECT 33 34 public: 35 explicit ListingNetworkReply(const QNetworkRequest &request, QObject *parent); 36 37 protected: 38 struct NavigationEntry final 39 { 40 QString name; 41 QUrl url; 42 }; 43 44 struct ListingEntry final 45 { 46 enum Type 47 { 48 UnknownType = 0, 49 DriveType, 50 DirectoryType, 51 FileType 52 }; 53 54 QString name; 55 QUrl url; 56 QDateTime timeModified; 57 QMimeType mimeType; 58 Type type = UnknownType; 59 quint64 size = 0; 60 bool isSymlink = false; 61 }; 62 63 QByteArray createListing(const QString &title, const QVector<NavigationEntry> &navigation, const QVector<ListingEntry> &entries); 64 65 signals: 66 void listingError(); 67 }; 68 69 } 70 71 #endif 72