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