Commit 7b1b2b76 authored by Sune Vuorela's avatar Sune Vuorela

Allow barcodes to be nullpointers

libprison has the possibility to return nullpointers for createBarcode.
A nullpointer signals that this library can't create this barcode type.

This will be more likely in the future due to more modularity.
Handle these cases.

Differential Revision: https://phabricator.kde.org/D10630
parent 761b8730
......@@ -148,14 +148,18 @@ public:
addr.setPhoto(KContacts::Picture());
addr.setLogo(KContacts::Picture());
const QString data = QString::fromUtf8(converter.createVCard(addr));
mQRCode->setData(data);
mDataMatrix->setData(data);
mBrowser->document()->addResource(QTextDocument::ImageResource,
QUrl(QStringLiteral("qrcode")),
mQRCode->toImage(QSizeF(50, 50)));
mBrowser->document()->addResource(QTextDocument::ImageResource,
QUrl(QStringLiteral("datamatrix")),
mDataMatrix->toImage(QSizeF(50, 50)));
if (mQRCode) {
mQRCode->setData(data);
mBrowser->document()->addResource(QTextDocument::ImageResource,
QUrl(QStringLiteral("qrcode")),
mQRCode->toImage(QSizeF(50, 50)));
}
if (mDataMatrix) {
mDataMatrix->setData(data);
mBrowser->document()->addResource(QTextDocument::ImageResource,
QUrl(QStringLiteral("datamatrix")),
mDataMatrix->toImage(QSizeF(50, 50)));
}
}
// merge local and global custom field descriptions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment