Commit f8dadce7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't read config each time that we update item

parent f7254507
......@@ -19,7 +19,7 @@ include(ECMInstallIcons)
include(ECMQtDeclareLoggingCategory)
set(KF5_VERSION "5.16.0")
set(KDEPIMLIBS_VERSION "5.1.41")
set(KDEPIMLIBS_VERSION "5.1.42")
set(KCONTACTS_VERSION "4.91.0")
set(CALENDARCORE_VERSION "4.79.0")
set(KMIMELIB_VERSION "4.79.0")
......
......@@ -60,6 +60,9 @@ public:
{
mStandardContactFormatter = new StandardContactFormatter;
mContactFormatter = mStandardContactFormatter;
KConfig config(QStringLiteral("akonadi_contactrc"));
KConfigGroup group(&config, QStringLiteral("View"));
mShowQRCode = group.readEntry("QRCodes", true);
#ifdef HAVE_PRISON
mQRCode = new prison::QRCodeBarcode();
mDataMatrix = new prison::DataMatrixBarcode();
......@@ -147,9 +150,7 @@ public:
defaultSmsPixmap);
#ifdef HAVE_PRISON
KConfig config(QStringLiteral("akonadi_contactrc"));
KConfigGroup group(&config, QStringLiteral("View"));
if (group.readEntry("QRCodes", true)) {
if (mShowQRCode) {
KContacts::VCardConverter converter;
KContacts::Addressee addr(mCurrentContact);
addr.setPhoto(KContacts::Picture());
......@@ -268,6 +269,7 @@ public:
AbstractContactFormatter *mContactFormatter;
AbstractContactFormatter *mStandardContactFormatter;
CollectionFetchJob *mParentCollectionFetchJob;
bool mShowQRCode;
#ifdef HAVE_PRISON
prison::AbstractBarcode *mQRCode;
prison::AbstractBarcode *mDataMatrix;
......@@ -360,4 +362,17 @@ void ContactViewer::updateView()
itemChanged(d->mCurrentItem);
}
void ContactViewer::setShowQRCode(bool b)
{
if (d->mShowQRCode != b) {
d->mShowQRCode = b;
updateView();
}
}
bool ContactViewer::showQRCode() const
{
return d->mShowQRCode;
}
#include "moc_contactviewer.cpp"
......@@ -119,6 +119,11 @@ public:
*/
void updateView();
/**
* @since 5.2
*/
void setShowQRCode(bool b);
bool showQRCode() const;
public Q_SLOTS:
/**
* Sets the @p contact that shall be displayed in the viewer.
......
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