X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Ftransfer.cpp;h=4d71fc1df6bf66df21b8cf1b2e15d2897b9c4e2e;hp=bba0c431326ce9c38f7fb7ee738c74b4ba2acff1;hb=e3c42d072b2b8f39c8c9ea44dfc3bded87ae43b0;hpb=234d1cbd0d5b83602df964251ced84ec5ed4f371;ds=sidebyside diff --git a/src/common/transfer.cpp b/src/common/transfer.cpp index bba0c431..4d71fc1d 100644 --- a/src/common/transfer.cpp +++ b/src/common/transfer.cpp @@ -29,7 +29,7 @@ Transfer::Transfer(const QUuid &uuid, QObject *parent) _fileSize(0), _uuid(uuid) { - renameObject(QString("Transfer/%1").arg(_uuid.toString())); + init(); } Transfer::Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent) @@ -42,8 +42,15 @@ Transfer::Transfer(Direction direction, const QString &nick, const QString &file _fileSize(fileSize), _nick(nick), _uuid(QUuid::createUuid()) +{ + init(); +} + + +void Transfer::init() { renameObject(QString("Transfer/%1").arg(_uuid.toString())); + setAllowClientUpdates(true); } @@ -164,3 +171,12 @@ void Transfer::setNick(const QString &nick) emit nickChanged(nick); } } + + +void Transfer::setError(const QString &errorString) +{ + qWarning() << Q_FUNC_INFO << errorString; + emit error(errorString); + setState(Failed); + cleanUp(); +}