File indexing completed on 2024-04-28 04:57:32
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2004 Dario Massarin <nekkar@libero.it> 0004 Copyright (C) 2012 Aish Raj Dahal <dahalaishraj@gmail.com> 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 */ 0011 0012 #ifndef METALINK_H 0013 #define METALINK_H 0014 0015 #include <KIO/Job> 0016 0017 #include "abstractmetalink.h" 0018 #include "core/datasourcefactory.h" 0019 #include "core/transfer.h" 0020 0021 #include "ui/metalinkcreator/metalinker.h" 0022 0023 class MetalinkXml : public AbstractMetalink 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 MetalinkXml(TransferGroup *parent, TransferFactory *factory, Scheduler *scheduler, const QUrl &src, const QUrl &dest, const QDomElement *e = nullptr); 0029 0030 ~MetalinkXml() override; 0031 0032 void save(const QDomElement &element) override; 0033 void load(const QDomElement *e) override; 0034 0035 public Q_SLOTS: 0036 // --- Job virtual functions --- 0037 void start() override; 0038 0039 void deinit(Transfer::DeleteOptions options) override; 0040 0041 protected Q_SLOTS: 0042 /** 0043 * @return true if initialising worked 0044 * @note false does not mean that an error happened, it could mean, that the user 0045 * decided to update the metalink 0046 */ 0047 bool metalinkInit(const QUrl &url = QUrl(), const QByteArray &data = QByteArray()); 0048 0049 protected: 0050 /** 0051 * @note downloads the metalink file, then starts the download 0052 */ 0053 void downloadMetalink(); 0054 void startMetalink() override; 0055 void untickAllFiles(); 0056 0057 private: 0058 bool m_metalinkJustDownloaded; 0059 QUrl m_localMetalinkLocation; 0060 KGetMetalink::Metalink m_metalink; 0061 }; 0062 0063 #endif