Ivan Čukić

Whatever you want, whatever you like

There are some news in the Plasma, Lancelot, Shelf, QML components, blah blah whoop whoop land. As some of the people have noticed from the previous screenshots, I’ve begun working on a QML port of Lancelot.

The Launcher building toolkit

In Lancelot 1, I decided that it would be awesome to allow people to put parts of it on the desktop or panel or wherever even without using the Lancelot menu. Those were implemented as the Shelf (formerly known as Lancelot Parts) applet.

This time, for what will be known as Lancelot 2 I decided to go one step further – to break everything into QML components, be it data models or UI elements.

Lancelot UI Components

Now, you need only a few lines of QML to replicate the same functionality of the Shelf applet (the first column in the screenshot). The second is essentially the same, but uses the IconView.

LancelotComponents.ListView {
    modelsList: [
        LancelotModels.FavoriteApplications {},
        LancelotModels.ContactsTelepathy {},
        LancelotModels.Devices {}
    ]
}

You don’t need to stop there – you can create custom widgets and pass custom delegates (third column), custom item views (all the models have the same API) etc.

Lancelot specific

The menu itself is also going to be as changeable as possible – now that the UI is based on QML, the users will be able to create different layouts, and share them on the kde-look.org. So, for anyone who desired a simpler menu, a menu that shows the items in a grid of icons, and not in a list, for anyone who … I can only say – it will be possible.

It will even be possible to create a telepathy quick-send-message applet if you want to.

Maybe even the April 1st joke from a few years ago will be a fair game.

Lancelot - Raptor Mode

Activities need a volunteer or two

Good day everyone. I need a brave soul (or two) who have the guts to add a long-standing missing feature to the Activities system …

THE UNIT TESTING FRAMEWORK

… I know, I know. It is far from being a thrilling work, but everyone would benefit from it.

I’ve started introducing asserts all over the code to make it more predictable and tested at runtime, but that is not enough. Asserts are there to check whether somebody is abusing kactivitymanagerd, while unit testing will be for when we (whoever works on kamd) are using some methods in a wrong fashion.

Glow with the power of Awesome

Marco announced a new version (rework) of the Air theme for Plasma.

That reminded me of the fact I forgot to blog about the new version of Slim Glow that will be in 4.10.

The most noticeable change is that the system tray icons, share-like-connect icons, and others are now based on the awesome Font Awesome by Dave Gandy (http://fortawesome.github.com/Font-Awesome)

The second is that it is now even slimmer. The desktop widgets have smaller border, especially those like the folder view.

The theme is now again a regular citizen of kde-look.org. Since the non-default themes were moved from standard installations into kdegraphics module, I started receiving requests to make the theme available through the Get Hot New Stuff since rarely anyone wants to install kdegraphics kdeartwork. I understood the desire for this, so I complied.

Welcome to the family [Activities, Apps, SLC]

You say you want a revolution
Well, you know
We all want to change the world
You tell me that it’s evolution
Well, you know
We all want to change the world

~ The Beatles (John Lennon)

Calligra-SLC

I don’t know whether it is revolution, or evolution, but my favourite ideas that the Plasma team thought of a long time ago are finally getting to the users.

It is quite nice to see the positive experiences with the activities system in Plasma 4.9 all around the web. And that was just the tip of the iceberg. There are a few nice things coming to the following release.

The top feature for me is going to be the Share-Like-Connect applet, and the document scoring based on the usage. Lately, I’ve been on a patching spree to increase the number of applications that support activities and the number has increased substantially. Currently, these are the supported applications:

  • Dolphin
  • Gwenview
  • Kate and KWrite
  • Okular
  • Words, Stage and the rest of the Calligra family (except for Kexi which will be patched soon)
  • GVim

I plan to add a few applications to this list before the hard feature freeze slaps me in the face.

Thankfully, I’m not alone in this endeavour. (Edit: added the link for the following text) Tomaz Canabrava’s army of students are going through KDE’s extragear and doing the same thing I’m doing in integral parts of KDE SC. This really offloads a lot of work off my shoulders so big kudos to them!

Activities Settings

Active 3 for KDE’s 16th birthday

Well, it is not really KDE‘s birthday today, but it isn’t far off.

You can read the announcement or go directly to the site of the new version of Active.

You can also see a short video demo directed and performed by Marco:

OGG version

I haven’t been much involved with this release apart from under the hood stuff that Active and desktop versions share, and the new website design. So, when testing the new image, I experienced the thrill the regular users do. It is a good feeling :)

