diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2013-08-05 10:07:05 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-09 14:57:14 +0200 |
commit | 40158b4277984890a55d87fca4e44d86d9a936f7 (patch) | |
tree | 2ab827035abc8976c56c912f5cff960ec4f8faa4 /src | |
parent | f0e7da6dab3a19a9c978f2cbba2dea60fcea619b (diff) |
Improve QBluetoothTransferManager unit test
and fix some minor issues during the process.
Task-number: QTBUG-22017
Change-Id: Iff1adde28ba818c3ed0511cb5d45404f05d7c36f
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/qbluetoothtransfermanager_bluez.cpp | 5 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransfermanager_qnx.cpp | 5 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransferreply.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransferreply_bluez.cpp | 7 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransferreply_bluez_p.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransferreply_qnx.cpp | 7 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransferreply_qnx_p.h | 2 |
7 files changed, 14 insertions, 16 deletions
diff --git a/src/bluetooth/qbluetoothtransfermanager_bluez.cpp b/src/bluetooth/qbluetoothtransfermanager_bluez.cpp index 5bb0b956..c43aed81 100644 --- a/src/bluetooth/qbluetoothtransfermanager_bluez.cpp +++ b/src/bluetooth/qbluetoothtransfermanager_bluez.cpp @@ -49,11 +49,8 @@ QT_BEGIN_NAMESPACE_BLUETOOTH QBluetoothTransferReply *QBluetoothTransferManager::put(const QBluetoothTransferRequest &request, QIODevice *data) { - - QBluetoothTransferReplyBluez *rep = new QBluetoothTransferReplyBluez(data, request); - + QBluetoothTransferReplyBluez *rep = new QBluetoothTransferReplyBluez(data, request, this); connect(rep, SIGNAL(finished(QBluetoothTransferReply*)), this, SIGNAL(finished(QBluetoothTransferReply*))); - return rep; } diff --git a/src/bluetooth/qbluetoothtransfermanager_qnx.cpp b/src/bluetooth/qbluetoothtransfermanager_qnx.cpp index 26502fcc..1b9b9693 100644 --- a/src/bluetooth/qbluetoothtransfermanager_qnx.cpp +++ b/src/bluetooth/qbluetoothtransfermanager_qnx.cpp @@ -47,11 +47,8 @@ QT_BEGIN_NAMESPACE_BLUETOOTH QBluetoothTransferReply *QBluetoothTransferManager::put(const QBluetoothTransferRequest &request, QIODevice *data) { - - QBluetoothTransferReplyQnx *reply = new QBluetoothTransferReplyQnx(data, request); - + QBluetoothTransferReplyQnx *reply = new QBluetoothTransferReplyQnx(data, request, this); connect(reply, SIGNAL(finished(QBluetoothTransferReply*)), this, SIGNAL(finished(QBluetoothTransferReply*))); - return reply; } diff --git a/src/bluetooth/qbluetoothtransferreply.cpp b/src/bluetooth/qbluetoothtransferreply.cpp index d6bf4dba..a7c9c003 100644 --- a/src/bluetooth/qbluetoothtransferreply.cpp +++ b/src/bluetooth/qbluetoothtransferreply.cpp @@ -125,7 +125,7 @@ QBluetoothTransferReply::~QBluetoothTransferReply() /*! Returns the QBluetoothTransferManager that was used to create this QBluetoothTransferReply - object. + object. Initially, it is also the parent object. */ QBluetoothTransferManager *QBluetoothTransferReply::manager() const { diff --git a/src/bluetooth/qbluetoothtransferreply_bluez.cpp b/src/bluetooth/qbluetoothtransferreply_bluez.cpp index 159fdbcc..d5871b89 100644 --- a/src/bluetooth/qbluetoothtransferreply_bluez.cpp +++ b/src/bluetooth/qbluetoothtransferreply_bluez.cpp @@ -58,12 +58,13 @@ static const QLatin1String agentPath("/qt/agent"); QT_BEGIN_NAMESPACE_BLUETOOTH QBluetoothTransferReplyBluez::QBluetoothTransferReplyBluez(QIODevice *input, const QBluetoothTransferRequest &request, - QObject *parent) + QBluetoothTransferManager *parent) : QBluetoothTransferReply(parent), tempfile(0), source(input), m_running(false), m_finished(false), m_size(0), m_error(QBluetoothTransferReply::NoError), m_errorStr(), m_transfer_path() { setRequest(request); + setManager(parent); client = new OrgOpenobexClientInterface(QLatin1String("org.openobex.client"), QLatin1String("/"), QDBusConnection::sessionBus()); @@ -79,6 +80,7 @@ QBluetoothTransferReplyBluez::QBluetoothTransferReplyBluez(QIODevice *input, con qRegisterMetaType<QBluetoothTransferReply*>("QBluetoothTransferReply*"); QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection); + m_running = true; } /*! @@ -92,8 +94,7 @@ QBluetoothTransferReplyBluez::~QBluetoothTransferReplyBluez() bool QBluetoothTransferReplyBluez::start() { - m_running = true; - +// qDebug() << "Got a:" << source->metaObject()->className(); QFile *file = qobject_cast<QFile *>(source); if(!file){ diff --git a/src/bluetooth/qbluetoothtransferreply_bluez_p.h b/src/bluetooth/qbluetoothtransferreply_bluez_p.h index 941b024c..c476136f 100644 --- a/src/bluetooth/qbluetoothtransferreply_bluez_p.h +++ b/src/bluetooth/qbluetoothtransferreply_bluez_p.h @@ -62,7 +62,7 @@ class Q_BLUETOOTH_EXPORT QBluetoothTransferReplyBluez : public QBluetoothTransfe public: explicit QBluetoothTransferReplyBluez(QIODevice *input, const QBluetoothTransferRequest &request, - QObject *parent = 0); + QBluetoothTransferManager *parent = 0); ~QBluetoothTransferReplyBluez(); bool isFinished() const; diff --git a/src/bluetooth/qbluetoothtransferreply_qnx.cpp b/src/bluetooth/qbluetoothtransferreply_qnx.cpp index f2f60fcd..5124906b 100644 --- a/src/bluetooth/qbluetoothtransferreply_qnx.cpp +++ b/src/bluetooth/qbluetoothtransferreply_qnx.cpp @@ -61,11 +61,14 @@ QT_BEGIN_NAMESPACE_BLUETOOTH QBluetoothTransferReplyQnx::QBluetoothTransferReplyQnx(QIODevice *input, const QBluetoothTransferRequest &request, - QObject *parent) + QBluetoothTransferManager *parent) : QBluetoothTransferReply(parent), tempfile(0), source(input), m_running(false), m_finished(false), m_error(QBluetoothTransferReply::NoError), m_errorStr() { + setRequest(request); + setManager(parent); + ppsRegisterControl(); //qsrand(QTime::currentTime().msec()); //m_agent_path = agentPath; @@ -75,6 +78,7 @@ QBluetoothTransferReplyQnx::QBluetoothTransferReplyQnx(QIODevice *input, const Q ppsRegisterForEvent(QStringLiteral("opp_cancelled"), this); QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection); + m_running = true; } /*! @@ -87,7 +91,6 @@ QBluetoothTransferReplyQnx::~QBluetoothTransferReplyQnx() bool QBluetoothTransferReplyQnx::start() { - m_running = true; m_error = QBluetoothTransferReply::NoError; m_errorStr = QString(); diff --git a/src/bluetooth/qbluetoothtransferreply_qnx_p.h b/src/bluetooth/qbluetoothtransferreply_qnx_p.h index 5add8d6a..430ee4e6 100644 --- a/src/bluetooth/qbluetoothtransferreply_qnx_p.h +++ b/src/bluetooth/qbluetoothtransferreply_qnx_p.h @@ -63,7 +63,7 @@ class Q_BLUETOOTH_EXPORT QBluetoothTransferReplyQnx : public QBluetoothTransferR public: explicit QBluetoothTransferReplyQnx(QIODevice *input, const QBluetoothTransferRequest &request, - QObject *parent = 0); + QBluetoothTransferManager *parent = 0); ~QBluetoothTransferReplyQnx(); bool isFinished() const; |