ginebra2/Application.cpp
changeset 16 3c88a81ff781
parent 12 afcd8e6d025b
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
    18 * Description:
    18 * Description:
    19 *
    19 *
    20 */
    20 */
    21 
    21 
    22 #include <QtGui>
    22 #include <QtGui>
       
    23 #include <QAction>
    23 #include "Application.h"
    24 #include "Application.h"
    24 
    25 
    25 #ifdef Q_OS_SYMBIAN
    26 #ifdef Q_OS_SYMBIAN
    26 #include <eikenv.h>
    27 #include <eikenv.h>
    27 #include <apgtask.h>                // TApaTaskList, TApaTask
    28 #include <apgtask.h>                // TApaTaskList, TApaTask
    64 
    65 
    65 void GinebraApplication::debug(const QString &msg) {
    66 void GinebraApplication::debug(const QString &msg) {
    66       qDebug() << msg;
    67       qDebug() << msg;
    67 }
    68 }
    68 
    69 
       
    70 QObject *GinebraApplication::createAction(const QString &text, const QString &iconPath, bool checkable) {
       
    71     // Note: the object created here won't be garbage collected by the script engines but will be deleted
       
    72     // at shutdown because it is a child of the GinebraApplication object.  Unused actions should be
       
    73     // deleted by hand from javascript using the delete operator.
       
    74     QAction *action = new QAction(this);
       
    75     action->setText(text);
       
    76     
       
    77     #ifdef Q_WS_MAEMO_5
       
    78     action->setCheckable(checkable);
       
    79 
       
    80     if(!iconPath.isEmpty()) {
       
    81         action->setIcon(QIcon(iconPath));
       
    82         action->setIconVisibleInMenu(true);
       
    83     }
       
    84     #endif
       
    85     
       
    86     return action;
       
    87 }
       
    88 
    69 QString GinebraApplication::layoutType() {
    89 QString GinebraApplication::layoutType() {
    70 
    90 
    71     QString layout;
    91     QString layout;
    72 #ifdef BROWSER_LAYOUT_TENONE
    92 #ifdef BROWSER_LAYOUT_TENONE
    73     layout = "tenone";
    93     layout = "tenone";
    76 #endif
    96 #endif
    77 
    97 
    78     return layout;
    98     return layout;
    79 }
    99 }
    80 
   100 
       
   101 void GinebraApplication::addMenuBarAction(QObject *action) {
       
   102     QAction *a = dynamic_cast<QAction *>(action);
       
   103     if(a) {
       
   104         emit addMenuBarActionRequest(a);
       
   105     }
       
   106     else {
       
   107         qDebug() << "GinebraApplication::addMenuBarAction: invalid argument";
       
   108     }
       
   109 }
       
   110 
       
   111 void GinebraApplication::setMenuBarEnabled(bool value) {
       
   112     emit setMenuBarEnabledRequest(value);
       
   113 }
       
   114 
    81 
   115 
    82 }
   116 }