<div dir="ltr">Thansk Andrey!, i managed to do it with dbus, for the record i've written a blog post with the code: <a href="http://nckweb.com.ar/sailing-code/2015/05/04/closing-an-application-without-killing-the-main-loop/">http://nckweb.com.ar/sailing-code/2015/05/04/closing-an-application-without-killing-the-main-loop/</a><div><br></div><div>Tomasz Sterna, i didn't know that telepathy protocol existed nor it was implemented on sailfish. Are there some example, documentation, or sth to read about how to use it?.</div><div><br></div><div>Thanks everyone!.<br><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-05-04 6:02 GMT-03:00 Andrey Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
you need to do it in separate class and implement dbus service for
showing running instance when click icon again. try to do it
yourself and tell me if you will not success, i'll give you minimal
example.<br>
<br>
<div>04.05.2015 06:09, Nicolas Cisco пишет:<br>
</div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">I've create the gui view and set
"setQuitOnLastWindow" to false. The problem i'm having is that
when the app gui is closed (the app continues running on
background), but the user can't open it again. How can i reopen
the gui view when the user clicks on the menu button of the
app?.
<div><br>
</div>
<div>The main code:</div>
<div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote"><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">main</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">argc</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">argv</span><span style="color:rgb(0,0,0)">[])<br>
</span><span style="color:rgb(0,0,0)">{<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">SailfishApp::main()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">will</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">display</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"qml/template.qml",</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">if</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">you</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">need</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">more<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">control</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">over</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">initialization,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">you</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">can</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">use:<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">-</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">SailfishApp::application(int,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">char</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">*[])</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">get</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">QGuiApplication</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">*<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">-</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">SailfishApp::createView()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">get</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">QQuickView</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">instance<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">-</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">SailfishApp::pathTo(QString)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">get</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">QUrl</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">resource</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">file<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">To</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">display</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">view,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">call</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"show()"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(will</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">show</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">fullscreen</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">on</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">device).</span><br>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">SailfishApp::main(argc,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">argv);<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QGuiApplication</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">app</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">SailfishApp</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">application</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">argc</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">argv</span><span style="color:rgb(0,0,0)">);<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QQuickView</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">view</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">SailfishApp</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">createView</span><span style="color:rgb(0,0,0)">();<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">app</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">setQuitOnLastWindowClosed</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">false</span><span style="color:rgb(0,0,0)">);<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">view</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">setSource</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">SailfishApp</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">pathTo</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"qml/background.qml"</span><span style="color:rgb(0,0,0)">));<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">view</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">show</span><span style="color:rgb(0,0,0)">();<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MyTimer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">t</span><span style="color:rgb(0,0,0)">;</span><br>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">qDebug</span><span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Running!"</span><span style="color:rgb(0,0,0)">;<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ret</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">app</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">exec</span><span style="color:rgb(0,0,0)">();<br>
</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">qDebug</span><span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Closes!"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">;</span><br>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ret</span><span style="color:rgb(0,0,0)">;<br>
</span><span style="color:rgb(0,0,0)">}</span></blockquote>
<div><br>
</div>
<div>MyTimer is just a class inherited from QTimer which
prints "Running" each 3 secs. </div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2015-05-02 23:50 GMT-03:00 Andrey
Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Just make gui view in
your application creatable by request and do not quit
application when window is closed.<br>
<br>
<div>03.05.2015 06:27, Nicolas Cisco пишет:<br>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">Hi,
<div>i'm developing a messaging app (server and
client) for a subject at university. The proyect
involves developing a server with a REST
protocol and an android application. In order to
have a real case to use it to compare developing
an app for android and salifish, i thought that
it would be a good idea to also implement the
client for salifish.</div>
<div><br>
</div>
<div>The protocol is quite simple, i already
managed to develop the server, tested via
terminal and send messages using a simple qml
app (basically i'm doing ajax calls). My problem
is how should i poll notifications and messages.
I have to periodically send an ajax call/http
request to an url (eg: <a></a><a>http://</a><server
addr>/notifications) and the server will
answer me with a json with all the new
messages. </div>
<div><br>
</div>
<div>My first idea is that the qml app pulls the
data directly, but, if the app is closed, no
more data is pulled. Can the qml app start a
service (which runs on the backgound) in order
to continue the pulling of data?.</div>
<div><br>
</div>
<div>My second idea is to run a daemon which
periodically pulls displays notification and
communicates with the qml app via dbus. But,
i've read that daemons aren't allowed in harbour
apps, i want to use this prototype as a real
test case of what will be shipping an app to
Harbour. </div>
<div><br>
</div>
<div>Which would be the correct / recommended way
to pull information from a server periodically
(in the background)?.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Nicolas.<br>
-- <br>
<div>Nicolas Cisco<br>
<a href="http://www.nckweb.com.ar" target="_blank">www.nckweb.com.ar</a><br>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></pre>
</blockquote>
<br>
</div>
<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank"></a><a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>Nicolas Cisco<br>
<a href="http://www.nckweb.com.ar" target="_blank">www.nckweb.com.ar</a><br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Nicolas Cisco<br><a href="http://www.nckweb.com.ar" target="_blank">www.nckweb.com.ar</a><br></div>
</div>