From c8f7016ece37533d89b6f35a7371adbc63edc546 Mon Sep 17 00:00:00 2001 From: Matt Vogt Date: Wed, 19 Aug 2015 10:50:03 +1000 Subject: [PATCH] [libcontacts] Only defer display-off processing in GUI apps. Contributes to MER#1249 --- src/seasidecache.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index fb98112..e00b3a3 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -575,9 +575,13 @@ SeasideCache::SeasideCache() connect(config, SIGNAL(sortPropertyChanged(QString)), this, SLOT(sortPropertyChanged(QString))); connect(config, SIGNAL(groupPropertyChanged(QString)), this, SLOT(groupPropertyChanged(QString))); - if (!QDBusConnection::systemBus().connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, - MCE_DISPLAY_SIG, this, SLOT(displayStatusChanged(QString)))) { - qWarning() << "Unable to connect to MCE displayStatusChanged signal"; + // 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 + if (!QDBusConnection::systemBus().connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, + MCE_DISPLAY_SIG, this, SLOT(displayStatusChanged(QString)))) { + qWarning() << "Unable to connect to MCE displayStatusChanged signal"; + } } QContactManager *mgr(manager());