File indexing completed on 2024-05-05 09:11:04
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> 0004 Copyright (C) 2009 by Lukas Appelhans <l.appelhans@gmx.de> 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 KGET_TRANSFERFACTORY_H 0013 #define KGET_TRANSFERFACTORY_H 0014 0015 /* TransferFactory [KGet/Plugin] 0016 * 0017 * Defines a ...XXX... 0018 * 0019 * Common fields in the [Desktop Entry]: 0020 * Type=Service 0021 * ServiceTypes=KGet/Plugin 0022 * X-KDE-KGet-plugintype=TransferFactory 0023 * X-KDE-KGet-framework-version=1 0024 * Custom fields in the [Desktop Entry]: 0025 * Name=%YOURTRANSFERFACTORY% 0026 * X-KDE-Library=lib%YOURLIBRARY% 0027 * X-KDE-KGet-rank=%PLUGINRANK% 0028 * 0029 * @see kget_plugin.desktop - for "KGet/Plugin" definition 0030 * @see transfers/kio/kget_kiotransfer.desktop - desktop entry example 0031 */ 0032 0033 #include <QAction> 0034 #include <QStringList> 0035 0036 #include "core/kget.h" 0037 #include "core/plugin/plugin.h" 0038 #include "core/transfer.h" 0039 #include "core/transferdatasource.h" 0040 #include "core/transferhandler.h" 0041 #include "kget_export.h" 0042 #include "kget_macro.h" 0043 0044 class TransferGroup; 0045 class Scheduler; 0046 class QDialog; 0047 0048 /** 0049 * @short TransferFactory 0050 * 0051 * desc to come... 0052 */ 0053 class KGET_EXPORT TransferFactory : public KGetPlugin 0054 { 0055 Q_OBJECT 0056 public: 0057 TransferFactory(QObject *parent, const QVariantList &args); 0058 0059 virtual Transfer *createTransfer(const QUrl &srcUrl, const QUrl &destUrl, TransferGroup *parent, Scheduler *scheduler, const QDomElement *n = nullptr); 0060 0061 virtual TransferHandler *createTransferHandler(Transfer *transfer, Scheduler *scheduler); 0062 0063 virtual QWidget *createDetailsWidget(TransferHandler *transfer); 0064 0065 virtual QDialog *createNewTransferDialog(const QUrl &srcUrl, const QString &suggestedFileName = QString(), TransferGroupHandler *defaultGroup = nullptr); 0066 0067 virtual const QList<QAction *> actions(TransferHandler *handler = nullptr); 0068 0069 virtual void settingsChanged() 0070 { 0071 } 0072 0073 virtual bool isSupported(const QUrl &url) const; 0074 0075 /** 0076 * Returns a list of protocols for which the TransferFactory adds support. 0077 * An empty list simply means that the TransferFactory does not add support 0078 * for the urls and might internally resort on other TransferFactories 0079 */ 0080 virtual QStringList addsProtocols() const; 0081 0082 /** 0083 * Returns a Data Source. needed for Transfers Containers if any. 0084 * default implementation returns 0 0085 */ 0086 virtual TransferDataSource *createTransferDataSource(const QUrl &srcUrl, const QDomElement &type, QObject *parent); 0087 0088 virtual QString displayName() const; 0089 }; 0090 0091 #endif