summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_s60.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp129
1 files changed, 99 insertions, 30 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index dd51fcd..2f7bdcf 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -5,7 +5,37 @@
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_EMBEDDED_LICENSE$
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -14,6 +44,7 @@
#include "qevent.h"
#include "qeventdispatcher_s60_p.h"
#include "qwidget.h"
+#include "qdesktopwidget.h"
#include "private/qbackingstore_p.h"
#include "qt_s60_p.h"
#include "private/qevent_p.h"
@@ -27,7 +58,7 @@
#endif
#include "private/qwindowsurface_s60_p.h"
#include "qpaintengine.h"
-#include "qmenubar.h"
+#include "private/qmenubar_p.h"
#include "apgwgnam.h" // For CApaWindowGroupName
#include <MdaAudioTonePlayer.h> // For CMdaAudioToneUtility
@@ -49,6 +80,8 @@ static bool appNoGrab = false; // Grabbing enabled
Q_GUI_EXPORT QS60Data *qt_s60Data = 0;
extern bool qt_sendSpontaneousEvent(QObject*,QEvent*);
+extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
+
QWidget *qt_button_down = 0; // widget got last button-down
bool qt_nograb() // application no-grab option
@@ -201,7 +234,7 @@ static void mapS60MouseEventTypeToQt(QEvent::Type *type, Qt::MouseButton *button
*type = QEvent::MouseButtonDblClick;
}
- if (*type == QEvent::MouseButtonPress)
+ if (*type == QEvent::MouseButtonPress || *type == QEvent::MouseButtonDblClick)
QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | (*button);
else if (*type == QEvent::MouseButtonRelease)
QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~(*button));
@@ -310,7 +343,7 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons
QMouseEvent mEvent(QEvent::MouseButtonPress, alienWidget->mapFrom(qwidget, widgetPos), globalPos,
Qt::RightButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier);
sendMouseEvent(alienWidget, &mEvent);
- m_previousEventLongTap = true;
+ m_previousEventLongTap = false;
}
void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
@@ -339,7 +372,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
TPoint controlScreenPos = PositionRelativeToScreen();
QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos;
- if (type == QEvent::MouseButtonPress)
+ if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick)
{
// get the button press target
alienWidget = qwidget->childAt(widgetPos);
@@ -359,7 +392,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
alienWidget = S60->mousePressTarget;
if (alienWidget != S60->lastPointerEventTarget)
- if (type == QEvent::MouseButtonPress || type == QEvent::MouseMove)
+ if (type == QEvent::MouseButtonPress || QEvent::MouseButtonDblClick || type == QEvent::MouseMove)
{
//moved to another widget, create enter and leave events
if (S60->lastPointerEventTarget)
@@ -521,7 +554,14 @@ TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent)
#ifndef QT_NO_IM
TCoeInputCapabilities QSymbianControl::InputCapabilities() const
{
- QWidget *w = qwidget->focusWidget();
+ QWidget *w = 0;
+
+ if(qwidget->hasFocus()) {
+ w = qwidget;
+ } else {
+ w = qwidget->focusWidget();
+ }
+
QCoeFepInputContext *ic;
if (w && w->isEnabled() && w->testAttribute(Qt::WA_InputMethodEnabled)
&& (ic = qobject_cast<QCoeFepInputContext *>(w->inputContext()))) {
@@ -639,21 +679,7 @@ void QSymbianControl::HandleResourceChange(int resourceType)
// font change event
break;
case KEikDynamicLayoutVariantSwitch:
- {
-#ifndef QT_NO_STYLE_S60
- QS60Style *s60Style = 0;
-
-#ifndef QT_NO_STYLE_STYLESHEET
- QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style());
- if (proxy)
- s60Style = qobject_cast<QS60Style*>(proxy->baseStyle());
- else
-#endif
- s60Style = qobject_cast<QS60Style*>(QApplication::style());
-
- if (s60Style)
- s60Style->handleDynamicLayoutVariantSwitch();
-#endif
+ {
if (qwidget->isFullScreen()) {
SetExtentToWholeScreen();
} else if (qwidget->isMaximized()) {
@@ -662,12 +688,6 @@ void QSymbianControl::HandleResourceChange(int resourceType)
}
break;
}
-#ifndef QT_NO_STYLE_S60
- case KAknsMessageSkinChange:
- if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style()))
- s60Style->handleSkinChange();
- break;
-#endif
default:
break;
}
@@ -988,6 +1008,13 @@ int QApplication::s60ProcessEvent(TWsEvent *event)
case EEventScreenDeviceChanged:
if (S60)
S60->updateScreenSize();
+ if (qt_desktopWidget) {
+ QSize oldSize = qt_desktopWidget->size();
+ qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels);
+ qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels);
+ QResizeEvent e(qt_desktopWidget->size(), oldSize);
+ QApplication::sendEvent(qt_desktopWidget, &e);
+ }
return 0; // Propagate to CONE
case EEventWindowVisibilityChanged:
if (controlInMap) {
@@ -1001,6 +1028,7 @@ int QApplication::s60ProcessEvent(TWsEvent *event)
} else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
&& !w->d_func()->maybeBackingStore()) {
w->d_func()->topData()->backingStore = new QWidgetBackingStore(w);
+ w->update();
}
return 1;
}
@@ -1020,7 +1048,14 @@ bool QApplication::s60EventFilter(TWsEvent *aEvent)
return false;
}
-void QApplication::s60HandleCommandL(int command)
+/*!
+ Handles commands which are typically handled by CAknAppUi::HandleCommandL()
+ Qts Ui integration into Symbian is partially achieved by deriving from CAknAppUi.
+ Currently, exit, menu and softkey commands are handled
+
+ \sa s60EventFilter(), s60ProcessEvent()
+*/
+void QApplication::symbianHandleCommand(int command)
{
switch (command) {
case EEikCmdExit:
@@ -1030,7 +1065,41 @@ void QApplication::s60HandleCommandL(int command)
break;
default:
// For now assume all unknown menu items are Qt menu items
- QMenuBar::symbianCommands(command);
+ QMenuBarPrivate::symbianCommands(command);
+ break;
+ }
+}
+
+void QApplication::symbianResourceChange(int type)
+{
+ switch (type) {
+ case KEikDynamicLayoutVariantSwitch:
+ {
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = 0;
+
+#ifndef QT_NO_STYLE_STYLESHEET
+ QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style());
+ if (proxy)
+ s60Style = qobject_cast<QS60Style*>(proxy->baseStyle());
+ else
+#endif
+ s60Style = qobject_cast<QS60Style*>(QApplication::style());
+
+ if (s60Style)
+ s60Style->handleDynamicLayoutVariantSwitch();
+#endif
+ }
+ break;
+
+#ifndef QT_NO_STYLE_S60
+ case KAknsMessageSkinChange:
+ if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style()))
+ s60Style->handleSkinChange();
+ break;
+#endif
+
+ default:
break;
}
}