summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-10-20 13:15:51 (GMT)
committeraxis <qt-info@nokia.com>2009-10-21 10:56:50 (GMT)
commit5370e5ff5481a64a7d4a7c182155ce893740abe0 (patch)
tree7c10423b6a446ce537d60cbae33e6b9ce8e4c7ae /src
parent3ce94323a886abf6047135f188a6e10082a3e28d (diff)
downloadQt-5370e5ff5481a64a7d4a7c182155ce893740abe0.zip
Qt-5370e5ff5481a64a7d4a7c182155ce893740abe0.tar.gz
Qt-5370e5ff5481a64a7d4a7c182155ce893740abe0.tar.bz2
Cleaned up the API of the Symbian event hooks.
The two major points were: - Replacing "s60" with "symbian" in all event handling functions, since there is nothing S60-specific about them. - Replace the Symbian event types with the encapsulating QSymbianEvent container. This allows us to cope with more types of events in the future without having to add new virtual functions. AutoTest: QWidget passed Task: QT-1156 RevBy: Jason Barron RevBy: Shane Kearns RevBy: Sami Merila
Diffstat (limited to 'src')
-rw-r--r--src/gui/inputmethod/qinputcontext.cpp14
-rw-r--r--src/gui/inputmethod/qinputcontext.h13
-rw-r--r--src/gui/kernel/qapplication.h12
-rw-r--r--src/gui/kernel/qapplication_p.h5
-rw-r--r--src/gui/kernel/qapplication_s60.cpp108
-rw-r--r--src/gui/kernel/symbian.pri3
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp23
-rw-r--r--src/gui/styles/qs60style.h2
-rw-r--r--src/gui/symbian/qsymbianevent.cpp143
-rw-r--r--src/gui/symbian/qsymbianevent.h104
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp8
-rw-r--r--src/gui/widgets/qmenubar_p.h2
12 files changed, 361 insertions, 76 deletions
diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/gui/inputmethod/qinputcontext.cpp
index 8ee417f..ea6ed35 100644
--- a/src/gui/inputmethod/qinputcontext.cpp
+++ b/src/gui/inputmethod/qinputcontext.cpp
@@ -467,32 +467,32 @@ bool QInputContext::x11FilterEvent(QWidget * /*keywidget*/, XEvent * /*event*/)
}
#endif // Q_WS_X11
-#ifdef Q_WS_S60
+#ifdef Q_OS_SYMBIAN
/*!
\since 4.6
This function may be overridden only if input method is depending
- on Symbian and you need raw TWsEvent. Otherwise, this function must not.
+ on Symbian and you need raw Symbian events. Otherwise, this function must not.
- This function is designed to filter raw key events on S60, but
+ This function is designed to filter raw key events on Symbian, but
other input methods may use this to implement some special
features.
Return true if the \a event has been consumed. Otherwise, the
unfiltered \a event will be translated into QEvent and forwarded
- to filterEvent(). Filtering at both s60FilterEvent() and
+ to filterEvent(). Filtering at both symbianFilterEvent() and
filterEvent() in single input method is allowed.
\a keywidget is a client widget into which a text is inputted. \a
- event is inputted TWsEvent.
+ event is inputted QSymbianEvent.
\sa filterEvent()
*/
-bool QInputContext::s60FilterEvent(QWidget * /*keywidget*/, TWsEvent * /*event*/)
+bool QInputContext::symbianFilterEvent(QWidget * /*keywidget*/, const QSymbianEvent * /*event*/)
{
return false;
}
-#endif // Q_WS_S60
+#endif // Q_OS_SYMBIAN
QT_END_NAMESPACE
diff --git a/src/gui/inputmethod/qinputcontext.h b/src/gui/inputmethod/qinputcontext.h
index 73b05d8..14096e3 100644
--- a/src/gui/inputmethod/qinputcontext.h
+++ b/src/gui/inputmethod/qinputcontext.h
@@ -67,10 +67,6 @@
QT_BEGIN_HEADER
-#ifdef Q_WS_S60
-class TWsEvent;
-#endif
-
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
@@ -79,6 +75,9 @@ class QWidget;
class QFont;
class QPopupMenu;
class QInputContextPrivate;
+#ifdef Q_OS_SYMBIAN
+class QSymbianEvent;
+#endif
class Q_GUI_EXPORT QInputContext : public QObject
{
@@ -108,9 +107,9 @@ public:
#if defined(Q_WS_X11)
virtual bool x11FilterEvent( QWidget *keywidget, XEvent *event );
#endif // Q_WS_X11
-#if defined(Q_WS_S60)
- virtual bool s60FilterEvent( QWidget *keywidget, TWsEvent *event );
-#endif // Q_WS_S60
+#if defined(Q_OS_SYMBIAN)
+ virtual bool symbianFilterEvent( QWidget *keywidget, const QSymbianEvent *event );
+#endif // Q_OS_SYMBIAN
virtual bool filterEvent( const QEvent *event );
void sendEvent(const QInputMethodEvent &event);
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 12b398d..5a8e325 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -61,9 +61,6 @@
QT_BEGIN_HEADER
-#if defined(Q_OS_SYMBIAN)
-class TWsEvent;
-#endif
#if defined(Q_WS_S60)
class CApaApplication;
#endif
@@ -83,6 +80,9 @@ class QLocale;
#if defined(Q_WS_QWS)
class QDecoration;
#endif
+#if defined(Q_OS_SYMBIAN)
+class QSymbianEvent;
+#endif
class QApplication;
class QApplicationPrivate;
@@ -241,10 +241,8 @@ public:
int x11ProcessEvent(XEvent*);
#endif
#if defined(Q_OS_SYMBIAN)
- int s60ProcessEvent(TWsEvent *event);
- virtual bool s60EventFilter(TWsEvent *aEvent);
- void symbianHandleCommand(int command);
- void symbianResourceChange(int type);
+ int symbianProcessEvent(const QSymbianEvent *event);
+ virtual bool symbianEventFilter(const QSymbianEvent *event);
#endif
#if defined(Q_WS_QWS)
virtual bool qwsEventFilter(QWSEvent *);
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 2d3d18c..65f61e9 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -503,6 +503,11 @@ public:
static void setNavigationMode(Qt::NavigationMode mode);
static TUint resolveS60ScanCode(TInt scanCode, TUint keysym);
QSet<WId> nativeWindows;
+
+ int symbianProcessWsEvent(const TWsEvent *event);
+ int symbianHandleCommand(int command);
+ int symbianResourceChange(int type);
+
#endif
#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS)
void sendSyntheticEnterLeave(QWidget *widget);
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 656bbc9..d6fdd02 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -42,6 +42,7 @@
#include "qapplication_p.h"
#include "qsessionmanager.h"
#include "qevent.h"
+#include "qsymbianevent.h"
#include "qeventdispatcher_s60_p.h"
#include "qwidget.h"
#include "qdesktopwidget.h"
@@ -1426,43 +1427,47 @@ void QApplication::beep()
\warning This function is only available on Symbian.
\since 4.6
- This function processes an individual Symbian window server
+ This function processes an individual Symbian event
\a event. It returns 1 if the event was handled, 0 if
the \a event was not handled, and -1 if the event was
- not handled because the event handle (\c{TWsEvent::Handle()})
- is not known to Qt.
+ not handled because the event is not known to Qt.
*/
-int QApplication::s60ProcessEvent(TWsEvent *event)
+
+int QApplication::symbianProcessEvent(const QSymbianEvent *event)
{
- bool handled = s60EventFilter(event);
- if (handled)
+ Q_D(QApplication);
+
+ QScopedLoopLevelCounter counter(d->threadData);
+
+ QWidget *w = qApp ? qApp->focusWidget() : 0;
+ if (w) {
+ QInputContext *ic = w->inputContext();
+ if (ic && ic->symbianFilterEvent(w, event))
+ return 1;
+ }
+
+ if (symbianEventFilter(event))
return 1;
+ switch (event->type()) {
+ case QSymbianEvent::WindowServerEvent:
+ return d->symbianProcessWsEvent(event->windowServerEvent());
+ case QSymbianEvent::CommandEvent:
+ return d->symbianHandleCommand(event->command());
+ case QSymbianEvent::ResourceChangeEvent:
+ return d->symbianResourceChange(event->resourceChangeType());
+ default:
+ return -1;
+ }
+}
+
+int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
+{
// Qt event handling. Handle some events regardless of if the handle is in our
// widget map or not.
CCoeControl* control = reinterpret_cast<CCoeControl*>(event->Handle());
const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control);
switch (event->Type()) {
-#if !defined(QT_NO_IM) && defined(Q_WS_S60)
- case EEventKey:
- case EEventKeyUp:
- case EEventKeyDown:
- {
- // The control doesn't seem to be any of our widgets, so rely on the focused
- // widget instead. If the user needs the control, it can be found inside the
- // event structure.
- QWidget *w = qApp ? qApp->focusWidget() : 0;
- if (w) {
- QInputContext *ic = w->inputContext();
- if (ic && ic->s60FilterEvent(w, event)) {
- return 1;
- } else {
- return 0;
- }
- }
- break;
- }
-#endif
case EEventPointerEnter:
if (controlInMap)
return 1; // Qt::Enter will be generated in HandlePointerL
@@ -1551,15 +1556,15 @@ int QApplication::s60ProcessEvent(TWsEvent *event)
If you create an application that inherits QApplication and reimplement
this function, you get direct access to events that the are received
- from the Symbian window server. The events are passed in the TWsEvent
- \a aEvent parameter.
+ from Symbian. The events are passed in the \a event parameter.
Return true if you want to stop the event from being processed. Return
- false for normal event dispatching. The default implementation
- false, and does nothing with \a aEvent.
+ false for normal event dispatching. The default implementation returns
+ false, and does nothing with \a event.
*/
-bool QApplication::s60EventFilter(TWsEvent * /* aEvent */)
+bool QApplication::symbianEventFilter(const QSymbianEvent *event)
{
+ Q_UNUSED(event);
return false;
}
@@ -1574,32 +1579,39 @@ bool QApplication::s60EventFilter(TWsEvent * /* aEvent */)
\sa s60EventFilter(), s60ProcessEvent()
*/
-void QApplication::symbianHandleCommand(int command)
+int QApplicationPrivate::symbianHandleCommand(int command)
{
- QScopedLoopLevelCounter counter(d_func()->threadData);
+ Q_Q(QApplication);
+ int ret = 0;
+
switch (command) {
#ifdef Q_WS_S60
case EAknSoftkeyExit: {
QCloseEvent ev;
- QApplication::sendSpontaneousEvent(this, &ev);
- if (ev.isAccepted())
- quit();
+ QApplication::sendSpontaneousEvent(q, &ev);
+ if (ev.isAccepted()) {
+ q->quit();
+ ret = 1;
+ }
break;
}
#endif
case EEikCmdExit:
- quit();
+ q->quit();
+ ret = 1;
break;
default:
bool handled = QSoftKeyManager::handleCommand(command);
+ if (handled)
+ ret = 1;
#ifdef Q_WS_S60
- if (!handled)
- QMenuBarPrivate::symbianCommands(command);
-#else
- Q_UNUSED(handled);
+ else
+ ret = QMenuBarPrivate::symbianCommands(command);
#endif
break;
}
+
+ return ret;
}
/*!
@@ -1611,8 +1623,10 @@ void QApplication::symbianHandleCommand(int command)
Currently, KEikDynamicLayoutVariantSwitch and
KAknsMessageSkinChange are handled.
*/
-void QApplication::symbianResourceChange(int type)
+int QApplicationPrivate::symbianResourceChange(int type)
{
+ int ret = 0;
+
switch (type) {
#ifdef Q_WS_S60
case KEikDynamicLayoutVariantSwitch:
@@ -1631,22 +1645,28 @@ void QApplication::symbianResourceChange(int type)
#endif
s60Style = qobject_cast<QS60Style*>(QApplication::style());
- if (s60Style)
+ if (s60Style) {
s60Style->d_func()->handleDynamicLayoutVariantSwitch();
+ ret = 1;
+ }
#endif
}
break;
#ifndef QT_NO_STYLE_S60
case KAknsMessageSkinChange:
- if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style()))
+ if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) {
s60Style->d_func()->handleSkinChange();
+ ret = 1;
+ }
break;
#endif
#endif // Q_WS_S60
default:
break;
}
+
+ return ret;
}
#ifndef QT_NO_WHEELEVENT
diff --git a/src/gui/kernel/symbian.pri b/src/gui/kernel/symbian.pri
index 5497ccb..69422dd 100644
--- a/src/gui/kernel/symbian.pri
+++ b/src/gui/kernel/symbian.pri
@@ -1,4 +1,7 @@
symbian {
contains(QT_CONFIG, s60): LIBS+= $$QMAKE_LIBS_S60
RESOURCES += symbian/symbianresources.qrc
+
+ HEADERS += symbian/qsymbianevent.h
+ SOURCES += symbian/qsymbianevent.cpp
}
diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index e630253..4ad78f9 100644
--- a/src/gui/s60framework/qs60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -50,6 +50,7 @@
#include "qs60mainappui.h"
#include <QtGui/qapplication.h>
+#include <QtGui/qsymbianevent.h>
#include <QtGui/qmenu.h>
#include <private/qmenu_p.h>
#include <private/qt_s60_p.h>
@@ -134,8 +135,10 @@ QS60MainAppUi::~QS60MainAppUi()
*/
void QS60MainAppUi::HandleCommandL(TInt command)
{
- if (qApp)
- QT_TRYCATCH_LEAVING(qApp->symbianHandleCommand(command));
+ if (qApp) {
+ QSymbianEvent event(QSymbianEvent::CommandEvent, command);
+ QT_TRYCATCH_LEAVING(qApp->symbianProcessEvent(&event));
+ }
}
/*!
@@ -151,8 +154,10 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type)
{
CAknAppUi::HandleResourceChangeL(type);
- if (qApp)
- QT_TRYCATCH_LEAVING(qApp->symbianResourceChange(type));
+ if (qApp) {
+ QSymbianEvent event(QSymbianEvent::ResourceChangeEvent, type);
+ QT_TRYCATCH_LEAVING(qApp->symbianProcessEvent(&event));
+ }
}
/*!
@@ -164,16 +169,18 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type)
* If you override this function, you should call the base class implementation if you do not
* handle the event.
*/
-void QS60MainAppUi::HandleWsEventL(const TWsEvent& event, CCoeControl *destination)
+void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destination)
{
int result = 0;
- if (qApp)
+ if (qApp) {
+ QSymbianEvent event(&wsEvent);
QT_TRYCATCH_LEAVING(
- result = qApp->s60ProcessEvent(const_cast<TWsEvent*>(&event))
+ result = qApp->symbianProcessEvent(&event)
);
+ }
if (result <= 0)
- CAknAppUi::HandleWsEventL(event, destination);
+ CAknAppUi::HandleWsEventL(wsEvent, destination);
}
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index 6be3197..ab10792 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -101,7 +101,7 @@ protected Q_SLOTS:
private:
Q_DISABLE_COPY(QS60Style)
friend class QStyleFactory;
- friend class QApplication;
+ friend class QApplicationPrivate;
};
#endif // QT_NO_STYLE_S60
diff --git a/src/gui/symbian/qsymbianevent.cpp b/src/gui/symbian/qsymbianevent.cpp
new file mode 100644
index 0000000..af2c861
--- /dev/null
+++ b/src/gui/symbian/qsymbianevent.cpp
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsymbianevent.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QSymbianEvent
+ \brief The QSymbianEvent class contains a Symbian event of any type.
+ \since 4.6
+
+ The class is used as a generic container type for all types of Symbian
+ events.
+
+ \note This class is only available on Symbian.
+
+ \sa QApplication::symbianEventFilter()
+*/
+
+/*!
+ \enum QSymbianEvent::Type
+
+ \value InvalidEvent The event is not valid.
+ \value WindowServerEvent Indicates an event of type \c TWsEvent.
+ \value CommandEvent Indicates that the event is a Symbian command.
+ \value ResourceChangeEvent Indicates that the event is a Symbian resource change type.
+*/
+
+/*!
+ \fn QSymbianEvent::type()
+
+ Returns the event type contained in the QSymbianEvent instance.
+*/
+
+/*!
+ \fn QSymbianEvent::isValid()
+
+ Returns whether this QSymbianEvent instance contains a valid event.
+*/
+
+/*!
+ Constructs a QSymbianEvent containing the given window server event
+ \a windowServerEvent.
+*/
+QSymbianEvent::QSymbianEvent(const TWsEvent *windowServerEvent)
+ : m_type(WindowServerEvent)
+ , m_eventPtr(windowServerEvent)
+{
+}
+
+/*!
+ Constructs a QSymbianEvent containing the given event value
+ \a value. The type of event is controlled by the \a eventType parameter.
+*/
+QSymbianEvent::QSymbianEvent(QSymbianEvent::Type eventType, int value)
+{
+ switch (eventType) {
+ case CommandEvent:
+ case ResourceChangeEvent:
+ m_type = eventType;
+ m_eventValue = value;
+ break;
+ default:
+ m_type = InvalidEvent;
+ m_eventValue = 0;
+ break;
+ }
+}
+
+/*!
+ Destroys the QSymbianEvent.
+*/
+QSymbianEvent::~QSymbianEvent()
+{
+}
+
+/*!
+ Returns the window server event contained in the class instance, or 0 if the event type
+ is not \c WindowServerEvent.
+*/
+const TWsEvent *QSymbianEvent::windowServerEvent() const
+{
+ return (m_type == WindowServerEvent) ? static_cast<const TWsEvent *>(m_eventPtr) : 0;
+}
+
+/*!
+ Returns the command contained in the class instance, or 0 if the event type
+ is not \c CommandEvent.
+*/
+int QSymbianEvent::command() const
+{
+ return (m_type == CommandEvent) ? m_eventValue : 0;
+}
+
+/*!
+ Returns the resource change type contained in the class instance, or 0 if the event type
+ is not \c ResourceChangeEvent.
+*/
+int QSymbianEvent::resourceChangeType() const
+{
+ return (m_type == ResourceChangeEvent) ? m_eventValue : 0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/symbian/qsymbianevent.h b/src/gui/symbian/qsymbianevent.h
new file mode 100644
index 0000000..74aa5d0
--- /dev/null
+++ b/src/gui/symbian/qsymbianevent.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSYMBIANEVENT_H
+#define QSYMBIANEVENT_H
+
+#include <QtCore/qglobal.h>
+
+#ifdef Q_OS_SYMBIAN
+
+class TWsEvent;
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class Q_GUI_EXPORT QSymbianEvent
+{
+public:
+ enum Type {
+ InvalidEvent,
+ WindowServerEvent,
+ CommandEvent,
+ ResourceChangeEvent
+ };
+
+ QSymbianEvent(const TWsEvent *windowServerEvent);
+ QSymbianEvent(Type eventType, int value);
+ ~QSymbianEvent();
+
+ Type type() const;
+ bool isValid() const;
+
+ const TWsEvent *windowServerEvent() const;
+ int command() const;
+ int resourceChangeType() const;
+
+private:
+ Type m_type;
+ union {
+ const void *m_eventPtr;
+ int m_eventValue;
+
+ qint64 m_reserved;
+ };
+};
+
+inline QSymbianEvent::Type QSymbianEvent::type() const
+{
+ return m_type;
+}
+
+inline bool QSymbianEvent::isValid() const
+{
+ return m_type != InvalidEvent;
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // Q_OS_SYMBIAN
+
+#endif // QSYMBIANEVENT_H
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index d757f98..94c4177 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -243,11 +243,14 @@ void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id)
}
#endif // Q_WS_S60
-void QMenuBarPrivate::symbianCommands(int command)
+int QMenuBarPrivate::symbianCommands(int command)
{
+ int ret = 0;
+
if (command == contexMenuCommand && !widgetWithContextMenu.isNull()) {
QContextMenuEvent* event = new QContextMenuEvent(QContextMenuEvent::Keyboard, QPoint(0,0));
QCoreApplication::postEvent(widgetWithContextMenu, event);
+ ret = 1;
}
int size = nativeMenuBars.size();
@@ -258,8 +261,11 @@ void QMenuBarPrivate::symbianCommands(int command)
emit nativeMenuBars.at(i)->triggered(menu->action);
menu->action->activate(QAction::Trigger);
+ ret = 1;
break;
}
+
+ return ret;
}
void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent)
diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h
index 7815969..da2b8d7 100644
--- a/src/gui/widgets/qmenubar_p.h
+++ b/src/gui/widgets/qmenubar_p.h
@@ -266,7 +266,7 @@ public:
void insertNativeMenuItems(const QList<QAction*> &actions);
} *symbian_menubar;
- static void symbianCommands(int command);
+ static int symbianCommands(int command);
#endif
};