From 8f7313dee2a9e549b201fe85d439a730c1a10479 Mon Sep 17 00:00:00 2001 From: Matt Vogt Date: Tue, 17 Mar 2015 09:58:47 +1000 Subject: [PATCH] [transfer-engine] Use categories to configure notification properties --- data/data.pro | 6 ++++++ data/notificationcategories/x-nemo.transfer.complete.conf | 2 ++ data/notificationcategories/x-nemo.transfer.conf | 3 +++ data/notificationcategories/x-nemo.transfer.error.conf | 2 ++ rpm/transfer-engine-qt5.spec | 2 +- src/transferengine.cpp | 8 +++----- transfer-engine.pro | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 data/data.pro create mode 100644 data/notificationcategories/x-nemo.transfer.complete.conf create mode 100644 data/notificationcategories/x-nemo.transfer.conf create mode 100644 data/notificationcategories/x-nemo.transfer.error.conf diff --git a/data/data.pro b/data/data.pro new file mode 100644 index 0000000..fd30c3a --- /dev/null +++ b/data/data.pro @@ -0,0 +1,6 @@ +TEMPLATE = aux + +notification_categories.path = /usr/share/lipstick/notificationcategories +notification_categories.files = notificationcategories/*.conf + +INSTALLS += notification_categories diff --git a/data/notificationcategories/x-nemo.transfer.complete.conf b/data/notificationcategories/x-nemo.transfer.complete.conf new file mode 100644 index 0000000..ba571c1 --- /dev/null +++ b/data/notificationcategories/x-nemo.transfer.complete.conf @@ -0,0 +1,2 @@ +appIcon=icon-lock-transfer +urgency=1 diff --git a/data/notificationcategories/x-nemo.transfer.conf b/data/notificationcategories/x-nemo.transfer.conf new file mode 100644 index 0000000..c29867c --- /dev/null +++ b/data/notificationcategories/x-nemo.transfer.conf @@ -0,0 +1,3 @@ +appIcon=icon-lock-transfer +transient=true +urgency=1 diff --git a/data/notificationcategories/x-nemo.transfer.error.conf b/data/notificationcategories/x-nemo.transfer.error.conf new file mode 100644 index 0000000..5a844f4 --- /dev/null +++ b/data/notificationcategories/x-nemo.transfer.error.conf @@ -0,0 +1,2 @@ +appIcon=icon-lock-transfer +urgency=2 diff --git a/rpm/transfer-engine-qt5.spec b/rpm/transfer-engine-qt5.spec index be6eba5..baf53ac 100644 --- a/rpm/transfer-engine-qt5.spec +++ b/rpm/transfer-engine-qt5.spec @@ -35,7 +35,7 @@ Obsoletes: nemo-transferengine <= 0.0.19 %{_bindir}/nemo-transfer-engine %{_datadir}/dbus-1/services/org.nemo.transferengine.service %{_datadir}/translations/nemo-transfer-engine_eng_en.qm - +%{_datadir}/lipstick/notificationcategories/* %package -n libnemotransferengine-qt5 Summary: Transfer engine library. diff --git a/src/transferengine.cpp b/src/transferengine.cpp index 44d49f5..6070288 100644 --- a/src/transferengine.cpp +++ b/src/transferengine.cpp @@ -52,9 +52,9 @@ #define ACTIVITY_MONITOR_TIMEOUT 1*60*1000 // 1 minute in ms #define TRANSFER_EXPIRATION_THRESHOLD 3*60 // 3 minutes in seconds -#define TRANSFER_EVENT_CATEGORY "transfer" -#define TRANSFER_COMPLETE_EVENT_CATEGORY "transfer.complete" -#define TRANSFER_ERROR_EVENT_CATEGORY "transfer.error" +#define TRANSFER_EVENT_CATEGORY "x-nemo.transfer" +#define TRANSFER_COMPLETE_EVENT_CATEGORY "x-nemo.transfer.complete" +#define TRANSFER_ERROR_EVENT_CATEGORY "x-nemo.transfer.error" TransferEngineSignalHandler * TransferEngineSignalHandler::instance() { @@ -398,8 +398,6 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty if (!existing) { // Create a new notification - notification.setAppIcon("icon-lock-transfer"); - if (m_settings.status() != QSettings::NoError) { qWarning() << Q_FUNC_INFO << "Failed to read settings!" << m_settings.status(); } else { diff --git a/transfer-engine.pro b/transfer-engine.pro index d00f8ff..0a02d1e 100644 --- a/transfer-engine.pro +++ b/transfer-engine.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = lib src declarative tests +SUBDIRS = lib src declarative tests data src.depends = lib tests.depends = lib