File indexing completed on 2024-05-12 08:59:44

0001 /**************************************************************************
0002  *   Copyright (C) 2006 - 2008 Urs Wolfer <uwolfer @ kde.org>              *
0003  *   Copyright (C) 2006 Dario Massarin <nekkar@libero.it>                  *
0004  *   Copyright (C) 2008 - 2009 Lukas Appelhans <l.appelhans@gmx.de>        *
0005  *   Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net>                     *
0006  *                                                                         *
0007  *   This program is free software; you can redistribute it and/or modify  *
0008  *   it under the terms of the GNU General Public License as published by  *
0009  *   the Free Software Foundation; either version 2 of the License, or     *
0010  *   (at your option) any later version.                                   *
0011  *                                                                         *
0012  *   This program is distributed in the hope that it will be useful,       *
0013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0015  *   GNU General Public License for more details.                          *
0016  *                                                                         *
0017  *   You should have received a copy of the GNU General Public License     *
0018  *   along with this program; if not, write to the                         *
0019  *   Free Software Foundation, Inc.,                                       *
0020  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
0021  ***************************************************************************/
0022 
0023 #ifndef DBUSKGETWRAPPER
0024 #define DBUSKGETWRAPPER
0025 
0026 #include <QObject>
0027 #include <QVariantMap>
0028 
0029 class MainWindow;
0030 class TransferHandler;
0031 
0032 class DBusKGetWrapper : public QObject
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     explicit DBusKGetWrapper(MainWindow *parent);
0038     ~DBusKGetWrapper() override;
0039 
0040     QStringList addTransfer(const QString &src, const QString &destDir = QString(), bool start = false);
0041     bool delTransfer(const QString &dbusObjectPath);
0042     void showNewTransferDialog(const QStringList &urls);
0043     bool dropTargetVisible() const;
0044     void setDropTargetVisible(bool setVisible);
0045     void setOfflineMode(bool online);
0046     bool offlineMode() const;
0047     QVariantMap transfers() const;
0048     int transfersSpeed() const;
0049     void importLinks(const QList<QString> &links);
0050     bool isSupported(const QString &url) const;
0051 
0052 Q_SIGNALS:
0053     void transferAddedRemoved();
0054     void transfersAdded(const QStringList &urls, const QStringList &dBusObjectPaths);
0055     void transfersRemoved(const QStringList &urls, const QStringList &dbusObjectPaths);
0056 
0057 private Q_SLOTS:
0058     void slotTransfersAdded(const QList<TransferHandler *> &transfers);
0059     void slotTransfersRemoved(const QList<TransferHandler *> &transfers);
0060 
0061 private:
0062     MainWindow *m_mainWindow;
0063     QHash<TransferHandler *, QPair<QString, QString>> m_transfers;
0064 };
0065 
0066 #endif