From 8155679b01ec523d877bcb1d6d019b3b555befaa Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Thu, 10 Oct 2013 12:09:55 +0200 Subject: Improve handling of invalid Bt address by QBluetoothTransferManager Some minor unit test improvements Task-number: QTBUG-33801 Change-Id: Idc98bf8928ced0f9e01b24668edf7c32172d2fd1 Reviewed-by: Fabian Bumberger Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothtransferreply_bluez.cpp | 10 +++++++++- src/bluetooth/qbluetoothtransferreply_qnx.cpp | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src/bluetooth') diff --git a/src/bluetooth/qbluetoothtransferreply_bluez.cpp b/src/bluetooth/qbluetoothtransferreply_bluez.cpp index 3c63adeb..0634f080 100644 --- a/src/bluetooth/qbluetoothtransferreply_bluez.cpp +++ b/src/bluetooth/qbluetoothtransferreply_bluez.cpp @@ -110,13 +110,21 @@ bool QBluetoothTransferReplyBluez::start() } else { if (!file->exists()) { - m_errorStr = tr("File does not exist"); + m_errorStr = QBluetoothTransferReply::tr("File does not exist"); m_error = QBluetoothTransferReply::FileNotFoundError; m_finished = true; m_running = false; QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); return false; } + if (request().address().isNull()) { + m_errorStr = QBluetoothTransferReply::tr("Invalid target address"); + m_error = QBluetoothTransferReply::HostNotFoundError; + m_finished = true; + m_running = false; + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + return false; + } m_size = file->size(); startOPP(file->fileName()); } diff --git a/src/bluetooth/qbluetoothtransferreply_qnx.cpp b/src/bluetooth/qbluetoothtransferreply_qnx.cpp index e37852cd..b3425300 100644 --- a/src/bluetooth/qbluetoothtransferreply_qnx.cpp +++ b/src/bluetooth/qbluetoothtransferreply_qnx.cpp @@ -1,6 +1,7 @@ /*************************************************************************** ** ** Copyright (C) 2013 Research In Motion +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtBluetooth module of the Qt Toolkit. @@ -113,13 +114,21 @@ bool QBluetoothTransferReplyQnx::start() } else { if (!file->exists()) { - m_errorStr = tr("File does not exist"); + m_errorStr = QBluetoothTransferReply::tr("File does not exist"); m_error = QBluetoothTransferReply::FileNotFoundError; m_finished = true; m_running = false; QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); return false; } + if (request().address().isNull()) { + m_errorStr = QBluetoothTransferReply::tr("Invalid target address"); + m_error = QBluetoothTransferReply::HostNotFoundError; + m_finished = true; + m_running = false; + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + return false; + } startOPP(file->fileName()); } return true; -- cgit v1.2.3