summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkku Luukkainen <markku.luukkainen@digia.com>2009-06-09 12:40:56 (GMT)
committerMarkku Luukkainen <markku.luukkainen@digia.com>2009-06-09 12:40:56 (GMT)
commit9bdd939c508dfe784402c5c3e85e26d135f7643c (patch)
tree5e74b1ae4558cea0b762fe4e382d88a5f8d455eb /src
parent46cb3a09f4eedb2d4c612a6d73e9e0f14237350c (diff)
downloadQt-9bdd939c508dfe784402c5c3e85e26d135f7643c.zip
Qt-9bdd939c508dfe784402c5c3e85e26d135f7643c.tar.gz
Qt-9bdd939c508dfe784402c5c3e85e26d135f7643c.tar.bz2
Fixes from code review
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp6
-rw-r--r--src/gui/kernel/qwidget_s60.cpp41
-rw-r--r--src/gui/widgets/qactiontokeyeventmapper.cpp (renamed from src/gui/widgets/qkeyeventsoftkey.cpp)16
-rw-r--r--src/gui/widgets/qactiontokeyeventmapper_p.h (renamed from src/gui/widgets/qkeyeventsoftkey.h)14
-rw-r--r--src/gui/widgets/qcombobox.cpp8
-rw-r--r--src/gui/widgets/qmenu.cpp8
-rw-r--r--src/gui/widgets/widgets.pri4
7 files changed, 25 insertions, 72 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 69e630e..af84ea6 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -61,7 +61,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
#endif
-#include <qkeyeventsoftkey.h>
+#include <qactiontokeyeventmapper_p.h>
QT_BEGIN_NAMESPACE
@@ -2004,14 +2004,14 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
if (QApplication::keypadNavigationEnabled()) {
if (!hasEditFocus()) {
setEditFocus(true);
- QKeyEventSoftKey::addSoftKey(QAction::BackSoftKey, Qt::Key_Back, this);
+ QActionToKeyEventMapper::addSoftKey(QAction::BackSoftKey, Qt::Key_Back, this);
return;
}
}
break;
case Qt::Key_Back:
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
- QKeyEventSoftKey::removeSoftkey(this);
+ QActionToKeyEventMapper::removeSoftkey(this);
setEditFocus(false);
} else {
event->ignore();
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 2a83fc7..cc6f794 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -61,31 +61,6 @@ extern bool qt_nograb();
QWidget *QWidgetPrivate::mouseGrabber = 0;
QWidget *QWidgetPrivate::keyboardGrabber = 0;
-static void mapSoftKeys(const QList <QAction*> &softkeys)
-{
-/* if (softkeys.count() == 1 && softkeys.at(0)->menuRole()==QAction::MenuSoftKey) {
- softkeys.at(0)->setNativePosition(0);
- softkeys.at(0)->setQtContextKey(Qt::Key_Context1);
- }
- else if(softkeys.count() == 1 && softkeys.at(0)->menuRole()!=QAction::MenuSoftKey) {
- softkeys.at(0)->setNativePosition(2);
- softkeys.at(0)->setQtContextKey(Qt::Key_Context1);
- }
- else {
- // FIX THIS
- // veryWeirdMagic is needes as s60 5th edition sdk always panics if cba is set with index 1, this hops over it
- // This needs further investigation why so that the hack can be removed
- int veryWeirdMagic = 0;
- for (int index = 0; index < softkeys.count(); index++) {
- softkeys.at(index)->setNativePosition(index + veryWeirdMagic);
- softkeys.at(index)->setQtContextKey(Qt::Key_Context1 + index);
- if (veryWeirdMagic == 0)
- veryWeirdMagic = 1;
- }
- }
-*/
-}
-
static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
{
if ( a.count() != b.count())
@@ -110,15 +85,12 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys)
if (isEqual(old, softkeys ))
return;
}
-
CCoeAppUi* appui = CEikonEnv::Static()->AppUi();
CAknAppUi* aknAppUi = static_cast <CAknAppUi*>(appui);
CEikButtonGroupContainer* nativeContainer = aknAppUi->Cba();
nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
- mapSoftKeys(softkeys);
int placeInScreen=0;
-
for (int index = 0; index < softkeys.count(); index++) {
const QAction* softKeyAction = softkeys.at(index);
if (softKeyAction->softKeyRole() != QAction::ContextMenuSoftKey) {
@@ -135,7 +107,6 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys)
}
if (placeInScreen==1)
placeInScreen=2;
-
}
}
@@ -1083,16 +1054,4 @@ void QWidget::activateWindow()
rw->SetOrdinalPosition(0);
}
}
-/*
-void QWidget::setSoftKeys(QSoftKeyAction *softKey)
-{
- Q_D(QWidget);
- d->
-}
-
-void QWidget::setSoftKeys(const QList<QSoftKeyAction*> &softkeys)
-{
- Q_D(QWidget);
-}
-*/
QT_END_NAMESPACE
diff --git a/src/gui/widgets/qkeyeventsoftkey.cpp b/src/gui/widgets/qactiontokeyeventmapper.cpp
index f5f10fc..5cce415 100644
--- a/src/gui/widgets/qkeyeventsoftkey.cpp
+++ b/src/gui/widgets/qactiontokeyeventmapper.cpp
@@ -41,11 +41,11 @@
#include "qapplication.h"
#include "qevent.h"
-#include "qkeyeventsoftkey.h"
+#include "QActionToKeyEventMapper_p.h"
QT_BEGIN_NAMESPACE
-QKeyEventSoftKey::QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject *parent)
+QActionToKeyEventMapper::QActionToKeyEventMapper(QAction *softKeyAction, Qt::Key key, QObject *parent)
: QObject(parent)
, m_softKeyAction(softKeyAction)
, m_key(key)
@@ -53,7 +53,7 @@ QKeyEventSoftKey::QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject
}
-QString QKeyEventSoftKey::roleText(QAction::SoftKeyRole role)
+QString QActionToKeyEventMapper::roleText(QAction::SoftKeyRole role)
{
switch (role) {
case QAction::OptionsSoftKey:
@@ -78,28 +78,26 @@ QString QKeyEventSoftKey::roleText(QAction::SoftKeyRole role)
return QString();
};
}
-void QKeyEventSoftKey::addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget)
+void QActionToKeyEventMapper::addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget)
{
QAction *action = new QAction(actionWidget);
action->setSoftKeyRole(standardRole);
action->setText(roleText(standardRole));
- QKeyEventSoftKey *softKey = new QKeyEventSoftKey(action, key, actionWidget);
+ QActionToKeyEventMapper *softKey = new QActionToKeyEventMapper(action, key, actionWidget);
connect(action, SIGNAL(triggered()), softKey, SLOT(sendKeyEvent()));
connect(action, SIGNAL(destroyed()), softKey, SLOT(deleteLater()));
actionWidget->setSoftKey(action);
}
-void QKeyEventSoftKey::removeSoftkey(QWidget *focussedWidget)
+void QActionToKeyEventMapper::removeSoftkey(QWidget *focussedWidget)
{
focussedWidget->setSoftKey(0);
}
-void QKeyEventSoftKey::sendKeyEvent()
+void QActionToKeyEventMapper::sendKeyEvent()
{
QApplication::postEvent(parent(), new QKeyEvent(QEvent::KeyPress, m_key, Qt::NoModifier));
}
QT_END_NAMESPACE
-#include "moc_qkeyeventsoftkey.cpp"
-
diff --git a/src/gui/widgets/qkeyeventsoftkey.h b/src/gui/widgets/qactiontokeyeventmapper_p.h
index 0b95efb..da336e8 100644
--- a/src/gui/widgets/qkeyeventsoftkey.h
+++ b/src/gui/widgets/qactiontokeyeventmapper_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QKEYEVENTSOFTKEY_H
-#define QKEYEVENTSOFTKEY_H
+#ifndef QACTIONTOKEYEVENTMAPPER_P_H
+#define QACTIONTOKEYEVENTMAPPER_P_H
#include <QtCore/qobject.h>
#include "QtGui/qaction.h"
@@ -48,15 +48,11 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-
-
-
-class Q_GUI_EXPORT QKeyEventSoftKey : QObject
+class QActionToKeyEventMapper : public QObject
{
Q_OBJECT
public:
- QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject *parent);
+ QActionToKeyEventMapper(QAction *softKeyAction, Qt::Key key, QObject *parent);
static QString roleText(QAction::SoftKeyRole role);
static void addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget);
static void removeSoftkey(QWidget *focussedWidget);
@@ -71,4 +67,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif //QKEYEVENSOFTKEY_H
+#endif //QACTIONTOKEYEVENTMAPPER_H
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 01fcf34..2da5cd0 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -63,7 +63,7 @@
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
#include <qdebug.h>
-#include <qkeyeventsoftkey.h>
+#include <qactiontokeyeventmapper_p.h>
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
#endif
@@ -629,7 +629,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
#endif
if (view->currentIndex().isValid() && (view->currentIndex().flags() & Qt::ItemIsEnabled) ) {
#ifdef QT_KEYPAD_NAVIGATION
- QKeyEventSoftKey::removeSoftkey(this);
+ QActionToKeyEventMapper::removeSoftkey(this);
#endif
combo->hidePopup();
emit itemSelected(view->currentIndex());
@@ -643,7 +643,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
case Qt::Key_Escape:
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Back:
- QKeyEventSoftKey::removeSoftkey(this);
+ QActionToKeyEventMapper::removeSoftkey(this);
#endif
combo->hidePopup();
return true;
@@ -2438,7 +2438,7 @@ void QComboBox::showPopup()
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled())
view()->setEditFocus(true);
- QKeyEventSoftKey::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, view());
+ QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, view());
#endif
}
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index d713081..3486574 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -60,7 +60,7 @@
#ifndef QT_NO_WHATSTHIS
# include <qwhatsthis.h>
#endif
-#include <qkeyeventsoftkey.h>
+#include <qactiontokeyeventmapper_p.h>
#include "qmenu_p.h"
#include "qmenubar_p.h"
@@ -584,7 +584,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
#ifdef QT_KEYPAD_NAVIGATION
// TODO: aportale, remove KEYPAD_NAVIGATION_HACK when softkey stack
// handles focus related and user related actions separately...
- QKeyEventSoftKey::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, q);
+ QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, q);
#endif
}
}
@@ -1945,7 +1945,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
QAccessible::updateAccessibility(this, 0, QAccessible::PopupMenuStart);
#endif
#ifdef QT_KEYPAD_NAVIGATION
- QKeyEventSoftKey::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, this);
+ QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, this);
#endif
}
@@ -2597,7 +2597,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
case Qt::Key_Escape:
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Back:
- QKeyEventSoftKey::removeSoftkey(this);
+ QActionToKeyEventMapper::removeSoftkey(this);
#endif
key_consumed = true;
if (d->tornoff) {
diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri
index f395c76..9e226e2 100644
--- a/src/gui/widgets/widgets.pri
+++ b/src/gui/widgets/widgets.pri
@@ -79,7 +79,7 @@ HEADERS += \
widgets/qplaintextedit.h \
widgets/qplaintextedit_p.h \
widgets/qprintpreviewwidget.h \
- widgets/qkeyeventsoftkey.h
+ widgets/qactiontokeyeventmapper_p.h
SOURCES += \
widgets/qabstractbutton.cpp \
widgets/qabstractslider.cpp \
@@ -139,7 +139,7 @@ SOURCES += \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp \
widgets/qprintpreviewwidget.cpp \
- widgets/qkeyeventsoftkey.cpp
+ widgets/qactiontokeyeventmapper.cpp
!embedded:mac {
HEADERS += widgets/qmacnativewidget_mac.h \