Getting started with Ubuntu for phones on 12.04

What exciting news! Ubuntu is coming to phones in the near future, and they are already pushing forward for developers to get started on apps for the upcoming OS. The really great part? It is actually Ubuntu running on the phone, so making apps will be pretty much like making applications for Ubuntu on the desktop. Even better? They have chosen Qt and QML as first-class citizens for app-development together with HTML5.

Since I’ve been developing Nanoparticles and Journey Planner for Norway in Qt and QML from before, I’m very excited to again have a platform where these toolkits are at home. With Qt working on Android and the upcoming Sailfish too, it is finally becoming more platform independent in the mobile world as well as on the desktop, where both Windows, Mac and Linux are already well-supported.

The mobile team at Canonical (the guys behind Ubuntu) have already put up a few pages to help us get started with development. You find them here. At first glance they seem pretty useful and easy to grasp, so I look forward to delving deeper into them.

A tiny speed bump kept me from getting started

However, I was faced with a problem when trying to start out going through the steps, and that is the PPA for the QML examples and componants is missing packages for Ubuntu 12.04, which I’m currently running. This lead to the following error messages upon doing “apt-get update”:

W: Failed to fetch  404  Not Found
W: Failed to fetch  404  Not Found
W: Failed to fetch  404  Not Found

I figured these packages are likely not really dependent on anything special in Ubuntu 12.10 that is not already in 12.04, so getting around this problem was as easy as to go to the Launchpad PPA directory and download the packages directly: UI Toolkit PPA

After doing this, I’m now ready to get started with the rest of the tutorials.


Norwegian keyboard on the N950

The N950 is delivered with a keyboard without Norwegian keys, so I decided to map holding the function/arrow key and pressing comma (,), period (.) or asterix (*) to ø, æ and å, respectively.

I you are Norwegian and just want this to work straight away, you can do the following on your device:

ssh root@localhost
cp /usr/share/X11/xkb/symbols/nokia_vndr/rm-680 /usr/share/X11/xkb/symbols/nokia_vndr/rm-680-backup
cp rm-680 /usr/share/X11/xkb/symbols/nokia_vndr/
setxkbmap -model nokiarm680 -layout us

And that should do the trick. The keys are mapped as follows:

FN + .             æ
FN + ,             ø
FN + *             å
FN + SHIFT + .     Æ
FN + SHIFT + ,     Ø
FN + SHIFT + *     Å

If you’re speaking a different language and just want to edit the keymap manually, you can open up the rm-680 keymap file Continue reading Norwegian keyboard on the N950

Handling locked screen event in Qt for Maemo

If you want to pause an application to save battery power when the screen is turned off, you can do this by listening for the locked screen event in Qt for Maemo. However, this is not made easily available through a wrapper function (that I know of), so in this case we’ll need to resort to listening for the right DBus call. (Thanks to Diph from for providing the recipe to make this possible.)

First of all, you’ll need to enable dbus in your project (.pro) file:

maemo5 {
    CONFIG += qdbus

Next up, in your .h file you should add the following to import the DBus headers:

#ifdef Q_WS_MAEMO_5
#include <QtDBus/QtDBus>

And you’ll need to add a slot for the screen state change:

Continue reading Handling locked screen event in Qt for Maemo

Handling application minimization in Maemo with Qt

When you are developing with Qt on Maemo you might want to minimize or detect minimization of your application to the dashboard. Qt lacks clean functions for these use cases, but thankfully it’s still very easy to accomplish them.

Minimizing the application

First of all, to minimize your application you’ll need to add the following CONFIG line to your project file (the .pro file):

maemo5 {
    CONFIG += qdbus

Then, in your .cpp or .h file, you’ll need to include the QtDBus headers:

#ifdef Q_WS_MAEMO_5
#include <QtDBus/QtDBus>

You may of course skip the #ifdef statements if you’d like DBus for other systems as well, but here I’d like to make this exception only for Maemo. Now, anywhere in your application you may add the following lines to minimize to Maemo’s dashboard:

Continue reading Handling application minimization in Maemo with Qt

Trafikanten on Maemo

Update: The package was pushed to Extras testing on 2nd of October. It was delayed because Maemo’s package repository would not import the new package due to some trouble with the version numbering.

There has been missing a native application to access information from Trafikanten on the Nokia N900. Instead it has been necessary to use the mobile version of their websites or maybe even the full version. Even though this is a pretty quick and workable solution, there are several benefits of having a native application available. One that becomes very obvious is the use of GPS to find all nearest bus stops or train stations.

I decided to give it a try in June this year and started by releasing some early versions of what is now named “Journey Planner for Norway” (which is “Reiseplanlegger” in Norwegian). During the summer of 2010 I have been trying to improve the application over several iterations, and feel that it has now come to a point where it is usable and stable enough to get the infamous “Version 1.0” attached to it.

The application is now finding its way through to the Extras-devel catalogue for Maemo and will be pushed upwards through Extras-testing before it hopefully hits Extras within two or three weeks. In the meantime you might either be a bit careless and enable Extras-devel to use the bleeding edge 1.0 version or head over to Maemo Downloads to fetch the beta which will be automatically updated to 1.0 whenever it is ready.

Below you can check out some more screenshots of the application in action:

The application is developed in C++ using Qt with the Qt Mobility libraries. It should not be too hard to port it to Symbian as well, so I will give that a shot in the future. Symbian users does however already have an option to use the Java application “Trafikanten Sanntid” made by Håvard Tegelsrud.

And of course, you can check out the source code here. The application is licensed with the GNU GPLv3 license.

Skip the packaging step in Qt Creator 2.0

I just figured that Qt Creator is now packaging every Maemo application whenever you tell it to run one. This might be annoying if packaging fails and will in any case slow down the whole process of debugging. However, if you want to skip the packaging step, this is not an option in Qt Creator 2.0(!).

Luckily the Qt developers over at Nokia are aware of this and have released a fix in the latest builds of Qt Creator. To acquire these, go to Qt’s snapshot homepage or just download the 32-bit or 64-bit versions for Linux directly from the build made on 12th of July.

Now you may select to skip the packaging by editing the build steps in Qt Creator.

Be aware that the snapshot versions are in development and may have bugs causing irrevocable data loss. That’s the risk you’ve got to take these days to avoid those bloated packages.

Connect to your N900 while developing via usb

If you are developing for Nokia N900 using the Nokia Qt SDK, you are most likely following this guide to set up your environment. This is all nice and easy, but if you are connecting using usb you have to open a terminal each time you plug in your N900 and write

ifconfig usb0 up

If you, like me, get tired of doing this you may instead let Network Manager in Gnome do the work for you. First of all, connect your N900 via an available USB port. Next, right click the Network Manager icon and hit “Edit Connections…”.

Continue reading Connect to your N900 while developing via usb