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


Public Member Functions | |
| LauncherPage (MWidget *parent=NULL) | |
| void | setMaximumButtonCount (int maximumButtonCount) |
| int | insertButton (QSharedPointer< LauncherButton > button, int positionIndex) |
| bool | appendButton (QSharedPointer< LauncherButton > button) |
| void | removeButton (QSharedPointer< LauncherButton > button) |
| bool | removeButton (const QString &desktopEntryPath) |
| bool | updateButton (const QString &desktopEntryPath) |
| int | launcherButtonPosition (const QString &desktopEntryPath) |
Definition at line 28 of file launcherpage.h.
| LauncherPage::LauncherPage | ( | MWidget * | parent = NULL |
) |
Constructs a LauncherPage
| parent | The parent widget of this page. |
Definition at line 30 of file launcherpage.cpp.
: MWidgetController(new LauncherPageModel, parent) { }
| bool LauncherPage::appendButton | ( | QSharedPointer< LauncherButton > | button | ) |
Tries to appends a button to the end of this page. This is a convenience function for See possible error scenarios there. button Button to be added. whether button was added to page. True if button was added, false if not (eg. if page is full).
Definition at line 58 of file launcherpage.cpp.
{
bool canBeAdded = false;
if (insertButton(button, model()->launcherButtons().size()) >= 0) {
canBeAdded = true;
}
return canBeAdded;
}

| int LauncherPage::insertButton | ( | QSharedPointer< LauncherButton > | button, | |
| int | positionIndex | |||
| ) |
Add button to page. Fixed positions for buttons are not maintained, so when multiple buttons are added, adding order must be position index order to assure inserting to correct index in button list. Two scenarios exist when the button is not added to a page:
The default maximum number of items per page is currently defined as 12.
| button | Button to be added. | |
| positionIndex | Position where button is to be added. |
Definition at line 39 of file launcherpage.cpp.
{
QList< QSharedPointer<LauncherButton> > buttons(model()->launcherButtons());
int insertIndex = -1;
int buttonsCount = buttons.count();
// button can be added if page is not full and the index is sane
if (buttonsCount < model()->maxButtons() && positionIndex < model()->maxButtons()) {
buttons.insert(positionIndex, button);
if (positionIndex < buttonsCount) {
insertIndex = positionIndex;
} else {
insertIndex = buttonsCount;
}
model()->setLauncherButtons(buttons);
}
return insertIndex;
}
| int LauncherPage::launcherButtonPosition | ( | const QString & | desktopEntryPath | ) |
Get position of button from launcher page.
| desktopEntryPath | Desktop entry path of button. |
Definition at line 98 of file launcherpage.cpp.
{
int position = -1;
int buttonIndex = 0;
QString desktopFileName = QFileInfo(desktopEntryPath).fileName();
foreach(QSharedPointer<LauncherButton> button, model()->launcherButtons()) {
if (QFileInfo(button->desktopEntry()).fileName() == desktopFileName) {
position = buttonIndex;
break;
}
buttonIndex++;
}
return position;
}
| bool LauncherPage::removeButton | ( | const QString & | desktopEntryPath | ) |
Remove button from page. Removes a button only if button representing the given desktop entry is found on page.
| desktopEntryPath | Desktop entry path specifying the button to remove |
Definition at line 75 of file launcherpage.cpp.
{
bool contains = false;
int buttonPosition = launcherButtonPosition(desktopEntryPath);
if (buttonPosition >= 0) {
contains = true;
removeButton(model()->launcherButtons().at(buttonPosition));
}
return contains;
}

| void LauncherPage::removeButton | ( | QSharedPointer< LauncherButton > | button | ) |
Remove button from page.
| button | Button to be removed. |
Definition at line 68 of file launcherpage.cpp.
{
QList< QSharedPointer<LauncherButton> > buttons(model()->launcherButtons());
buttons.removeOne(button);
model()->setLauncherButtons(buttons);
}
| void LauncherPage::setMaximumButtonCount | ( | int | maximumButtonCount | ) |
Sets the maximum number of buttons on the page. The page is not resized if it already has more than the desired maximum number of items.
| maximumButtonCount | the maximum number of buttons on the page. |
Definition at line 34 of file launcherpage.cpp.
{
model()->setMaxButtons(maximumButtonCount);
}
| bool LauncherPage::updateButton | ( | const QString & | desktopEntryPath | ) |
Updates a button if button representing the given desktop entry is found from page.
| desktopEntryPath | Desktop entry path to check |
Definition at line 87 of file launcherpage.cpp.
{
bool contains = false;
int buttonPosition = launcherButtonPosition(desktopEntryPath);
if (buttonPosition >= 0) {
contains = true;
model()->launcherButtons().at(buttonPosition)->updateFromDesktopEntry(desktopEntryPath);
}
return contains;
}

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