From 4c14d6860dadd1f1eef16d6c6682b064e2a39e0a Mon Sep 17 00:00:00 2001 From: Lionel Duboeuf Date: Mon, 27 May 2024 16:07:56 +0200 Subject: [PATCH] Support building without MCE support. --- lib/lib.pri | 10 +++++++++- lib/seasidecache.cpp | 8 ++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/lib.pri b/lib/lib.pri index 0289b81..95b4dd5 100644 --- a/lib/lib.pri +++ b/lib/lib.pri @@ -9,7 +9,15 @@ packagesExist(mlite$${QT_MAJOR_VERSION}) { } else { warning("mlite not available. Some functionality may not work as expected.") } -PKGCONFIG += mlocale$${QT_MAJOR_VERSION} mce + +packagesExist(mce) { + PKGCONFIG += mce + DEFINES += HAS_MCE +} else { + warning("mce not available. Some functionality may not work as expected.") +} + +PKGCONFIG += mlocale$${QT_MAJOR_VERSION} LIBS += -lphonenumber diff --git a/lib/seasidecache.cpp b/lib/seasidecache.cpp index d38c8de..0ae22fe 100644 --- a/lib/seasidecache.cpp +++ b/lib/seasidecache.cpp @@ -74,8 +74,10 @@ #include +#ifdef HAS_MCE #include #include +#endif #include QTVERSIT_USE_NAMESPACE @@ -546,7 +548,7 @@ SeasideCache::SeasideCache() this, &SeasideCache::displayLabelOrderChanged); connect(config, &CacheConfiguration::sortPropertyChanged, this, &SeasideCache::sortPropertyChanged); - +#ifdef HAS_MCE // Is this a GUI application? If so, we want to defer some processing when the display is off if (qApp && qApp->property("applicationDisplayName").isValid()) { // Only QGuiApplication has this property @@ -555,7 +557,7 @@ SeasideCache::SeasideCache() qWarning() << "Unable to connect to MCE displayStatusChanged signal"; } } - +#endif QContactManager *mgr(manager()); // The contactsPresenceChanged signal is not exported by QContactManager, so we @@ -3215,6 +3217,7 @@ void SeasideCache::sortPropertyChanged(const QString &sortProperty) void SeasideCache::displayStatusChanged(const QString &status) { +#ifdef HAS_MCE const bool off = (status == QLatin1String(MCE_DISPLAY_OFF_STRING)); if (m_displayOff != off) { m_displayOff = off; @@ -3224,6 +3227,7 @@ void SeasideCache::displayStatusChanged(const QString &status) requestUpdate(); } } +#endif } int SeasideCache::importContacts(const QString &path)