diff -r 6aeb7a756187 -r 3c88a81ff781 ginebra2/Application.cpp --- a/ginebra2/Application.cpp Thu Sep 23 15:32:11 2010 -0400 +++ b/ginebra2/Application.cpp Fri Oct 15 17:30:59 2010 -0400 @@ -20,6 +20,7 @@ */ #include +#include #include "Application.h" #ifdef Q_OS_SYMBIAN @@ -66,6 +67,25 @@ qDebug() << msg; } +QObject *GinebraApplication::createAction(const QString &text, const QString &iconPath, bool checkable) { + // Note: the object created here won't be garbage collected by the script engines but will be deleted + // at shutdown because it is a child of the GinebraApplication object. Unused actions should be + // deleted by hand from javascript using the delete operator. + QAction *action = new QAction(this); + action->setText(text); + + #ifdef Q_WS_MAEMO_5 + action->setCheckable(checkable); + + if(!iconPath.isEmpty()) { + action->setIcon(QIcon(iconPath)); + action->setIconVisibleInMenu(true); + } + #endif + + return action; +} + QString GinebraApplication::layoutType() { QString layout; @@ -78,5 +98,19 @@ return layout; } +void GinebraApplication::addMenuBarAction(QObject *action) { + QAction *a = dynamic_cast(action); + if(a) { + emit addMenuBarActionRequest(a); + } + else { + qDebug() << "GinebraApplication::addMenuBarAction: invalid argument"; + } +} + +void GinebraApplication::setMenuBarEnabled(bool value) { + emit setMenuBarEnabledRequest(value); +} + }