Home · All Namespaces · All Classes
Public Member Functions | Properties

LauncherButton Class Reference

#include <launcherbutton.h>

Inheritance diagram for LauncherButton:
Inheritance graph
[legend]
Collaboration diagram for LauncherButton:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LauncherButton (const QString &desktopEntryPath=QString(), MWidget *parent=0)
virtual ~LauncherButton ()
void setAction (const LauncherAction &action)
 Sets the action to launch the application described by the desktop file.
LauncherAction action () const
 Returns the action to launch the application described by the desktop file.
QString desktopEntry () const
LauncherButtonModel::State buttonState () const
void updateFromDesktopEntry (const QString &desktopEntryPath)
void retranslateUi ()
void setState (LauncherButtonModel::State state, int progress, const QString &desktopEntryPath)
int operationProgress () const

Properties

QString desktopEntryPath
LauncherButtonModel::State buttonState
int operationProgress

Detailed Description

Button widget that can launch an application when its being clicked.

User has to set the target to be launched using setTarget() method and the target type using the setTargetType() method. The target type can be an Application. If the target type is an Application and the target is set this button widget launches the specified application into its own process when the button is clicked.

Definition at line 41 of file launcherbutton.h.


Constructor & Destructor Documentation

LauncherButton::LauncherButton ( const QString &  desktopEntryPath = QString(),
MWidget *  parent = 0 
)

Creates a launcher button instance from a MDesktopEntry.

Parameters:
desktopEntryPath Path to the desktop entry to create a launcher button from
parent the parent widget, defaults to NULL

Definition at line 30 of file launcherbutton.cpp.

                                                                               :
        MButton(parent, new LauncherButtonModel),
        windowMonitor(new HomeWindowMonitor)
{
    init();

    updateFromDesktopEntry(desktopEntryPath);
}

LauncherButton::~LauncherButton (  )  [virtual]

Destroys the Launcher.

Definition at line 39 of file launcherbutton.cpp.

{
}


Member Function Documentation

LauncherAction LauncherButton::action (  )  const

Returns the action to launch the application described by the desktop file.

Returns:
The action to launch the application

Definition at line 54 of file launcherbutton.cpp.

{
    return model()->action();
}

LauncherButtonModel::State LauncherButton::buttonState (  )  const

Returns current button state.

Returns:
the button state.
QString LauncherButton::desktopEntry (  )  const

Returns the file name of the desktop entry where this launcher button was constructed from.

Returns:
the desktop entry file name.

Definition at line 59 of file launcherbutton.cpp.

{
    return model()->desktopEntryFile();
}

int LauncherButton::operationProgress (  )  const

Returns progress of button's ongoing operation

Returns:
operation progress
void LauncherButton::retranslateUi (  ) 

Handles the language change notification and propagets is to MButton.

Definition at line 94 of file launcherbutton.cpp.

{
    if (!desktopEntry().isNull()) {
        setText(action().localizedName());
    }
    MButton::retranslateUi();
}

Here is the call graph for this function:

void LauncherButton::setAction ( const LauncherAction action  ) 

Sets the action to launch the application described by the desktop file.

Parameters:
action The action to launch the application

Definition at line 49 of file launcherbutton.cpp.

{
    model()->setAction(action);
}

void LauncherButton::setState ( LauncherButtonModel::State  state,
int  progress,
const QString &  desktopEntryPath 
)

Sets the state and progress of a button Progress property is changed only if parameter progress is valid (0..100)

Parameters:
state State of a button
progress Progress of operation
desktopEntryPath Path to the desktop entry.

Definition at line 114 of file launcherbutton.cpp.

{
    model()->setButtonState(state);
    if (progress >= 0 && progress <= 100) {
        model()->setOperationProgress(progress);
    }

    // Override the current desktop entry when changing to broken or installed state
    if (state == LauncherButtonModel::Broken || state == LauncherButtonModel::Installed) {
        updateFromDesktopEntry(desktopEntryPath);
    }
}

Here is the call graph for this function:

void LauncherButton::updateFromDesktopEntry ( const QString &  desktopEntryPath  ) 

Updates button from given desktop entry.

Parameters:
desktopEntryPath Path to the desktop entry to update the button from.

Definition at line 102 of file launcherbutton.cpp.

{
    if (!desktopEntryPath.isEmpty()) {
        LauncherAction action(desktopEntryPath);

        setText(action.localizedName());

        model()->setDesktopEntryFile(desktopEntryPath);
        setAction(action);
    }
}

Here is the call graph for this function:


Property Documentation

LauncherButtonModel::State LauncherButton::buttonState [read]

Definition at line 47 of file launcherbutton.h.

QString LauncherButton::desktopEntryPath [read]

Definition at line 46 of file launcherbutton.h.

int LauncherButton::operationProgress [read]

Definition at line 48 of file launcherbutton.h.


The documentation for this class was generated from the following files:

Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:20:42
Doxygen 1.7.1
MeeGo Touch