| Home · All Namespaces · All Classes |
#include <launcher.h>


Classes | |
| class | Placement |
| A class for storing, parsing and ordering the placement information of the items. More... | |
Public Slots | |
| int | focusToButton (const QString &desktopFileEntry) |
| void | setPage (uint page) |
| void | updateButtonState (const QString &desktopEntryPath, LauncherButtonModel::State state, int progress) |
| void | removePlaceholderButton (const QString &desktopEntryPath) |
Signals | |
| void | launcherButtonClicked () |
| void | panningRequested (uint page) |
| void | focusToPageRequested (uint page) |
| void | focusToButtonRequested (const QString &desktopFileEntry) |
Public Member Functions | |
| Launcher (QGraphicsItem *parent=NULL) | |
| virtual | ~Launcher () |
| void | setLauncherDataStore (LauncherDataStore *dataStore) |
| void | setApplicationPackageMonitorListener (ApplicationPackageMonitorListener *packageMonitorListener) |
| void | setMaximumPageSize (int maximumPageSize) |
Widget for launching and browsing installed applications. The widget monitors a desktop file entry directory and creates buttons that represent the applications that can be launched.
For updating the launcher first time from launcher data store, we listen to dataStoreChanged() signal. After the first initialization we disconnect from dataStoreChanged signal and rely on signals for individual updates to provide the changes in desktop entries.
Each application .desktop file must define the Name, Type and Icon keys where type is Application. The Exec key must define the application binary to be launched when the icon is selected.
Example my_application.desktop file:
[Desktop Entry] Version=1.0 Type=Application Name=my_localized_application_name Comment=my_localized_application_comment Exec=/usr/bin/my-app Icon=my_app_icon_id
Definition at line 54 of file launcher.h.
| Launcher::Launcher | ( | QGraphicsItem * | parent = NULL |
) |
Constructs a Launcher widget. The Launcher will not store/restore launcher button positions and entries before a LauncherDataStore has been set using setLauncherDataStore().
| parent | Parent for the widget, defaults to NULL |
Definition at line 57 of file launcher.cpp.
:
MWidgetController(new LauncherModel, parent),
dataStore(NULL),
packageMonitorListener(NULL),
maximumPageSize(-1)
{
}
| Launcher::~Launcher | ( | ) | [virtual] |
| int Launcher::focusToButton | ( | const QString & | desktopFileEntry | ) | [slot] |
Requests Launcher to focus to a Launcher Button specified by a desktop file.
| desktopFileEntry | is application's desktop file. Name should be given in format "filename.desktop" or in absolute path. |
Definition at line 365 of file launcher.cpp.
{
int page = buttonPlacement(desktopFileEntry).page;
if (page >= 0) {
emit focusToButtonRequested(desktopFileEntry);
}
return page;
}

| void Launcher::focusToButtonRequested | ( | const QString & | desktopFileEntry | ) | [signal] |
Signal requesting launcher to focus to an button specified by a desktopfile.
| void Launcher::focusToPageRequested | ( | uint | page | ) | [signal] |
Signal to request moving launcher focus to a page
| void Launcher::launcherButtonClicked | ( | ) | [signal] |
Signal sent when a launcher button was clicked.
| void Launcher::panningRequested | ( | uint | page | ) | [signal] |
Signal to request panning to specific page
| page | number of page to pan to |
| void Launcher::removePlaceholderButton | ( | const QString & | desktopEntryPath | ) | [slot] |
Removes placeholder launcher button for an application if application is not installed.
We can only remove button if it is found from launcher and desktop entry file paths match. Different desktop entry file paths means that button is not placeholder and hence needs to be removed by launcher data store.
| desktopEntryPath | of an application |
Definition at line 149 of file launcher.cpp.
{
Launcher::Placement placement(buttonPlacement(QFileInfo(desktopEntryPath).fileName()));
if (!placement.isNull()) {
QSharedPointer<LauncherPage> page = model()->launcherPages().at(placement.page);
QSharedPointer<LauncherButton> buttonForDesktopEntry = page->model()->launcherButtons().at(placement.position);
// Only remove button if the paths match so that we don't remove installed buttons
if (buttonForDesktopEntry->desktopEntry() == desktopEntryPath) {
removeButtonPlacementFromStore(desktopEntryPath);
removeLauncherButton(desktopEntryPath);
}
}
}

| void Launcher::setApplicationPackageMonitorListener | ( | ApplicationPackageMonitorListener * | packageMonitorListener | ) |
Connects the Launcher to an ApplicationPackageMonitor for monitoring installation and update progress of application packages.
| packageMonitorListener | Listens to signals from application package monitor |
Definition at line 78 of file launcher.cpp.
{
this->packageMonitorListener = packageMonitorListener;
}
| void Launcher::setLauncherDataStore | ( | LauncherDataStore * | dataStore | ) |
Takes a LauncherDataStore into use.
| dataStore | LauncherDataStore for storing launcher button positions and entries |
Definition at line 69 of file launcher.cpp.
{
if (this->dataStore != NULL) {
disconnect(dataStore, SIGNAL(dataStoreChanged()), this, SLOT(updatePagesFromDataStore()));
}
this->dataStore = dataStore;
connect(dataStore, SIGNAL(dataStoreChanged()), this, SLOT(updatePagesFromDataStore()));
}
| void Launcher::setMaximumPageSize | ( | int | maximumPageSize | ) |
Sets the maximum size of the Launcher pages. Negative values are ignored. If a LauncherPage already has more items than the desired maximum the page is not resized.
| maximumPageSize | the maximum number of buttons on a single LauncherPage |
Definition at line 83 of file launcher.cpp.
{
this->maximumPageSize = maximumPageSize;
if (maximumPageSize >= 0) {
foreach (QSharedPointer<LauncherPage> page, model()->launcherPages()) {
page->setMaximumButtonCount(maximumPageSize);
}
}
}
| void Launcher::setPage | ( | uint | page | ) | [slot] |
Set launcher to show a page.
| number | of page to show. |
Definition at line 374 of file launcher.cpp.
{
emit focusToPageRequested(page);
}

| void Launcher::updateButtonState | ( | const QString & | desktopEntryPath, | |
| LauncherButtonModel::State | state, | |||
| int | progress | |||
| ) | [slot] |
Updates the state and operation progress of a launcher button. Creates a new placeholder button if one doesn't exist for the given desktopentryfile.
| desktopEntryPath | Desktop entry of the package that button represents | |
| state | State button should be set to | |
| progress | Progress of operation |
Definition at line 94 of file launcher.cpp.
{
// Check that button is not stored in some other location before adding/updating placeholder and setting state
Launcher::Placement buttonPlacementInDatastore = entryPlacementInDatastore(desktopEntryPath);
if (buttonPlacementInDatastore.location.isEmpty() || buttonPlacementInDatastore.location == Launcher::LOCATION_IDENTIFIER) {
QSharedPointer<LauncherButton> button = placeholderButton(desktopEntryPath);
// Remove old placement from store
// This is needed in case path to used desktop entry has changed between applications and extra directory
removeButtonPlacementFromStore(button->desktopEntry());
button->setState(state, progress, desktopEntryPath);
updateButtonPlacementInStore(desktopEntryPath);
if (!QFileInfo(desktopEntryPath).exists()) {
// In error case that package doesn't have desktop entry yet,
// just remove button from launcher and let launcher data store
// to handle button addition when/if desktop entry comes available
removeLauncherButton(desktopEntryPath);
}
}
}
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:20:42 Doxygen 1.7.1 |
MeeGo Touch |