diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-13 10:00:26 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-13 16:06:13 +0100 |
commit | 633e5de268996306e444b37e05f703b4905a4ea9 (patch) | |
tree | 2632e4cba44eed8bae35d823ab762e0272fd0f3a /examples | |
parent | b81db5fa244ef2a1512907aca12e9574cc81a7f0 (diff) |
Don't leave UI hanging if NdefMessage handling returned invalid request
Invalid request implies that the platform doesn't support writing
of NDEF messages. This case does not trigger an error() signal though.
That's why we have to trigger the error handling code manually.
Change-Id: I0b95fddfe30052f1c7baa566ebc099998854146d
Reviewed-by: Martin Leutelt <martin.leutelt@basyskom.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/nfc/ndefeditor/mainwindow.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/nfc/ndefeditor/mainwindow.cpp b/examples/nfc/ndefeditor/mainwindow.cpp index 527ff6c7..fa0fa91f 100644 --- a/examples/nfc/ndefeditor/mainwindow.cpp +++ b/examples/nfc/ndefeditor/mainwindow.cpp @@ -235,6 +235,8 @@ void MainWindow::targetDetected(QNearFieldTarget *target) this, SLOT(targetError(QNearFieldTarget::Error,QNearFieldTarget::RequestId))); m_request = target->readNdefMessages(); + if (!m_request.isValid()) // cannot read messages + targetError(QNearFieldTarget::NdefReadError, m_request); break; case WriteNdef: connect(target, SIGNAL(ndefMessagesWritten()), this, SLOT(ndefMessageWritten())); @@ -242,6 +244,8 @@ void MainWindow::targetDetected(QNearFieldTarget *target) this, SLOT(targetError(QNearFieldTarget::Error,QNearFieldTarget::RequestId))); m_request = target->writeNdefMessages(QList<QNdefMessage>() << ndefMessage()); + if (!m_request.isValid()) // cannot write messages + targetError(QNearFieldTarget::NdefWriteError, m_request); break; } } |