<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true">
<div id="smartTemplate4-quoteHeader">Sun, 9 Dec 2018 14:40:30
+0200 Rinigus:</div>
<blockquote type="cite"
cite="mid:CA+4hNMEpVvu9HeBcFU0sOCURq_JW-a7HtQH9s2TQG8G-sLHzhA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Hi,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I would like
to add geo: handling into Pure Maps. While command line
arguments can be used through Qt.application.arguments in QML,
its not very clear how to take into account already running
instance. Namely, we are expected to have only one instance of
application running and as a result, if some other application
calls geo: handler, it is expected that the map application
will become active and show corresponding location.</div>
</div>
</blockquote>
<p>Yep, that's how I would expect it to work on Sailfish OS as well.
<br>
</p>
<p>For the record proper support for CLI arguments with the QML
interface on Sailfish OS is also on my TODO list for modRana and
it sounds like it might be a good idea to bump it up to keep
functional parity with Poor Maps in this regard. :)<br>
</p>
<blockquote type="cite"
cite="mid:CA+4hNMEpVvu9HeBcFU0sOCURq_JW-a7HtQH9s2TQG8G-sLHzhA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">If I would
have full control over application start, as in C++
applications, I would probably made:</div>
<div class="gmail_default" style="font-size:small">* DBus
interface</div>
<div class="gmail_default" style="font-size:small">* on start
checked whether such interface is active/available. </div>
<div class="gmail_default" style="font-size:small">* If active
DBus interface is there, would have called corresponding DBus
method and exited</div>
<div class="gmail_default" style="font-size:small">* If not,
started full application</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">QML/Python
apps, such as Pure Maps, are started using sailfish-qml. This
arrangement, as far as I can see, prevents such handling.</div>
</div>
</blockquote>
<p>I wonder if maybe some non-graphical QML code could be executed
before sailfish-qml shows the window. Then potentially the QML
coude could check via the QML DBUS bindings if the application is
already running and forward it the command line arguments and then
exit. Or start is as normal if no instance is already running.<br>
</p>
<p>Alternatively, this could be something that could be built into
the sailfish-qml utility itself - the system has some accounting
of what's already running so that you will get the already running
instance if there is one or a new one gets started. Possibly
something similar could be used to check if an instance is already
running & forwarding the argv to it via say well known DBUS
API or equivalent. In any case source for sailfish-qml seems to be
here:</p>
<p><a class="moz-txt-link-freetext" href="https://github.com/sailfishos/libsailfishapp/blob/master/launcher/launcher.cpp">https://github.com/sailfishos/libsailfishapp/blob/master/launcher/launcher.cpp</a><br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CA+4hNMEpVvu9HeBcFU0sOCURq_JW-a7HtQH9s2TQG8G-sLHzhA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-size:small"> It looks to
me that I should write some kind of launcher (Python probably)
that could be used to either communicate with the main
application via DBus or start the full application. </div>
</div>
</blockquote>
<p>Yep, that should work & is a solution that does not need
immediate help from Jolla developers while still could be shared
between insterested community projects. DBUS should be easy to use
from Python on Sailfish OS via Pydbus:</p>
<p><a class="moz-txt-link-freetext" href="https://together.jolla.com/question/181809/how-to-using-dbus-from-python-on-sailfish-os/">https://together.jolla.com/question/181809/how-to-using-dbus-from-python-on-sailfish-os/</a></p>
<p>The case where the application is already running is IMHO simple
- check for the DBUS API being up and forward either the full CLI
arguments or potentially even individual actions (I think it
should be much easier to parse the arguments in Python than in
plain QML) to the API, then exit.</p>
<p>In case the application is *not* running at the time I'm not 100%
sure - I guess the Python code would run sailfish-qml to start the
application as usual, forwarding the CLI arguments ? A couple
things are unclear to me at the moment:</p>
<p>- Can sailfish-qml actually forward CLI arguments in a way the
application can access them from either QML or Python ?</p>
<p>- What will happen with the Python instance used for the launcher
? I wonder if it might lead to slightly increased memory usage if
it continues running due to sailfish-qml running being it's child
process & if it is possible to execute sailfish-qml in such a
way that the Python process can exit.</p>
<p>- What we be the delay of a Python process starting first,
followed by sailfish-qml vs sailfish-qml starting directly ? This
would likely be insignificant but could still be a good idea to
measure just in case. Also I guess (based on my *very* limited
understanding of this) all the re-loading/boosting machinery used
by Sailfish OS should hopefully be unaffected as long as the QML
code is launched via sailfish-qml or other libsailfishapp based
launcher.<br>
</p>
<blockquote type="cite"
cite="mid:CA+4hNMEpVvu9HeBcFU0sOCURq_JW-a7HtQH9s2TQG8G-sLHzhA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Or am I
wrong? Maybe there is some better idea for implementation of
such functionality?</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Cheers,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Rinigus</div>
</div>
</blockquote>
<p>Best Wishes</p>
<p>Martin Kolman<br>
</p>
<blockquote type="cite"
cite="mid:CA+4hNMEpVvu9HeBcFU0sOCURq_JW-a7HtQH9s2TQG8G-sLHzhA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-size:small"><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></pre>
</blockquote>
<br>
<div id="smartTemplate4-template">
<p> </p>
</div>
</body>
</html>