Skip to content

Commit

Permalink
Popup using notification
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlich committed Dec 17, 2024
1 parent 0665a8d commit 3b2556e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
1 change: 0 additions & 1 deletion ui/qml/components/platform.uuitk/PopupPL.qml

This file was deleted.

31 changes: 31 additions & 0 deletions ui/qml/components/platform.uuitk/PopupPL.qml
Original file line number Diff line number Diff line change
@@ -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
]);

}
}
2 changes: 1 addition & 1 deletion ui/qml/pages/DebugInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions ui/src/harbour-amazfish-ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 3b2556e

Please sign in to comment.