From 8544d22f38e453776f01fabfa6083cec00cf6e50 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Sun, 16 Mar 2014 16:00:49 +0100 Subject: [PATCH] Revert rudimentary DCC support for the 0.10 release We've added the first bits for supporting DCC file transfers in Quassel recently, but didn't manage to get it anywhere near ready for public consumption before the 0.10.0 release. So in order to not have experimental or even unused code in the final release, we'll revert it in this branch. --- src/client/CMakeLists.txt | 4 - src/client/client.cpp | 12 -- src/client/client.h | 4 - src/client/clienttransfer.cpp | 102 -------------- src/client/clienttransfer.h | 57 -------- src/client/clienttransfermanager.cpp | 71 ---------- src/client/clienttransfermanager.h | 52 ------- src/common/CMakeLists.txt | 4 - src/common/main.cpp | 1 - src/common/quassel.cpp | 2 - src/common/transfer.cpp | 182 ------------------------ src/common/transfer.h | 129 ----------------- src/common/transfermanager.cpp | 59 -------- src/common/transfermanager.h | 56 -------- src/core/CMakeLists.txt | 4 - src/core/coresession.cpp | 3 - src/core/coresession.h | 4 - src/core/coresessioneventprocessor.cpp | 64 --------- src/core/coresessioneventprocessor.h | 1 - src/core/coretransfer.cpp | 188 ------------------------- src/core/coretransfer.h | 64 --------- src/core/coretransfermanager.cpp | 55 -------- src/core/coretransfermanager.h | 50 ------- src/qtui/CMakeLists.txt | 3 - src/qtui/mainwin.cpp | 12 -- src/qtui/mainwin.h | 2 - src/qtui/receivefiledlg.cpp | 47 ------- src/qtui/receivefiledlg.h | 43 ------ src/qtui/ui/receivefiledlg.ui | 74 ---------- 29 files changed, 1349 deletions(-) delete mode 100644 src/client/clienttransfer.cpp delete mode 100644 src/client/clienttransfer.h delete mode 100644 src/client/clienttransfermanager.cpp delete mode 100644 src/client/clienttransfermanager.h delete mode 100644 src/common/transfer.cpp delete mode 100644 src/common/transfer.h delete mode 100644 src/common/transfermanager.cpp delete mode 100644 src/common/transfermanager.h delete mode 100644 src/core/coretransfer.cpp delete mode 100644 src/core/coretransfer.h delete mode 100644 src/core/coretransfermanager.cpp delete mode 100644 src/core/coretransfermanager.h delete mode 100644 src/qtui/receivefiledlg.cpp delete mode 100644 src/qtui/receivefiledlg.h delete mode 100644 src/qtui/ui/receivefiledlg.ui diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index c7b3ee30..3377771d 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -33,8 +33,6 @@ set(SOURCES clientignorelistmanager.cpp clientirclisthelper.cpp clientsettings.cpp - clienttransfer.cpp - clienttransfermanager.cpp clientuserinputhandler.cpp coreaccount.cpp coreaccountmodel.cpp @@ -62,8 +60,6 @@ set(MOC_HDRS clientidentity.h clientignorelistmanager.h clientirclisthelper.h - clienttransfer.h - clienttransfermanager.h clientuserinputhandler.h coreaccountmodel.h coreconnection.h diff --git a/src/client/client.cpp b/src/client/client.cpp index 9ef23efb..1b32f53c 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -34,7 +34,6 @@ #include "clientirclisthelper.h" #include "clientidentity.h" #include "clientignorelistmanager.h" -#include "clienttransfermanager.h" #include "clientuserinputhandler.h" #include "coreaccountmodel.h" #include "coreconnection.h" @@ -103,7 +102,6 @@ Client::Client(QObject *parent) _inputHandler(0), _networkConfig(0), _ignoreListManager(0), - _transferManager(0), _messageModel(0), _messageProcessor(0), _coreAccountModel(new CoreAccountModel(this)), @@ -406,10 +404,6 @@ void Client::setSyncedToCore() _ignoreListManager = new ClientIgnoreListManager(this); signalProxy()->synchronize(ignoreListManager()); - Q_ASSERT(!_transferManager); - _transferManager = new ClientTransferManager(this); - signalProxy()->synchronize(transferManager()); - // trigger backlog request once all active bufferviews are initialized connect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog())); @@ -479,12 +473,6 @@ void Client::setDisconnectedFromCore() _ignoreListManager->deleteLater(); _ignoreListManager = 0; } - - if (_transferManager) { - _transferManager->deleteLater(); - _transferManager = 0; - } - // we probably don't want to save pending input for reconnect _userInputBuffer.clear(); diff --git a/src/client/client.h b/src/client/client.h index e3aacd04..9968bd15 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -49,7 +49,6 @@ class ClientBacklogManager; class ClientBufferViewManager; class ClientIgnoreListManager; class ClientIrcListHelper; -class ClientTransferManager; class ClientUserInputHandler; class CoreAccountModel; class CoreConnection; @@ -57,7 +56,6 @@ class IrcUser; class IrcChannel; class NetworkConfig; class SignalProxy; - struct NetworkInfo; class Client : public QObject @@ -119,7 +117,6 @@ public: static inline ClientUserInputHandler *inputHandler() { return instance()->_inputHandler; } static inline NetworkConfig *networkConfig() { return instance()->_networkConfig; } static inline ClientIgnoreListManager *ignoreListManager() { return instance()->_ignoreListManager; } - static inline ClientTransferManager *transferManager() { return instance()->_transferManager; } static inline CoreAccountModel *coreAccountModel() { return instance()->_coreAccountModel; } static inline CoreConnection *coreConnection() { return instance()->_coreConnection; } @@ -237,7 +234,6 @@ private: ClientUserInputHandler *_inputHandler; NetworkConfig *_networkConfig; ClientIgnoreListManager *_ignoreListManager; - ClientTransferManager *_transferManager; MessageModel *_messageModel; AbstractMessageProcessor *_messageProcessor; diff --git a/src/client/clienttransfer.cpp b/src/client/clienttransfer.cpp deleted file mode 100644 index 9f70e637..00000000 --- a/src/client/clienttransfer.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include - -#include "clienttransfer.h" - -INIT_SYNCABLE_OBJECT(ClientTransfer) -ClientTransfer::ClientTransfer(const QUuid &uuid, QObject *parent) - : Transfer(uuid, parent), - _file(0) -{ - connect(this, SIGNAL(stateChanged(State)), SLOT(onStateChanged(State))); -} - - -void ClientTransfer::cleanUp() -{ - if (_file) { - _file->close(); - _file->deleteLater(); - _file = 0; - } -} - - -QString ClientTransfer::savePath() const -{ - return _savePath; -} - - -void ClientTransfer::accept(const QString &savePath) const -{ - _savePath = savePath; - PeerPtr ptr = 0; - REQUEST_OTHER(requestAccepted, ARG(ptr)); - emit accepted(); -} - - -void ClientTransfer::reject() const -{ - PeerPtr ptr = 0; - REQUEST_OTHER(requestRejected, ARG(ptr)); - emit rejected(); -} - - -void ClientTransfer::dataReceived(PeerPtr, const QByteArray &data) -{ - // TODO: proper error handling (relay to core) - if (!_file) { - _file = new QFile(_savePath, this); - if (!_file->open(QFile::WriteOnly|QFile::Truncate)) { - qWarning() << Q_FUNC_INFO << "Could not open file:" << _file->errorString(); - return; - } - } - - if (!_file->isOpen()) - return; - - if (_file->write(data) < 0) { - qWarning() << Q_FUNC_INFO << "Could not write to file:" << _file->errorString(); - return; - } -} - - -void ClientTransfer::onStateChanged(Transfer::State state) -{ - switch(state) { - case Completed: - if (_file) - _file->close(); - break; - case Failed: - if (_file) - _file->remove(); - break; - default: - ; - } -} diff --git a/src/client/clienttransfer.h b/src/client/clienttransfer.h deleted file mode 100644 index 9753f41b..00000000 --- a/src/client/clienttransfer.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef CLIENTTRANSFER_H -#define CLIENTTRANSFER_H - -#include - -#include "transfer.h" - -class QFile; - -class ClientTransfer : public Transfer -{ - Q_OBJECT - SYNCABLE_OBJECT - -public: - ClientTransfer(const QUuid &uuid, QObject *parent = 0); - - QString savePath() const; - -public slots: - // called on the client side - void accept(const QString &savePath) const; - void reject() const; - -private slots: - void dataReceived(PeerPtr peer, const QByteArray &data); - void onStateChanged(State state); - -private: - virtual void cleanUp(); - - mutable QString _savePath; - - QFile *_file; -}; - -#endif diff --git a/src/client/clienttransfermanager.cpp b/src/client/clienttransfermanager.cpp deleted file mode 100644 index 1860e481..00000000 --- a/src/client/clienttransfermanager.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "clienttransfermanager.h" - -#include "client.h" -#include "clienttransfer.h" - - -INIT_SYNCABLE_OBJECT(ClientTransferManager) -ClientTransferManager::ClientTransferManager(QObject *parent) - : TransferManager(parent) -{ - connect(this, SIGNAL(transferAdded(const Transfer*)), SLOT(onTransferAdded(const Transfer*))); -} - - -const ClientTransfer *ClientTransferManager::transfer(const QUuid &uuid) const -{ - return qobject_cast(transfer_(uuid)); -} - - -void ClientTransferManager::onCoreTransferAdded(const QUuid &uuid) -{ - if (uuid.isNull()) { - qWarning() << Q_FUNC_INFO << "Invalid transfer uuid" << uuid.toString(); - return; - } - - ClientTransfer *transfer = new ClientTransfer(uuid, this); - connect(transfer, SIGNAL(initDone()), SLOT(onTransferInitDone())); // we only want to add initialized transfers - Client::signalProxy()->synchronize(transfer); -} - - -void ClientTransferManager::onTransferInitDone() -{ - Transfer *transfer = qobject_cast(sender()); - Q_ASSERT(transfer); - addTransfer(transfer); -} - - -void ClientTransferManager::onTransferAdded(const Transfer *transfer) -{ - const ClientTransfer *t = qobject_cast(transfer); - if (!t) { - qWarning() << "Invalid Transfer added to ClientTransferManager!"; - return; - } - - emit transferAdded(t); -} diff --git a/src/client/clienttransfermanager.h b/src/client/clienttransfermanager.h deleted file mode 100644 index 9004d3bb..00000000 --- a/src/client/clienttransfermanager.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef CLIENTTRANSFERMANAGER_H -#define CLIENTTRANSFERMANAGER_H - -#include "transfermanager.h" - -#include - -class ClientTransfer; - -class ClientTransferManager : public TransferManager -{ - Q_OBJECT - SYNCABLE_OBJECT - -public: - ClientTransferManager(QObject *parent = 0); - - const ClientTransfer *transfer(const QUuid &uuid) const; - -public slots: - void onCoreTransferAdded(const QUuid &uuid); - void onTransferInitDone(); - -signals: - void transferAdded(const ClientTransfer *transfer); - -private slots: - void onTransferAdded(const Transfer *transfer); - -}; - -#endif diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 87a08d27..4e835cdf 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -37,8 +37,6 @@ set(SOURCES settings.cpp signalproxy.cpp syncableobject.cpp - transfer.cpp - transfermanager.cpp util.cpp protocols/datastream/datastreampeer.cpp @@ -69,8 +67,6 @@ set(MOC_HDRS settings.h signalproxy.h syncableobject.h - transfer.h - transfermanager.h protocols/datastream/datastreampeer.h protocols/legacy/legacypeer.h diff --git a/src/common/main.cpp b/src/common/main.cpp index 2036194c..b026d47a 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -118,7 +118,6 @@ int main(int argc, char **argv) #ifdef HAVE_SSL cliParser->addSwitch("require-ssl", 0, "Require SSL for client connections"); #endif - cliParser->addSwitch("enable-experimental-dcc", 0, "Enable highly experimental and unfinished support for CTCP DCC (DANGEROUS)"); #endif #ifdef HAVE_KDE diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 23202a7a..13567d38 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include "bufferinfo.h" #include "identity.h" @@ -190,7 +189,6 @@ void Quassel::registerMetaTypes() qRegisterMetaType("MsgId"); qRegisterMetaType("QHostAddress"); - qRegisterMetaType("QUuid"); qRegisterMetaTypeStreamOperators("IdentityId"); qRegisterMetaTypeStreamOperators("BufferId"); diff --git a/src/common/transfer.cpp b/src/common/transfer.cpp deleted file mode 100644 index 60375137..00000000 --- a/src/common/transfer.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "transfer.h" - -INIT_SYNCABLE_OBJECT(Transfer) -Transfer::Transfer(const QUuid &uuid, QObject *parent) - : SyncableObject(parent), - _state(New), - _direction(Receive), - _port(0), - _fileSize(0), - _uuid(uuid) -{ - init(); -} - -Transfer::Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent) - : SyncableObject(parent), - _state(New), - _direction(direction), - _fileName(fileName), - _address(address), - _port(port), - _fileSize(fileSize), - _nick(nick), - _uuid(QUuid::createUuid()) -{ - init(); -} - - -void Transfer::init() -{ - renameObject(QString("Transfer/%1").arg(_uuid.toString())); - setAllowClientUpdates(true); -} - - -QUuid Transfer::uuid() const -{ - return _uuid; -} - - -Transfer::State Transfer::state() const -{ - return _state; -} - - -void Transfer::setState(Transfer::State state) -{ - if (_state != state) { - _state = state; - SYNC(ARG(state)); - emit stateChanged(state); - } -} - - - -Transfer::Direction Transfer::direction() const -{ - return _direction; -} - - -void Transfer::setDirection(Transfer::Direction direction) -{ - if (_direction != direction) { - _direction = direction; - SYNC(ARG(direction)); - emit directionChanged(direction); - } -} - - -QHostAddress Transfer::address() const -{ - return _address; -} - - -void Transfer::setAddress(const QHostAddress &address) -{ - if (_address != address) { - _address = address; - SYNC(ARG(address)); - emit addressChanged(address); - } -} - - -quint16 Transfer::port() const -{ - return _port; -} - - -void Transfer::setPort(quint16 port) -{ - if (_port != port) { - _port = port; - SYNC(ARG(port)); - emit portChanged(port); - } -} - - -QString Transfer::fileName() const -{ - return _fileName; -} - - -void Transfer::setFileName(const QString &fileName) -{ - if (_fileName != fileName) { - _fileName = fileName; - SYNC(ARG(fileName)); - emit fileNameChanged(fileName); - } -} - - -quint64 Transfer::fileSize() const -{ - return _fileSize; -} - - -void Transfer::setFileSize(quint64 fileSize) -{ - if (_fileSize != fileSize) { - _fileSize = fileSize; - SYNC(ARG(fileSize)); - emit fileSizeChanged(fileSize); - } -} - - -QString Transfer::nick() const -{ - return _nick; -} - - -void Transfer::setNick(const QString &nick) -{ - if (_nick != nick) { - _nick = nick; - SYNC(ARG(nick)); - emit nickChanged(nick); - } -} - - -void Transfer::setError(const QString &errorString) -{ - qWarning() << Q_FUNC_INFO << errorString; - emit error(errorString); - setState(Failed); - cleanUp(); -} diff --git a/src/common/transfer.h b/src/common/transfer.h deleted file mode 100644 index 31421cdf..00000000 --- a/src/common/transfer.h +++ /dev/null @@ -1,129 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef TRANSFER_H -#define TRANSFER_H - -#include -#include - -#include "syncableobject.h" -#include "types.h" - -class Transfer : public SyncableObject -{ - Q_OBJECT - SYNCABLE_OBJECT - - Q_PROPERTY(QUuid uuid READ uuid); - Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged); - Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged); - Q_PROPERTY(QHostAddress address READ address WRITE setAddress NOTIFY addressChanged); - Q_PROPERTY(quint16 port READ port WRITE setPort NOTIFY portChanged); - Q_PROPERTY(QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged); - Q_PROPERTY(quint64 fileSize READ fileSize WRITE setFileSize NOTIFY fileSizeChanged); - Q_PROPERTY(QString nick READ nick WRITE setNick NOTIFY nickChanged); - -public: - enum State { - New, - Pending, - Connecting, - Transferring, - Paused, - Completed, - Failed, - Rejected - }; - Q_ENUMS(State) - - enum Direction { - Send, - Receive - }; - Q_ENUMS(Direction) - - Transfer(const QUuid &uuid, QObject *parent = 0); // for creating a syncable object client-side - Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0); - inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; } - - QUuid uuid() const; - State state() const; - Direction direction() const; - QString fileName() const; - QHostAddress address() const; - quint16 port() const; - quint64 fileSize() const; - QString nick() const; - -public slots: - // called on the client side - virtual void accept(const QString &savePath) const { Q_UNUSED(savePath); } - virtual void reject() const {} - - // called on the core side through sync calls - virtual void requestAccepted(PeerPtr peer) { Q_UNUSED(peer); } - virtual void requestRejected(PeerPtr peer) { Q_UNUSED(peer); } - -signals: - void stateChanged(State state); - void directionChanged(Direction direction); - void addressChanged(const QHostAddress &address); - void portChanged(quint16 port); - void fileNameChanged(const QString &fileName); - void fileSizeChanged(quint64 fileSize); - void nickChanged(const QString &nick); - - void error(const QString &errorString); - - void accepted(PeerPtr peer = 0) const; - void rejected(PeerPtr peer = 0) const; - -protected slots: - void setState(State state); - void setError(const QString &errorString); - - // called on the client side through sync calls - virtual void dataReceived(PeerPtr, const QByteArray &data) { Q_UNUSED(data); } - - virtual void cleanUp() = 0; - -private: - void init(); - - void setDirection(Direction direction); - void setAddress(const QHostAddress &address); - void setPort(quint16 port); - void setFileName(const QString &fileName); - void setFileSize(quint64 fileSize); - void setNick(const QString &nick); - - - State _state; - Direction _direction; - QString _fileName; - QHostAddress _address; - quint16 _port; - quint64 _fileSize; - QString _nick; - QUuid _uuid; -}; - -#endif diff --git a/src/common/transfermanager.cpp b/src/common/transfermanager.cpp deleted file mode 100644 index 257f4b28..00000000 --- a/src/common/transfermanager.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "transfermanager.h" - -#include "transfer.h" - - -INIT_SYNCABLE_OBJECT(TransferManager) -TransferManager::TransferManager(QObject *parent) - : SyncableObject(parent) -{ - -} - - -Transfer *TransferManager::transfer_(const QUuid &uuid) const -{ - return _transfers.value(uuid, 0); -} - - -QList TransferManager::transferIds() const -{ - return _transfers.keys(); -} - - -void TransferManager::addTransfer(Transfer *transfer) -{ - QUuid uuid = transfer->uuid(); - if (_transfers.contains(uuid)) { - qWarning() << "Cannot add the same file transfer twice!"; - transfer->deleteLater(); - return; - } - transfer->setParent(this); - _transfers[uuid] = transfer; - - SYNC_OTHER(onCoreTransferAdded, ARG(uuid)); - emit transferAdded(transfer); -} diff --git a/src/common/transfermanager.h b/src/common/transfermanager.h deleted file mode 100644 index d2a888bb..00000000 --- a/src/common/transfermanager.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef TRANSFERMANAGER_H -#define TRANSFERMANAGER_H - -#include "syncableobject.h" - -#include - -class Transfer; - -class TransferManager : public SyncableObject -{ - Q_OBJECT - SYNCABLE_OBJECT - -public: - TransferManager(QObject *parent = 0); - inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; } - - QList transferIds() const; - -signals: - void transferAdded(const Transfer *transfer); - -protected: - Transfer *transfer_(const QUuid &uuid) const; - void addTransfer(Transfer *transfer); - -protected slots: - virtual void onCoreTransferAdded(const QUuid &uuid) { Q_UNUSED(uuid) }; - -private: - QHash _transfers; - -}; - -#endif diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index dfb02893..42dac8f7 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -24,8 +24,6 @@ set(SOURCES coresession.cpp coresessioneventprocessor.cpp coresettings.cpp - coretransfer.cpp - coretransfermanager.cpp coreuserinputhandler.cpp coreusersettings.cpp ctcpparser.cpp @@ -60,8 +58,6 @@ set(MOC_HDRS corenetworkconfig.h coresession.h coresessioneventprocessor.h - coretransfer.h - coretransfermanager.h coreuserinputhandler.h ctcpparser.h eventstringifier.h diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index d28ddfba..bd09d439 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -34,7 +34,6 @@ #include "corenetwork.h" #include "corenetworkconfig.h" #include "coresessioneventprocessor.h" -#include "coretransfermanager.h" #include "coreusersettings.h" #include "ctcpparser.h" #include "eventstringifier.h" @@ -67,7 +66,6 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _ircListHelper(new CoreIrcListHelper(this)), _networkConfig(new CoreNetworkConfig("GlobalNetworkConfig", this)), _coreInfo(this), - _transferManager(new CoreTransferManager(this)), _eventManager(new CoreEventManager(this)), _eventStringifier(new EventStringifier(this)), _sessionEventProcessor(new CoreSessionEventProcessor(this)), @@ -122,7 +120,6 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->synchronize(networkConfig()); p->synchronize(&_coreInfo); p->synchronize(&_ignoreListManager); - p->synchronize(transferManager()); // Restore session state if (restoreState) restoreSessionState(); diff --git a/src/core/coresession.h b/src/core/coresession.h index ade372a3..810d772f 100644 --- a/src/core/coresession.h +++ b/src/core/coresession.h @@ -39,7 +39,6 @@ class CoreIrcListHelper; class CoreNetwork; class CoreNetworkConfig; class CoreSessionEventProcessor; -class CoreTransferManager; class CtcpParser; class EventManager; class EventStringifier; @@ -86,8 +85,6 @@ public: inline CoreIrcListHelper *ircListHelper() const { return _ircListHelper; } inline CoreIgnoreListManager *ignoreListManager() { return &_ignoreListManager; } - inline CoreTransferManager *transferManager() const { return _transferManager; } - // void attachNetworkConnection(NetworkConnection *conn); //! Return necessary data for restoring the session after restarting the core @@ -202,7 +199,6 @@ private: CoreIrcListHelper *_ircListHelper; CoreNetworkConfig *_networkConfig; CoreCoreInfo _coreInfo; - CoreTransferManager *_transferManager; EventManager *_eventManager; EventStringifier *_eventStringifier; // should eventually move into client diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index 9a00537e..e31c20db 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -23,12 +23,9 @@ #include "coreirclisthelper.h" #include "corenetwork.h" #include "coresession.h" -#include "coretransfer.h" -#include "coretransfermanager.h" #include "ctcpevent.h" #include "ircevent.h" #include "ircuser.h" -#include "logger.h" #include "messageevent.h" #include "netsplit.h" #include "quassel.h" @@ -1017,67 +1014,6 @@ void CoreSessionEventProcessor::handleCtcpClientinfo(CtcpEvent *e) } -// http://www.irchelp.org/irchelp/rfc/ctcpspec.html -// http://en.wikipedia.org/wiki/Direct_Client-to-Client -void CoreSessionEventProcessor::handleCtcpDcc(CtcpEvent *e) -{ - // DCC support is unfinished, experimental and potentially dangerous, so make it opt-in - if (!Quassel::isOptionSet("enable-experimental-dcc")) { - quInfo() << "DCC disabled, start core with --enable-experimental-dcc if you really want to try it out"; - return; - } - - // normal: SEND [] - // reverse: SEND 0 - QStringList params = e->param().split(' '); - if (params.count()) { - QString cmd = params[0].toUpper(); - if (cmd == "SEND") { - if (params.count() < 4) { - qWarning() << "Invalid DCC SEND request:" << e; // TODO emit proper error to client - return; - } - QString filename = params[1]; - QHostAddress address; - quint16 port = params[3].toUShort(); - quint64 size = 0; - QString numIp = params[2]; // this is either IPv4 as a 32 bit value, or IPv6 (which always contains a colon) - if (numIp.contains(':')) { // IPv6 - if (!address.setAddress(numIp)) { - qWarning() << "Invalid IPv6:" << numIp; - return; - } - } - else { - address.setAddress(numIp.toUInt()); - } - - if (port == 0) { // Reverse DCC is indicated by a 0 port - emit newEvent(new MessageEvent(Message::Error, e->network(), tr("Reverse DCC SEND not supported"), e->prefix(), e->target(), Message::None, e->timestamp())); - return; - } - if (port < 1024) { - qWarning() << "Privileged port requested:" << port; // FIXME ask user if this is ok - } - - - if (params.count() > 4) { // filesize is optional - size = params[4].toULong(); - } - - // TODO: check if target is the right thing to use for the partner - CoreTransfer *transfer = new CoreTransfer(Transfer::Receive, e->target(), filename, address, port, size, this); - coreSession()->signalProxy()->synchronize(transfer); - coreSession()->transferManager()->addTransfer(transfer); - } - else { - emit newEvent(new MessageEvent(Message::Error, e->network(), tr("DCC %1 not supported").arg(cmd), e->prefix(), e->target(), Message::None, e->timestamp())); - return; - } - } -} - - void CoreSessionEventProcessor::handleCtcpPing(CtcpEvent *e) { e->setReply(e->param().isNull() ? "" : e->param()); diff --git a/src/core/coresessioneventprocessor.h b/src/core/coresessioneventprocessor.h index 47acf086..6854d18b 100644 --- a/src/core/coresessioneventprocessor.h +++ b/src/core/coresessioneventprocessor.h @@ -97,7 +97,6 @@ public: Q_INVOKABLE void handleCtcpAction(CtcpEvent *event); Q_INVOKABLE void handleCtcpClientinfo(CtcpEvent *event); - Q_INVOKABLE void handleCtcpDcc(CtcpEvent *event); Q_INVOKABLE void handleCtcpPing(CtcpEvent *event); Q_INVOKABLE void handleCtcpTime(CtcpEvent *event); Q_INVOKABLE void handleCtcpVersion(CtcpEvent *event); diff --git a/src/core/coretransfer.cpp b/src/core/coretransfer.cpp deleted file mode 100644 index 830c1514..00000000 --- a/src/core/coretransfer.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include - -#include -#include - -#include "coretransfer.h" - -const qint64 chunkSize = 16 * 1024; - -INIT_SYNCABLE_OBJECT(CoreTransfer) - -CoreTransfer::CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent) - : Transfer(direction, nick, fileName, address, port, fileSize, parent), - _socket(0), - _pos(0), - _reading(false) -{ - -} - - -void CoreTransfer::cleanUp() -{ - if (_socket) { - _socket->close(); - _socket->deleteLater(); - _socket = 0; - } - - _buffer.clear(); - _reading = false; -} - - -void CoreTransfer::onSocketDisconnected() -{ - if (state() == Connecting || state() == Transferring) { - setError(tr("Socket closed while still transferring!")); - } - else - cleanUp(); -} - - -void CoreTransfer::onSocketError(QAbstractSocket::SocketError error) -{ - Q_UNUSED(error) - - if (state() == Connecting || state() == Transferring) { - setError(tr("DCC connection error: %1").arg(_socket->errorString())); - } -} - - -void CoreTransfer::requestAccepted(PeerPtr peer) -{ - if (_peer || !peer || state() != New) - return; // transfer was already accepted - - _peer = peer; - setState(Pending); - - emit accepted(peer); - - // FIXME temporary until we have queueing - start(); -} - - -void CoreTransfer::requestRejected(PeerPtr peer) -{ - if (_peer || state() != New) - return; - - _peer = peer; - setState(Rejected); - - emit rejected(peer); -} - - -void CoreTransfer::start() -{ - if (!_peer || state() != Pending || direction() != Receive) - return; - - setupConnectionForReceive(); -} - - -void CoreTransfer::setupConnectionForReceive() -{ - if (port() == 0) { - setError(tr("Reverse DCC not supported yet!")); - return; - } - - setState(Connecting); - - _socket = new QTcpSocket(this); - connect(_socket, SIGNAL(connected()), SLOT(startReceiving())); - connect(_socket, SIGNAL(disconnected()), SLOT(onSocketDisconnected())); - connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); - connect(_socket, SIGNAL(readyRead()), SLOT(onDataReceived())); - - _socket->connectToHost(address(), port()); -} - - -void CoreTransfer::startReceiving() -{ - setState(Transferring); -} - - -void CoreTransfer::onDataReceived() -{ - if (_reading) // since we're spinning the event loop, we may get another readyRead() and thus reentrancy - return; - _reading = true; - - while (_socket->bytesAvailable()) { - QByteArray data = _socket->read(chunkSize); - _pos += data.size(); - if (!relayData(data, true)) - return; - - QCoreApplication::processEvents(); // don't block the rest of the core/client communication - if (!_socket) // just in case something happened during spinning the event loop that killed our socket - return; - } - - // Send ack to sender. The DCC protocol only specifies 32 bit values, but modern clients (i.e. those who can send files - // larger than 4 GB) will ignore this anyway... - quint32 ack = qToBigEndian((quint32)_pos);// qDebug() << Q_FUNC_INFO << _pos; - _socket->write((char *)&ack, 4); - - if (_pos > fileSize()) { - qWarning() << "DCC Receive: Got more data than expected!"; - setError(tr("DCC Receive: Got more data than expected!")); - } - else if (_pos == fileSize()) { - qDebug() << "DCC Receive: Transfer finished"; - if (relayData(QByteArray(), false)) // empty buffer - setState(Completed); - } - - _reading = false; -} - - -bool CoreTransfer::relayData(const QByteArray &data, bool requireChunkSize) -{ - // safeguard against a disconnecting quasselclient - if (!_peer) { - setError(tr("DCC Receive: Quassel Client disconnected during transfer!")); - return false; - } - _buffer.append(data); - - // we only want to send data to the client once we have reached the chunksize - if (_buffer.size() > 0 && (_buffer.size() >= chunkSize || !requireChunkSize)) { - SYNC_OTHER(dataReceived, ARG(_peer), ARG(_buffer)); - _buffer.clear(); - } - - return true; -} diff --git a/src/core/coretransfer.h b/src/core/coretransfer.h deleted file mode 100644 index 85248e61..00000000 --- a/src/core/coretransfer.h +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef CORETRANSFER_H -#define CORETRANSFER_H - -#include - -#include "transfer.h" -#include "peer.h" - -class QTcpSocket; - -class CoreTransfer : public Transfer -{ - Q_OBJECT - SYNCABLE_OBJECT - -public: - CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0); - -public slots: - void start(); - - // called through sync calls - void requestAccepted(PeerPtr peer); - void requestRejected(PeerPtr peer); - -private slots: - void startReceiving(); - void onDataReceived(); - void onSocketDisconnected(); - void onSocketError(QAbstractSocket::SocketError error); - -private: - void setupConnectionForReceive(); - bool relayData(const QByteArray &data, bool requireChunkSize); - virtual void cleanUp(); - - QPointer _peer; - QTcpSocket *_socket; - quint64 _pos; - QByteArray _buffer; - bool _reading; -}; - -#endif diff --git a/src/core/coretransfermanager.cpp b/src/core/coretransfermanager.cpp deleted file mode 100644 index c8f79dda..00000000 --- a/src/core/coretransfermanager.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "coretransfermanager.h" - -#include "coretransfer.h" - -INIT_SYNCABLE_OBJECT(CoreTransferManager) -CoreTransferManager::CoreTransferManager(QObject *parent) - : TransferManager(parent) -{ - connect(this, SIGNAL(transferAdded(const Transfer*)), SLOT(onTransferAdded(const Transfer*))); -} - - -CoreTransfer *CoreTransferManager::transfer(const QUuid &uuid) const -{ - return qobject_cast(transfer_(uuid)); -} - - -void CoreTransferManager::addTransfer(CoreTransfer *transfer) -{ - TransferManager::addTransfer(transfer); -} - - -void CoreTransferManager::onTransferAdded(const Transfer *transfer) -{ - // for core-side use, publishing a non-const pointer is ok - CoreTransfer *t = const_cast(qobject_cast(transfer)); - if (!t) { - qWarning() << "Invalid Transfer added to CoreTransferManager!"; - return; - } - - emit transferAdded(t); -} diff --git a/src/core/coretransfermanager.h b/src/core/coretransfermanager.h deleted file mode 100644 index a01e285d..00000000 --- a/src/core/coretransfermanager.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef CORETRANSFERMANAGER_H -#define CORETRANSFERMANAGER_H - -#include "transfermanager.h" -#include "types.h" - -class CoreTransfer; - -class CoreTransferManager : public TransferManager -{ - Q_OBJECT - SYNCABLE_OBJECT - -public: - CoreTransferManager(QObject *parent = 0); - - CoreTransfer *transfer(const QUuid &uuid) const; - -public slots: - void addTransfer(CoreTransfer *transfer); - -signals: - void transferAdded(CoreTransfer *transfer); - -private slots: - void onTransferAdded(const Transfer *transfer); - -}; - -#endif diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt index e649d15f..6cb6cdb5 100644 --- a/src/qtui/CMakeLists.txt +++ b/src/qtui/CMakeLists.txt @@ -55,7 +55,6 @@ set(SOURCES qtuimessageprocessor.cpp qtuisettings.cpp qtuistyle.cpp - receivefiledlg.cpp settingsdlg.cpp settingspagedlg.cpp simplenetworkeditor.cpp @@ -102,7 +101,6 @@ set(MOC_HDRS qtuiapplication.h qtuimessageprocessor.h qtuistyle.h - receivefiledlg.h settingsdlg.h settingspagedlg.h simplenetworkeditor.h @@ -142,7 +140,6 @@ set(FORMS settingsdlg.ui settingspagedlg.ui simplenetworkeditor.ui - receivefiledlg.ui topicwidget.ui) if(HAVE_KDE) diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 1399113c..8e0172d1 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -62,8 +62,6 @@ #include "clientbufferviewconfig.h" #include "clientbufferviewmanager.h" #include "clientignorelistmanager.h" -#include "clienttransfer.h" -#include "clienttransfermanager.h" #include "coreconfigwizard.h" #include "coreconnectdlg.h" #include "coreconnection.h" @@ -85,7 +83,6 @@ #include "qtuimessageprocessor.h" #include "qtuisettings.h" #include "qtuistyle.h" -#include "receivefiledlg.h" #include "settingsdlg.h" #include "settingspagedlg.h" #include "statusnotifieritem.h" @@ -1041,8 +1038,6 @@ void MainWin::connectedToCore() connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int))); connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout())); - connect(Client::transferManager(), SIGNAL(transferAdded(const ClientTransfer*)), SLOT(showNewTransferDlg(const ClientTransfer*))); - setConnectedState(); } @@ -1379,13 +1374,6 @@ void MainWin::showShortcutsDlg() } -void MainWin::showNewTransferDlg(const ClientTransfer *transfer) -{ - ReceiveFileDlg *dlg = new ReceiveFileDlg(transfer, this); - dlg->show(); -} - - void MainWin::onFullScreenToggled() { // Relying on QWidget::isFullScreen is discouraged, see the KToggleFullScreenAction docs diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 49e4cef4..e1ff7ea6 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -36,7 +36,6 @@ class BufferHotListFilter; class BufferView; class BufferViewConfig; class ClientBufferViewConfig; -class ClientTransfer; class CoreAccount; class CoreConnectionStatusWidget; class BufferViewDock; @@ -123,7 +122,6 @@ private slots: void showNotificationsDlg(); void showIgnoreList(QString newRule = QString()); void showShortcutsDlg(); - void showNewTransferDlg(const ClientTransfer *transfer); void onFullScreenToggled(); void handleCoreConnectionError(const QString &errorMsg); diff --git a/src/qtui/receivefiledlg.cpp b/src/qtui/receivefiledlg.cpp deleted file mode 100644 index 3c09f837..00000000 --- a/src/qtui/receivefiledlg.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include -#include - -#include "receivefiledlg.h" - -#include "transfer.h" - -ReceiveFileDlg::ReceiveFileDlg(const Transfer *transfer, QWidget *parent) - : QDialog(parent), - _transfer(transfer) -{ - setAttribute(Qt::WA_DeleteOnClose); - ui.setupUi(this); - - QString label = tr("%1 wants to send you a file:
%2 (%3 bytes)").arg(transfer->nick(), transfer->fileName()).arg(transfer->fileSize()); - ui.infoText->setText(label); -} - - -void ReceiveFileDlg::on_buttonBox_clicked(QAbstractButton *button) -{ - if (ui.buttonBox->standardButton(button) == QDialogButtonBox::Save) { - QString name = QFileDialog::getSaveFileName(this, QString(), QDir::currentPath() + "/" + _transfer->fileName()); - _transfer->accept(name); - } - -} diff --git a/src/qtui/receivefiledlg.h b/src/qtui/receivefiledlg.h deleted file mode 100644 index 99aa649b..00000000 --- a/src/qtui/receivefiledlg.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef RECEIVEFILEDLG_H -#define RECEIVEFILEDLG_H - -#include "ui_receivefiledlg.h" - -class Transfer; - -class ReceiveFileDlg : public QDialog -{ - Q_OBJECT - -public: - ReceiveFileDlg(const Transfer *transfer, QWidget *parent = 0); - -private slots: - void on_buttonBox_clicked(QAbstractButton *button); - -private: - Ui::ReceiveFileDlg ui; - const Transfer *_transfer; -}; - -#endif diff --git a/src/qtui/ui/receivefiledlg.ui b/src/qtui/ui/receivefiledlg.ui deleted file mode 100644 index 6cc7a4ec..00000000 --- a/src/qtui/ui/receivefiledlg.ui +++ /dev/null @@ -1,74 +0,0 @@ - - - ReceiveFileDlg - - - - 0 - 0 - 354 - 97 - - - - Incoming File Transfer - - - - - - Someone is trying to send you a file. - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Discard|QDialogButtonBox::Ignore|QDialogButtonBox::Save - - - - - - - - - buttonBox - accepted() - ReceiveFileDlg - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - ReceiveFileDlg - reject() - - - 316 - 260 - - - 286 - 274 - - - - - -- 2.20.1