summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2014-08-10 13:08:49 +0200
committerTomasz Sterna <tomek@xiaoka.com>2014-08-10 13:08:49 +0200
commit96ad10715d2f28913d102ed95bde44184cd512fd (patch)
treef53423d03cba49572b0fda63541b365e1e343d6e
parentc1534c22728355e658b275cf3f6ef13e85915676 (diff)
Check whether setting isValid before converting toBool
-rw-r--r--daemon/manager.cpp3
-rw-r--r--daemon/notificationmanager.cpp23
2 files changed, 16 insertions, 10 deletions
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index e80673d..3dd9108 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -120,7 +120,8 @@ void Manager::onActiveVoiceCallChanged()
{
logger()->debug() << "Manager::onActiveVoiceCallChanged()";
- if (!settings->property("incomingCallNotification").toBool()) {
+ QVariant incomingCallNotification = settings->property("incomingCallNotification");
+ if (incomingCallNotification.isValid() && !incomingCallNotification.toBool()) {
logger()->debug() << "Ignoring ActiveVoiceCallChanged because of setting!";
return;
}
diff --git a/daemon/notificationmanager.cpp b/daemon/notificationmanager.cpp
index 104c614..1b888d5 100644
--- a/daemon/notificationmanager.cpp
+++ b/daemon/notificationmanager.cpp
@@ -122,7 +122,8 @@ void NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
if (app_name == "messageserver5") {
- if (!settings->property("notificationsEmails").toBool()) {
+ QVariant notificationsEmails = settings->property("notificationsEmails");
+ if (!notificationsEmails.isValid() || !notificationsEmails.toBool()) {
logger()->debug() << "Ignoring email notification because of setting!";
return;
}
@@ -137,12 +138,14 @@ void NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
QString category = hints.value("category", "").toString();
if (category == "x-nemo.call.missed") {
- if (!settings->property("notificationsMissedCall").toBool()) {
+ QVariant notificationsMissedCall = settings->property("notificationsMissedCall");
+ if (notificationsMissedCall.isValid() && !notificationsMissedCall.toBool()) {
logger()->debug() << "Ignoring MissedCall notification because of setting!";
return;
}
} else {
- if (!settings->property("notificationsCommhistoryd").toBool()) {
+ QVariant notificationsCommhistoryd = settings->property("notificationsCommhistoryd");
+ if (notificationsCommhistoryd.isValid() && !notificationsCommhistoryd.toBool()) {
logger()->debug() << "Ignoring commhistoryd notification because of setting!";
return;
}
@@ -152,8 +155,8 @@ void NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
);
}
} else if (app_name == "harbour-mitakuuluu2-server") {
-
- if (!settings->property("notificationsMitakuuluu").toBool()) {
+ QVariant notificationsMitakuuluu = settings->property("notificationsMitakuuluu");
+ if (notificationsMitakuuluu.isValid() && !notificationsMitakuuluu.toBool()) {
logger()->debug() << "Ignoring mitakuuluu notification because of setting!";
return;
}
@@ -163,8 +166,8 @@ void NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
);
} else if (app_name == "twitter-notifications-client") {
-
- if (!settings->property("notificationsTwitter").toBool()) {
+ QVariant notificationsTwitter = settings->property("notificationsTwitter");
+ if (notificationsTwitter.isValid() && !notificationsTwitter.toBool()) {
logger()->debug() << "Ignoring twitter notification because of setting!";
return;
}
@@ -183,12 +186,14 @@ void NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
logger()->debug() << "MSG Prio:" << prio;
- if (!settings->property("notificationsAll").toBool() && prio <= 10) {
+ QVariant notificationsAll = settings->property("notificationsAll");
+ if ((!notificationsAll.isValid() || !notificationsAll.toBool()) && prio <= 10) {
logger()->debug() << "Ignoring notification because of setting! (all)";
return;
}
- if (!settings->property("notificationsOther").toBool() && prio < 90) {
+ QVariant notificationsOther = settings->property("notificationsOther");
+ if (notificationsOther.isValid() && !notificationsOther.toBool() && prio < 90) {
logger()->debug() << "Ignoring notification because of setting! (other)";
return;
}