# Offline Actions

Applications can define offline (jump list) actions in their .desktop files. These actions are available in the Launcher, AppMenu, HUD and MessagingMenu even if the application is not running. When an offline action is executed and the application is not running the application is started and executes the given action on startup, but for the user it does not make any difference if the application is running or not prior to the action invocation.

This example assumes we have a mail application, MailApp. This application defines offline actions in mail-app.desktop:

    [Desktop Entry]
    Encoding=UTF-8
    Name=Mail Application
    Exec=mail-app %u
    Actions=Compose;Contacts

    [Desktop Action Compose]
    Name=Compose New Message
    OnlyShowIn=Messaging Menu;Lomiri;
    Exec=

    [Desktop Action Contacts]
    Name=Contacts
    OnlyShowIn=Messaging Menu;Lomiri;
    Exec=

The desktop file's Actions key lists the offline actions. Each action then has its own group entry in the .desktop file. MailApp defines two offline actions: Compose and Contacts.

By leaving the Exec keys empty for the actions the platform will invoke the Lomiri Actions defined by the application.

Now, the Application has to define corresponding actions in it's code:

    import QtQuick 2.0
    import Lomiri.Action 1.0

    Item {
        ActionManager {
            Action {
                id: newMessageAction
                name: "Compose" // matches the .desktop file Desktop Action identifier
                onTriggered: {
                    // show the compose view
                }
            }
            Action {
                id: openAddressBookAction
                name: "Contacts" // matches the .desktop file Desktop Action identifier
                onTriggered: {
                    // show the address book view
                }
            }
        }
    }