diff --git a/ui/qml/components/platform.uuitk/PopupPL.qml b/ui/qml/components/platform.uuitk/PopupPL.qml deleted file mode 120000 index 3ec645fc..00000000 --- a/ui/qml/components/platform.uuitk/PopupPL.qml +++ /dev/null @@ -1 +0,0 @@ -../platform.kirigami/PopupPL.qml \ No newline at end of file diff --git a/ui/qml/components/platform.uuitk/PopupPL.qml b/ui/qml/components/platform.uuitk/PopupPL.qml new file mode 100644 index 00000000..1f234bfd --- /dev/null +++ b/ui/qml/components/platform.uuitk/PopupPL.qml @@ -0,0 +1,31 @@ +import Nemo.DBus 2.0 + +DBusInterface { + id: notificationsIface + bus: DBus.SessionBus + service: 'org.freedesktop.Notifications' + path: '/org/freedesktop/Notifications' + iface: 'org.freedesktop.Notifications' + + function showMessage(msg) { + + // https://specifications.freedesktop.org/notification-spec/latest/protocol.html + // https://wiki.ubuntu.com/Touch/Notifications + + console.log(msg) // notification will not apear in `clickable desktop` + + var app_icon = APPLICATION_FILE_DIR + "/../share/icons/hicolor/scalable/apps/harbour-amazfish-ui.svg" + + notificationsIface.typedCall("Notify", [ + { "type": "s", "value": qsTr("Amazfish") }, // app_name + { "type": "u", "value": _lastNotificationId }, // replaces_id + { "type": "s", "value": app_icon }, // app_icon + { "type": "s", "value": msg }, // summary + { "type": "s", "value": "" }, // body + { "type": "as", "value": [] }, // actions + { "type": "a{sv}", "value": {} }, // hints + { "type": "i", "value": 5000 } // expire_timeout + ]); + + } +} diff --git a/ui/qml/pages/DebugInfo.qml b/ui/qml/pages/DebugInfo.qml index 0150c30d..52a8b1ce 100644 --- a/ui/qml/pages/DebugInfo.qml +++ b/ui/qml/pages/DebugInfo.qml @@ -193,7 +193,7 @@ PagePL { anchors.horizontalCenter: parent.horizontalCenter width: parent.width * 0.8 onClicked: { - app.showMessage("This is a test notification"); + app.showMessage(qsTr("This is a test notification")); } } ButtonPL { diff --git a/ui/src/harbour-amazfish-ui.cpp b/ui/src/harbour-amazfish-ui.cpp index 6a0ffc32..3c73f5a8 100644 --- a/ui/src/harbour-amazfish-ui.cpp +++ b/ui/src/harbour-amazfish-ui.cpp @@ -127,6 +127,7 @@ int main(int argc, char *argv[]) view->setSource(SailfishApp::pathTo("qml/harbour-amazfish.qml")); view->show(); #elif UUITK_EDITION + view->rootContext()->setContextProperty("APPLICATION_FILE_DIR", QFileInfo(QCoreApplication::applicationFilePath()).absolutePath()); view->load("./share/harbour-amazfish-ui/qml/harbour-amazfish.qml"); #else view->load(QUrl("qrc:/qml/harbour-amazfish.qml"));