summaryrefslogtreecommitdiffstats
path: root/src/nfc
diff options
context:
space:
mode:
authorStephan Binner <stephan.binner@basyskom.com>2017-04-18 20:59:51 +0200
committerStephan Binner <stephan.binner@basyskom.com>2017-04-25 13:27:16 +0000
commit731c202e13e74d0b97d9a5fcfb028b1ce1bf735d (patch)
treea6a526cccdc4e4dda67823fe7d7aadb566696b60 /src/nfc
parentbcf1167ccb52341d72e6e2921077d2244803ee8d (diff)
Fix build for -no-feature-textcodec
Change-Id: I5d5834733e53ac59f8e889481e04fa7acd184628 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/nfc')
-rw-r--r--src/nfc/qndefnfctextrecord.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nfc/qndefnfctextrecord.cpp b/src/nfc/qndefnfctextrecord.cpp
index 1d644fdb..78736cc0 100644
--- a/src/nfc/qndefnfctextrecord.cpp
+++ b/src/nfc/qndefnfctextrecord.cpp
@@ -122,6 +122,7 @@ QString QNdefNfcTextRecord::text() const
if (p.isEmpty())
return QString();
+#if QT_CONFIG(textcodec)
quint8 status = p.at(0);
bool utf16 = status & 0x80;
@@ -130,6 +131,10 @@ QString QNdefNfcTextRecord::text() const
QTextCodec *codec = QTextCodec::codecForName(utf16 ? "UTF-16BE" : "UTF-8");
return codec ? codec->toUnicode(p.constData() + 1 + codeLength, p.length() - 1 - codeLength) : QString();
+#else
+ qWarning("Cannot decode payload, Qt was built with -no-feature-textcodec!");
+ return QString();
+#endif
}
/*!
@@ -137,6 +142,7 @@ QString QNdefNfcTextRecord::text() const
*/
void QNdefNfcTextRecord::setText(const QString text)
{
+#if QT_CONFIG(textcodec)
if (payload().isEmpty())
setLocale(QLocale().name());
@@ -154,6 +160,10 @@ void QNdefNfcTextRecord::setText(const QString text)
p += codec->fromUnicode(text);
setPayload(p);
+#else
+ qWarning("Cannot encode payload, Qt was built with -no-feature-textcodec!");
+ Q_UNUSED(text);
+#endif
}
/*!