Activities in QML

From the “Soon to be in master” files, comes a screenshot depicting two new QML data components from the org.kde.activities.models package – ActivityModel and ResourceModel

KArl

Both are available as standard C++ and QML models. The ActivityModel does just what the name says – lists activities, while ResourceModel is more fun – it lists the resources opened by a specific application, or those tied to a specific activity, … and it can order by the score, recentness …

CodeQtStyle or the_old_school

Just something I wanted to share. Today, I caught myself using two different naming conventions in the same code.

One is the camel-case style like Qt uses, and the other is the underscore style that STL and boost use.

It turned out that I use camel-case for everything except for when writing generic stuff like algorithms (to follow things like std::for_each, std::find_if) or special helper template classes.

For example kamd::util::for_each_assoc, model_insert (class that does RAII equivalent of beginInsertRows/endInsertRows).

Strangely enough, it feels natural. More natural than having names like qLowerBound, qBinaryFind…

Time to rely less on MySQL?

KDE software tends to require mysql as the database engine (either a hard requirement like Amarok, or recommended backend like in Akonadi) so things like these genuinely worry me:

Disappearing test cases or did another part of MySQL just become closed source?

Thoughts? MariaDB? PostgreSQL? …

p.s. I don’t have influence on amarok nor akonadi, just want to see what the people think

Implementing basic activity support in your application

Dolphin got the ability to send the events when the user opens a directory to the activity manager. It is quite a small patch that I decided to share in order to demonstrate how easy it is to use KActivities API

Simple example

Find the widget that displays your document (in this case, a folder). Declare one KActivities::ResourceInstance object inside it

KActivities::ResourceInstance * 
        m_activityResourceInstance;

When you create the container, just create a new ResourceInstance and pass the window id (of the top-level window that your container resides in) and the url you just opened:

DolphinViewContainer::DolphinViewContainer
    (const KUrl& url, QWidget* parent)
{
    :::

    #ifdef KActivities_FOUND
    m_activityResourceInstance
        = new KActivities::ResourceInstance(
            window()->winId(), url
        );
    m_activityResourceInstance->setParent(this);
    #endif

    :::
}

This is it if you have a SDI (single-document interface) – interface where one main window can contain only one document (okular, kwrite etc.)

MDI

If you have a possibility to have multiple documents inside one window (dolphin, konqueror, kate etc.), you’ll need to do some additional things:

If your component lost the user’s focus (switched to another document), call:

    m_activityResourceInstance->notifyFocusedOut()

When it receives the focus, call:

    m_activityResourceInstance->notifyFocusedIn()

And when the url of the document that is shown changes (user opens another file, navigates to another web page), just call:

    m_activityResourceInstance->setUri(newUrl);

This is all.

Why?

This info is used for the share-like-connect applet and to rank the locations users visit. This can be, in turn, used to sort applications, documents etc. in krunner based on the ranking; to show most recent documents for pinned applications in the task bar etc.

Privacy

Although every system tracks the user’s behaviour in some way, it might not be something the user desires. This will be configurable – see this for more info

For the whole ResourceInstance API, see: api.kde.org/KActivities::ResourceInstance

Build multiple targets and commit

I’ve just committed a helper script to KDE Activities that gets into all different build directories for the project you’re compiling, and runs the compilation. If all compiles successfully, it calls git commit.

I have decided to compile kactivities on a regular basis with GCC 4.7 (my default compiler), GCC 4.5 and Clang 3.1 to ensure no compiler specific things are being used, and no C++11 features that GCC 4.5 doesn’t support.

If anyone is interested, here it is:

#!/bin/bash

# The script finds build directories for the current
# src directory and builds them
#
# For example, for the source dir:
#   /some/path/kde/src/project/whatever
# It finds:
#   /some/path/kde/build*/project/whatever

current_dir=`pwd`

all_root_dir=`pwd | sed 's#/src/.*##'`
src_root_dir=$all_root_dir/src

echo "src:   $src_root_dir"

for build_root_dir in $all_root_dir/build*; do
    echo "building in $build_root_dir"

    cd $current_dir
    current_dir_log=`OBJ_REPLACEMENT=s#$src_root_dir#$build_root_dir# makeobj`
    if [ "$?" = "0" ]
    then
        echo "... success"
    else
        echo "... FAILED"
        echo $current_dir_log
        exit
    fi
done

git commit