sample/app: Allow to set-up the onscreenapp as pop-up
[apps/onscreenapp.git] / sample / app / main.qml
index 4d23921..2979d88 100644 (file)
@@ -19,6 +19,8 @@ ApplicationWindow {
     property string onsButton3: qsTr("")
     property string postmsg: qsTr("")
     property string btndata: qsTr("")
+    property int pid: -1
+    property bool onscreen_role_set: false
 
     Label {
         id: title
@@ -339,13 +341,20 @@ ApplicationWindow {
         else
             postmsg += "}"
 
-       // if the application is not already started, start it
-       // if the application is not started, the first time we start
-       // it will by shown by default
-        eventHandler.start(onsId, postmsg)
+       if (!onscreen_role_set) {
+               eventHandler.set_window_poup(onsId, 0, 218)
+               onscreen_role_set = true
+       }
 
-       // we just need to display
-        eventHandler.showWindow(onsId, postmsg)
+       // if the application is not already started, start it
+       if (pid == -1) {
+               // if the application is not started, then the first time
+               // we start we also display it using the default policy engine
+               pid = eventHandler.start(onsId, postmsg)
+       } else {
+               // we just need to display it
+               eventHandler.showWindow(onsId, postmsg)
+       }
     }
 
     function qmlOnReplyShowWindow(text) {