From ff6b92f5b6fa3450696f162f2143f53a5bcedae7 Mon Sep 17 00:00:00 2001 From: Dusko Angirevic Date: Wed, 25 Oct 2017 23:45:15 +0200 Subject: [PATCH] Notification actions test 2 --- qml/cover/CoverPage.qml | 56 +------------------------------ qml/lib/API.js | 6 ++-- qml/pages/components/MyList.qml | 47 ++------------------------ translations/harbour-tooter-de.ts | 15 --------- translations/harbour-tooter-el.ts | 15 --------- translations/harbour-tooter-en.ts | 15 --------- translations/harbour-tooter-es.ts | 15 --------- translations/harbour-tooter-fr.ts | 15 --------- translations/harbour-tooter-nl.ts | 15 --------- translations/harbour-tooter-oc.ts | 15 --------- translations/harbour-tooter-sr.ts | 15 --------- translations/harbour-tooter.ts | 15 --------- 12 files changed, 6 insertions(+), 238 deletions(-) diff --git a/qml/cover/CoverPage.qml b/qml/cover/CoverPage.qml index 96923cf..8a07f10 100644 --- a/qml/cover/CoverPage.qml +++ b/qml/cover/CoverPage.qml @@ -30,7 +30,6 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 -import org.nemomobile.notifications 1.0; import "../lib/API.js" as Logic @@ -126,64 +125,11 @@ CoverBackground { if (Logic.conf.notificationLastID < Logic.modelTLnotifications.get(i).id) { notificationsNum++ - var item = Logic.modelTLnotifications.get(i); - item.content = item.content.replace(/(<([^>]+)>)/ig,"").replaceAll(""", "\"").replaceAll("&", "&") - //Logic.notifier()) - switch (item.type){ - case "favourite": - //Notifications.notify("Tooter", "serverinfo.serverTitle", (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTrId("favourited"), false, item.created_at.getTime()/1000|0, "") - ntf.urgency = Notification.Normal - ntf.timestamp = item.created_at - ntf.summary = (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("favourited") - ntf.body = item.content - break; - case "follow": - ntf.urgency = Notification.Critical - ntf.timestamp = item.created_at - ntf.summary = (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username) - ntf.body = qsTr("followed you") - ntf.remoteActions[0].method = "showtoot" - ntf.remoteActions[0].arguments = ["user", ntf.summary] - break; - case "reblog": - ntf.urgency = Notification.Low - ntf.timestamp = item.created_at - ntf.summary = (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("boosted") - ntf.body = item.content - ntf.remoteActions[0].method = "showtoot" - ntf.remoteActions[0].arguments = ["toot", item.id] - break; - } - ntf.replacesId = 0; - ntf.publish(); + Logic.notifier(Logic.modelTLnotifications.get(i)) } } notificationsLbl.text = notificationsNum; Logic.conf.notificationLastID = notificationLastID; } - Notification { - id: ntf - category: "x-harbour.tooter.activity" - appName: "Tooter" - appIcon: "/usr/share/harbour-tooter/config/icon-lock-harbour-tooter.png" - summary: "Notification summary" - body: "Notification body" - previewSummary: summary - previewBody: body - itemCount: 1 - timestamp: "2013-02-20 18:21:00" - remoteActions: [ { - "name": "default", - "displayName": "Do something", - "icon": "icon-s-certificates", - "service": "ba.dysko.harbour.tooter", - "path": "/", - "iface": "ba.dysko.harbour.tooter", - "method": "openapp", - "arguments": [ ] - }] - onClicked: console.log("Clicked") - onClosed: console.log("Closed, reason: " + reason) - } } diff --git a/qml/lib/API.js b/qml/lib/API.js index 2e564ee..cc80675 100644 --- a/qml/lib/API.js +++ b/qml/lib/API.js @@ -116,13 +116,13 @@ var notificationGenerator = function(item){ var notification; switch (item.urgency){ case "normal": - notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-harbour.tooter.activity"; appName: "Tooter"; appIcon: "/usr/share/harbour-tooter/config/icon-lock-harbour-tooter.png"; summary: "Notification summary"; body: "Notification body"; previewSummary: "Notification preview summary"; previewBody: "Notification preview body"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "openapp", "arguments": [ ] }]; urgency: Notification.Normal; }', Qt.application, 'InternalQmlObject'); + notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-harbour.tooter.activity"; appName: "Tooter"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "openapp", "arguments": [ ] }]; urgency: Notification.Normal; }', Qt.application, 'InternalQmlObject'); break; case "critical": - notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { appName: "Tooter"; itemCount: 1; category: "x-harbour.tooter.activity"; urgency: Notification.Critical; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-do-it", "service": "org.nemomobile.example", "path": "/example", "iface": "org.nemomobile.example", "method": "doSomething", "arguments": [ "argument", 1 ] },{ "name": "ignore", "displayName": "Ignore the problem", "icon": "icon-s-ignore", "service": "org.nemomobile.example", "path": "/example", "iface": "org.nemomobile.example", "method": "ignore", "arguments": [ "argument", 1 ] } ]; onClicked: console.log("Clicked"); onClosed: console.log("Closed, reason: " + reason); }', Qt.application, 'InternalQmlObject'); + notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { appName: "Tooter"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "viewtoot", "arguments": [ "myTest", "blabla" ] }]; urgency: Notification.Critical; }', Qt.application, 'InternalQmlObject'); break; default: - notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { appName: "Tooter"; itemCount: 1; category: "x-harbour.tooter.activity"; urgency: Notification.Low; }', Qt.application, 'InternalQmlObject'); + notification = Qt.createQmlObject('import org.nemomobile.notifications 1.0; Notification { category: "x-harbour.tooter.activity"; appName: "Tooter"; itemCount: 1; remoteActions: [ { "name": "default", "displayName": "Do something", "icon": "icon-s-certificates", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "viewtoot", "arguments": [ "a", "b" ] }]; urgency: Notification.Low; }', Qt.application, 'InternalQmlObject'); } //notification.remoteActions = [ { "name": "app", "displayName": "Do something", "icon": "icon-s-do-it", "service": "ba.dysko.harbour.tooter", "path": "/", "iface": "ba.dysko.harbour.tooter", "method": "openapp", "arguments": [ ]}] //Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", false, "2015-10-15 00:00:00", "aaa") diff --git a/qml/pages/components/MyList.qml b/qml/pages/components/MyList.qml index 026c1fe..d70e96a 100644 --- a/qml/pages/components/MyList.qml +++ b/qml/pages/components/MyList.qml @@ -3,8 +3,6 @@ import Sailfish.Silica 1.0 import "../../lib/API.js" as Logic import "." -import org.nemomobile.notifications 1.0; - SilicaListView { id: myList property string type; @@ -58,18 +56,6 @@ SilicaListView { } PullDownMenu { - MenuItem { - text: "NOTIFIKACIJA" - onClicked: { - Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", true, "", "aaa") - } - } - MenuItem { - text: "NOTIFIKACIJA2" - onClicked: { - Notifications.notify("Tooter", "serverinfo.serverTitle", " new activity", false, "2015-10-15 00:00:00", "aaa") - } - } MenuItem { text: qsTr("Settings") onClicked: { @@ -119,9 +105,7 @@ SilicaListView { console.log("CountChanged!")*/ } - Button { - onClicked: notification.publish() - } + footer: Item{ width: parent.width height: Theme.itemSizeLarge @@ -163,10 +147,7 @@ SilicaListView { console.log(JSON.stringify(messageObject)) } if (messageObject.fireNotification && notifier){ - //Logic.notifier(messageObject.data) - console.log(JSON.stringify(messageObject.data)) - notification.body = "a" - notification.publish() + Logic.notifier(messageObject.data) } } @@ -202,29 +183,5 @@ SilicaListView { if (type !== "") worker.sendMessage(msg); } - Notification { - id: notification - category: "x-harbour.tooter.activity" - appName: "Tooter" - appIcon: "/usr/share/harbour-tooter/config/icon-lock-harbour-tooter.png" - summary: "Notification summary" - body: "Notification body" - previewSummary: "Notification preview summary" - previewBody: "Notification preview body" - itemCount: 5 - timestamp: "2013-02-20 18:21:00" - remoteActions: [ { - "name": "default", - "displayName": "Do something", - "icon": "icon-s-certificates", - "service": "ba.dysko.harbour.tooter", - "path": "/", - "iface": "ba.dysko.harbour.tooter", - "method": "openapp", - "arguments": [ ] - }] - onClicked: console.log("Clicked") - onClosed: console.log("Closed, reason: " + reason) - } } diff --git a/translations/harbour-tooter-de.ts b/translations/harbour-tooter-de.ts index c57db1d..0d40b2d 100644 --- a/translations/harbour-tooter-de.ts +++ b/translations/harbour-tooter-de.ts @@ -78,21 +78,6 @@ - - CoverPage - - favourited - - - - followed you - - - - boosted - - - ImageFullScreen diff --git a/translations/harbour-tooter-el.ts b/translations/harbour-tooter-el.ts index 6ae873f..3568d62 100644 --- a/translations/harbour-tooter-el.ts +++ b/translations/harbour-tooter-el.ts @@ -78,21 +78,6 @@ Κτυπήστε για εισαγωγή - - CoverPage - - favourited - στους σελιδοδείκτες - - - followed you - σας ακολουθούν - - - boosted - προωθημένο - - ImageFullScreen diff --git a/translations/harbour-tooter-en.ts b/translations/harbour-tooter-en.ts index ca565b2..0ea6d27 100644 --- a/translations/harbour-tooter-en.ts +++ b/translations/harbour-tooter-en.ts @@ -78,21 +78,6 @@ Tap to insert - - CoverPage - - favourited - favourited - - - followed you - followed you - - - boosted - boosted - - ImageFullScreen diff --git a/translations/harbour-tooter-es.ts b/translations/harbour-tooter-es.ts index 281ab21..56dfe3b 100644 --- a/translations/harbour-tooter-es.ts +++ b/translations/harbour-tooter-es.ts @@ -78,21 +78,6 @@ Toca para insertar - - CoverPage - - favourited - marcó como favorito - - - followed you - te empezó a seguir - - - boosted - retooteó - - ImageFullScreen diff --git a/translations/harbour-tooter-fr.ts b/translations/harbour-tooter-fr.ts index cbec29e..c5ddaef 100644 --- a/translations/harbour-tooter-fr.ts +++ b/translations/harbour-tooter-fr.ts @@ -78,21 +78,6 @@ Appuyez pour insérer - - CoverPage - - favourited - a ajouté à ses favoris - - - followed you - - - - boosted - - - ImageFullScreen diff --git a/translations/harbour-tooter-nl.ts b/translations/harbour-tooter-nl.ts index ec0f8e9..2db675e 100644 --- a/translations/harbour-tooter-nl.ts +++ b/translations/harbour-tooter-nl.ts @@ -78,21 +78,6 @@ - - CoverPage - - favourited - - - - followed you - volgde jou - - - boosted - - - ImageFullScreen diff --git a/translations/harbour-tooter-oc.ts b/translations/harbour-tooter-oc.ts index ac4fd8f..107edd9 100644 --- a/translations/harbour-tooter-oc.ts +++ b/translations/harbour-tooter-oc.ts @@ -78,21 +78,6 @@ Tustejar per inserir - - CoverPage - - favourited - a mes en favorit - - - followed you - vos sèc - - - boosted - - - ImageFullScreen diff --git a/translations/harbour-tooter-sr.ts b/translations/harbour-tooter-sr.ts index da7ad9c..aa513ae 100644 --- a/translations/harbour-tooter-sr.ts +++ b/translations/harbour-tooter-sr.ts @@ -78,21 +78,6 @@ Тапни за убацивање - - CoverPage - - favourited - - - - followed you - вас прати - - - boosted - разглашено - - ImageFullScreen diff --git a/translations/harbour-tooter.ts b/translations/harbour-tooter.ts index 668f01e..61df02f 100644 --- a/translations/harbour-tooter.ts +++ b/translations/harbour-tooter.ts @@ -78,21 +78,6 @@ Tap to insert - - CoverPage - - favourited - favourited - - - followed you - followed you - - - boosted - boosted - - ImageFullScreen