| 1 |
/*! |
| 2 |
\page offline-actions.html Offline Actions |
| 3 |
\title Offline Actions |
| 4 |
\contentspage {Lomiri Action API} |
| 5 |
|
| 6 |
Applications can define offline (jump list) actions in their \e {.desktop} files. These actions are available in the Launcher, |
| 7 |
AppMenu, HUD and MessagingMenu even if the application is not running. When an offline action is executed and the application |
| 8 |
is not running the application is started and executes the given action on startup, but for the user it does not make any |
| 9 |
difference if the application is running or not prior to the action invocation. |
| 10 |
|
| 11 |
|
| 12 |
This example assumes we have a mail application, \e {MailApp}. This application defines offline actions in \e {mail-app.desktop}: |
| 13 |
\quotefile mail-app/mail-app.desktop |
| 14 |
|
| 15 |
The desktop file's \e {Actions} key lists the offline actions. Each action then has its own group entry in the \e {.desktop} file. |
| 16 |
\e {MailApp} defines two offline actions: \e {Compose} and \e {Contacts}. |
| 17 |
|
| 18 |
By leaving the \e {Exec} keys empty for the actions the platform will invoke the Lomiri Actions defined by the application. |
| 19 |
|
| 20 |
Now, the Application has to define corresponding actions in it's code: |
| 21 |
\code |
| 22 |
import QtQuick 2.0 |
| 23 |
import Lomiri.Action 1.0 |
| 24 |
|
| 25 |
Item { |
| 26 |
ActionManager { |
| 27 |
Action { |
| 28 |
id: newMessageAction |
| 29 |
name: "Compose" // matches the .desktop file Desktop Action identifier |
| 30 |
onTriggered: { |
| 31 |
// show the compose view |
| 32 |
} |
| 33 |
} |
| 34 |
Action { |
| 35 |
id: openAddressBookAction |
| 36 |
name: "Contacts" // matches the .desktop file Desktop Action identifier |
| 37 |
onTriggered: { |
| 38 |
// show the address book view |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
\endcode |
| 44 |
|
| 45 |
*/ |