browsercore/core/actionjsobject.cpp
changeset 0 1450b09d0cfd
child 3 0954f5dd2cd0
equal deleted inserted replaced
-1:000000000000 0:1450b09d0cfd
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "actionjsobject.h"
       
    19 
       
    20 #include <QDebug>
       
    21 
       
    22 ActionJSObject::ActionJSObject(QObject *parent, QAction *action) 
       
    23     : QObject(parent),
       
    24       m_action(action)
       
    25 {
       
    26     connect(m_action, SIGNAL(triggered(bool)), this, SIGNAL(triggered(bool)));
       
    27     connect(m_action, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
       
    28     connect(m_action, SIGNAL(changed()), this, SIGNAL(changed()));
       
    29     
       
    30     // Copy object name of action.
       
    31     setObjectName(action->objectName());
       
    32 }
       
    33 
       
    34 void ActionJSObject::initClass() {   // static
       
    35     qMetaTypeId<QObjectList>();
       
    36     qRegisterMetaType<QObjectList>("QObjectList");
       
    37 
       
    38     qMetaTypeId<ActionJSObject*>();
       
    39     qRegisterMetaType<ActionJSObject>("ActionJSObject*");
       
    40 }
       
    41 
       
    42 void ActionJSObject::trigger() { 
       
    43     if(m_action) {
       
    44         qDebug() << "ActionJSObject::trigger: " << m_action->text(); 
       
    45         m_action->trigger(); 
       
    46     }
       
    47 }