summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--daemon/manager.cpp22
-rw-r--r--daemon/manager.h1
-rw-r--r--daemon/notificationmanager.cpp34
-rw-r--r--daemon/notificationmanager.h5
-rw-r--r--daemon/watchconnector.cpp5
-rw-r--r--daemon/watchconnector.h1
6 files changed, 46 insertions, 22 deletions
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index 4d6a525..55138d9 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -52,6 +52,7 @@ Manager::Manager(Settings *settings, QObject *parent) :
connect(notifications, SIGNAL(error(const QString &)), SLOT(onNotifyError(const QString &)));
connect(notifications, SIGNAL(emailNotify(const QString &,const QString &,const QString &)), SLOT(onEmailNotify(const QString &,const QString &,const QString &)));
+ connect(notifications, SIGNAL(missedCallNotify(const QString &,const QString &)), SLOT(onMissedCallNotify(const QString &,const QString &)));
connect(notifications, SIGNAL(smsNotify(const QString &,const QString &)), SLOT(onSmsNotify(const QString &,const QString &)));
connect(notifications, SIGNAL(twitterNotify(const QString &,const QString &)), SLOT(onTwitterNotify(const QString &,const QString &)));
connect(notifications, SIGNAL(facebookNotify(const QString &,const QString &)), SLOT(onFacebookNotify(const QString &,const QString &)));
@@ -139,12 +140,12 @@ void Manager::onActiveVoiceCallStatusChanged()
return;
}
- qCDebug(l) << "handlerId:" << handler->handlerId()
- << "providerId:" << handler->providerId()
- << "status:" << handler->status()
- << "statusText:" << handler->statusText()
- << "lineId:" << handler->lineId()
- << "incoming:" << handler->isIncoming();
+// qCDebug(l) << "handlerId:" << handler->handlerId()
+// << "providerId:" << handler->providerId()
+// << "status:" << handler->status()
+// << "statusText:" << handler->statusText()
+// << "lineId:" << handler->lineId()
+// << "incoming:" << handler->isIncoming();
if (!watch->isConnected()) {
qCDebug(l) << "Watch is not connected";
@@ -203,6 +204,15 @@ void Manager::onNotifyError(const QString &message)
qWarning() << "Error:" << message;
}
+void Manager::onMissedCallNotify(const QString &sender, const QString &data)
+{
+ if (settings->property("transliterateMessage").toBool()) {
+ transliterateMessage(sender);
+ transliterateMessage(data);
+ }
+ watch->sendMissedCallNotification(sender, data);
+}
+
void Manager::onSmsNotify(const QString &sender, const QString &data)
{
if (settings->property("transliterateMessage").toBool()) {
diff --git a/daemon/manager.h b/daemon/manager.h
index 0c6032b..7c9db3c 100644
--- a/daemon/manager.h
+++ b/daemon/manager.h
@@ -81,6 +81,7 @@ private slots:
void onActiveVoiceCallStatusChanged();
void onNotifyError(const QString &message);
void onSmsNotify(const QString &sender, const QString &data);
+ void onMissedCallNotify(const QString &sender, const QString &data);
void onTwitterNotify(const QString &sender, const QString &data);
void onFacebookNotify(const QString &sender, const QString &data);
void onTelegramNotify(const QString &sender, const QString &data);
diff --git a/daemon/notificationmanager.cpp b/daemon/notificationmanager.cpp
index 0c56bc2..22f6967 100644
--- a/daemon/notificationmanager.cpp
+++ b/daemon/notificationmanager.cpp
@@ -114,7 +114,7 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
Q_UNUSED(expire_timeout);
// new place to check notification owner in Sailfish 1.1.6
- QString owner = hints.value("x-nemo-owner", "Unknown").toString();
+ QString owner = hints.value("x-nemo-owner", "").toString();
qCDebug(l) << Q_FUNC_INFO << "Got notification via dbus from" << this->getCleanAppName(app_name) << " Owner: " << owner;
qCDebug(l) << hints;
@@ -124,22 +124,34 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
Q_ASSERT(calledFromDBus());
setDelayedReply(true);
+ // Look up the notification category and its parameters
QString category = hints.value("category", "").toString();
QStringHash categoryParams = this->getCategoryParams(category);
+ // Ignore transient and hidden notifications (notif hints override category hints)
+ // Hack this to accept transient -preview and -summary notifications, as we don't know how to decode the actual notifs yet
+ if (hints.value("transient", categoryParams.value("transient", "false")).toString() == "true") {
+ qCDebug(l) << "Ignoring transient notification from " << owner;
+ return 0;
+ }
+ else if (hints.value("x-nemo-hidden", "false").toString() == "true" ) {
+ qCDebug(l) << "Ignoring hidden notification from " << owner;
+ return 0;
+ }
+
if (category == "x-nemo.email") {
if (!settings->property("notificationsEmails").toBool()) {
qCDebug(l) << "Ignoring email notification because of setting!";
return 0;
}
- emit this->emailNotify(summary, body, app_name);
+ emit this->emailNotify(app_name, body, summary);
}
else if (category == "x-nemo.call.missed") {
if (!settings->property("notificationsMissedCall").toBool()) {
qCDebug(l) << "Ignoring MissedCall notification because of setting!";
return 0;
}
- emit this->smsNotify(hints.value("x-nemo-preview-summary", summary).toString(),
+ emit this->missedCallNotify(hints.value("x-nemo-preview-summary", summary).toString(),
hints.value("x-nemo-preview-body", body).toString()
);
}
@@ -152,7 +164,8 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
hints.value("x-nemo-preview-body", body).toString()
);
}
- else if (app_name.toLower().contains("whatsapp") || app_name.toLower().contains("whatsup")) {
+ else if (hints.value("x-nemo-origin-package").toString() == "com.whatsapp"
+ || owner.toLower().contains("whatsup")) {
if (!settings->property("notificationsWhatsapp").toBool()) {
qCDebug(l) << "Ignoring whatsapp notification because of setting!";
return 0;
@@ -171,12 +184,13 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
hints.value("x-nemo-preview-body", body).toString()
);
}
- else if (app_name.toLower().contains("hangouts") || app_name.toLower().contains("hangish")) {
+ else if (hints.value("x-nemo-origin-package").toString() == "com.google.android.apps.babel"
+ || owner == "harbour-hangish") {
if (!settings->property("notificationsHangouts").toBool()) {
qCDebug(l) << "Ignoring telegram notification because of setting!";
return 0;
}
- emit this->hangoutNotify(hints.value("x-nemo-preview-summary", summary).toString(),
+ emit this->hangoutsNotify(hints.value("x-nemo-preview-summary", summary).toString(),
hints.value("x-nemo-preview-body", body).toString()
);
}
@@ -191,14 +205,6 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
);
} else {
- // Ignore transient notifications (notif hints override category hints)
- // Hack this to accept transient -preview and -summary notifications, as we don't know how to decode the actual notifs yet
- if (!category.endsWith("preview") && !category.endsWith("summary") &&
- hints.value("transient", categoryParams.value("transient", "false")).toString() == "true") {
- qCDebug(l) << "Ignoring transient notification from " << owner;
- return 0;
- }
-
// Prioritize x-nemo-preview* over dbus direct summary and body
QString subject = hints.value("x-nemo-preview-summary", summary).toString();
QString data = hints.value("x-nemo-preview-body", body).toString();
diff --git a/daemon/notificationmanager.h b/daemon/notificationmanager.h
index 830bfb4..747561c 100644
--- a/daemon/notificationmanager.h
+++ b/daemon/notificationmanager.h
@@ -26,13 +26,14 @@ public:
Q_SIGNALS:
void error(const QString &message);
+ void missedCallNotify(const QString &sender, const QString &data);
void smsNotify(const QString &sender, const QString &data);
void twitterNotify(const QString &sender, const QString &data);
void facebookNotify(const QString &sender, const QString &data);
void telegramNotify(const QString &sender, const QString &data);
- void hangoutNotify(const QString &sender, const QString &data);
+ void hangoutsNotify(const QString &sender, const QString &data);
void whatsappNotify(const QString &sender, const QString &data);
- void emailNotify(const QString &sender, const QString &data,const QString &subject);
+ void emailNotify(const QString &sender, const QString &data, const QString &subject);
public Q_SLOTS:
uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantHash &hints, int expire_timeout);
diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp
index 4ed8130..3e72a58 100644
--- a/daemon/watchconnector.cpp
+++ b/daemon/watchconnector.cpp
@@ -691,6 +691,11 @@ void WatchConnector::sendNotification(uint lead, QString sender, QString data, Q
}
}
+void WatchConnector::sendMissedCallNotification(QString sender, QString data)
+{
+ sendNotification(leadMISSEDCALL, sender, data, "");
+}
+
void WatchConnector::sendSMSNotification(QString sender, QString data)
{
sendNotification(leadSMS, sender, data, "");
diff --git a/daemon/watchconnector.h b/daemon/watchconnector.h
index de2ce1a..cea5993 100644
--- a/daemon/watchconnector.h
+++ b/daemon/watchconnector.h
@@ -266,6 +266,7 @@ public slots:
void time();
void sendNotification(uint lead, QString sender, QString data, QString subject);
+ void sendMissedCallNotification(QString sender, QString data);
void sendSMSNotification(QString sender, QString data);
void sendEmailNotification(QString sender, QString data, QString subject);
void sendFacebookNotification(QString sender, QString data);