File indexing completed on 2024-04-28 04:57:31
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2004 Dario Massarin <nekkar@libero.it> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 */ 0010 0011 #include "transferKioFactory.h" 0012 0013 #include "core/scheduler.h" 0014 #include "core/transfergroup.h" 0015 #include "transferKio.h" 0016 0017 #include "kget_debug.h" 0018 #include <KPluginFactory> 0019 #include <QDebug> 0020 0021 K_PLUGIN_CLASS_WITH_JSON(TransferKioFactory, "kget_kiofactory.json") 0022 0023 TransferKioFactory::TransferKioFactory(QObject *parent, const QVariantList &args) 0024 : TransferFactory(parent, args) 0025 { 0026 } 0027 0028 TransferKioFactory::~TransferKioFactory() 0029 { 0030 } 0031 0032 Transfer *TransferKioFactory::createTransfer(const QUrl &srcUrl, const QUrl &destUrl, TransferGroup *parent, Scheduler *scheduler, const QDomElement *e) 0033 { 0034 qCDebug(KGET_DEBUG) << "TransferKioFactory::createTransfer"; 0035 qWarning(KGET_DEBUG) << "KIOFACTORY createTRANSFER"; 0036 0037 if (isSupported(srcUrl)) { 0038 return new TransferKio(parent, this, scheduler, srcUrl, destUrl, e); 0039 } 0040 return nullptr; 0041 } 0042 0043 bool TransferKioFactory::isSupported(const QUrl &url) const 0044 { 0045 QString prot = url.scheme(); 0046 qDebug() << "Protocol = " << prot; 0047 return addsProtocols().contains(prot); 0048 } 0049 0050 QStringList TransferKioFactory::addsProtocols() const 0051 { 0052 static const QStringList protocols = QStringList() << "http" 0053 << "https" 0054 << "ftp" 0055 << "sftp"; 0056 return protocols; 0057 } 0058 0059 #include "moc_transferKioFactory.cpp" 0060 #include "transferKioFactory.moc"