Thread Tools
velox's Avatar
Posts: 313 | Thanked: 1,056 times | Joined on Dec 2009
There are a few ways to start, but I found the easiest way (for me) was to just install the SailfishOS SDK. The files you get as an entry point when just creating a new project in there are pretty good to "poke at and see what happens". It's basically a "Hello world" as well.
slumber: sensors enabled sleep timer for SFOS (translations/input/ appreciated if you've got some spare time)
talefish: directory based audiobook player for SFOS
nofono: ofono restart for SFOS
list of i486/noarch packages on openrepos (jolla tablet)

The Following User Says Thank You to velox For This Useful Post:
Markkyboy's Avatar
Posts: 256 | Thanked: 324 times | Joined on Oct 2012 @ location, location
Forget it. Sorry I asked. I'll work it out myself.
| Openrepos | T.J.C. |

Don't just sit there standing around, pick up a shovel and sweep up!

The Following User Says Thank You to Markkyboy For This Useful Post:
Posts: 518 | Thanked: 1,391 times | Joined on Feb 2012 @ Germany
Here is my dbus notification example, it was created for testing and understanding purpos to use it in another application.

After birth it was already nearly a small console tool so I added a small help description.
If somebody interested I uploaded it to openrepos as a package.

For dbus related code, scroll to the end please.

/*sfnotify - notification through dbus for sailfish
    Copyright (C) <2017> <Halftux>

    This file is part of sfnotify.

    gpscon is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    gpscon is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with gpscon. If not, see <>.*/

#include <QDebug>
#include <QTextStream>
#include <QStringList>
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusArgument>
#include <QDBusVariant>
#include <QVariantMap>

int main(int argc, char *argv[])
    QString summary, body;
    QStringList arglist;
    int timeout=2000;
    bool showhelp=false;

    if (argc > 1)
        for ( int i = 1; i < argc; i++ )
            //qDebug() << i << argv[i] << argc;
            arglist << argv[i];
        QRegExp rx("summary*");

        int posfind = arglist.indexOf(rx);
        if (posfind!=-1)
            //qDebug() << "summary: " << summary;
        else qDebug() << "no summary detected";

        posfind = arglist.indexOf(rx);
        if (posfind!=-1)
            //qDebug() << "body: " << body;
        else qDebug() << "no body detected";

        posfind = arglist.indexOf(rx);
        if (posfind!=-1)
            //qDebug() << "timeout: " << timeout;
        else qDebug() << "no timeout detected using default value 2000";

        if (arglist.contains("--help") || arglist.contains("-h")) showhelp=true;

    //qDebug() << summary << body << timeout << showhelp;

    if (summary=="" && body=="")
        body="it makes no sense to make a notification without a text. get info with --help";

    if (showhelp)
        QTextStream cout(stdout);
                    cout << endl;
                    cout << "sfnotify v0.0.1 by halftux" << endl << endl;
                    cout << "Options:" << endl;
                    cout << "--------" << endl;
                    cout << "  [--help] help output" << endl;
                    cout << "  [summary='string'] summary text" << endl;
                    cout << "  [body='string'] body text" << endl;
                    cout << "  [timeout=integer] close after x ms" << endl;
        QStringList action_slist;
        action_slist << "default" << "";
        QVariantMap hint_vmap;
        hint_vmap["x-nemo-preview-body"] = QVariant(body);
        hint_vmap["x-nemo-preview-summary"] = QVariant(summary);
        hint_vmap["x-nemo-icon"] = QVariant("icon-m-notifications");

        QDBusConnection bus = QDBusConnection::sessionBus();
        QDBusInterface notify("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", bus);
        QVariantList args;
        args << QString("Appname");
        args << uint(0);
        args << QString("icon-m-notifications");
        args << QString("Summary");
        args << QString("Body");
        args << QStringList(action_slist);
        args << QVariantMap(hint_vmap);
        args << timeout;
        QDBusMessage call = notify.callWithArgumentList(QDBus::Block, "Notify", args);
        uint id = call.arguments().first().toUInt();
        qDebug() << "id:" << id;
    return 0;
My first full application in a forum post.
My way to say thank you for a thread with useful information.

The Following 5 Users Say Thank You to Halftux For This Useful Post:

Thread Tools

Forum Jump

All times are GMT. The time now is 02:40.