summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Portale <aportale@trolltech.com>2009-05-27 20:47:19 (GMT)
committerAlessandro Portale <aportale@trolltech.com>2009-05-27 20:47:19 (GMT)
commit8c7098210e6dfa7886d6e33918899a211019b699 (patch)
treece3dc0ea52772b3d2f50f9ebda24886a984771a7
parent51d580aef7fce99a7c531fa35e50637ec8704a5d (diff)
downloadQt-8c7098210e6dfa7886d6e33918899a211019b699.zip
Qt-8c7098210e6dfa7886d6e33918899a211019b699.tar.gz
Qt-8c7098210e6dfa7886d6e33918899a211019b699.tar.bz2
Moved the soft key command relay acrobatics from QApplication to
QSoftKeyStackPrivate. Removed QSoftKeyStack::handleSoftKeyPress and made QSoftKeyStackPrivate::handleSoftKeyPress static, so that it can be called from QApplication.
-rw-r--r--src/gui/kernel/qapplication_s60.cpp12
-rw-r--r--src/gui/widgets/qsoftkeystack.cpp6
-rw-r--r--src/gui/widgets/qsoftkeystack.h2
-rw-r--r--src/gui/widgets/qsoftkeystack_p.h2
-rw-r--r--src/gui/widgets/qsoftkeystack_s60.cpp12
5 files changed, 14 insertions, 20 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index ad1c842..138ba8c 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -29,8 +29,6 @@
#include "private/qwindowsurface_s60_p.h"
#include "qpaintengine.h"
#include "qmenubar.h"
-#include "qmainwindow.h"
-#include "qsoftkeystack.h"
#include "private/qsoftkeystack_p.h"
#include "apgwgnam.h" // For CApaWindowGroupName
@@ -1041,14 +1039,10 @@ void QApplication::s60HandleCommandL(int command)
exit();
break;
default:
- if (command >= SOFTKEYSTART && command <= SOFTKEYEND) {
- const QMainWindow *activeMainWindow =
- qobject_cast<const QMainWindow*>(QApplication::activeWindow());
- if (activeMainWindow)
- activeMainWindow->softKeyStack()->handleSoftKeyPress(command);
- } else {
+ if (command >= SOFTKEYSTART && command <= SOFTKEYEND)
+ QSoftKeyStackPrivate::handleSoftKeyPress(command);
+ else
QMenuBar::symbianCommands(command);
- }
break;
}
}
diff --git a/src/gui/widgets/qsoftkeystack.cpp b/src/gui/widgets/qsoftkeystack.cpp
index 50d7939..c68fe19 100644
--- a/src/gui/widgets/qsoftkeystack.cpp
+++ b/src/gui/widgets/qsoftkeystack.cpp
@@ -201,12 +201,6 @@ void QSoftKeyStack::handleFocusChanged(QWidget *old, QWidget *now)
}
}
-void QSoftKeyStack::handleSoftKeyPress(int command)
-{
- Q_D(QSoftKeyStack);
- d->handleSoftKeyPress(command);
-}
-
QMainWindow *QSoftKeyStack::mainWindowOfWidget(QWidget *widget)
{
QWidget *widgetParent = widget;
diff --git a/src/gui/widgets/qsoftkeystack.h b/src/gui/widgets/qsoftkeystack.h
index 2606bd1..423da66 100644
--- a/src/gui/widgets/qsoftkeystack.h
+++ b/src/gui/widgets/qsoftkeystack.h
@@ -71,8 +71,6 @@ public:
const QSoftkeySet& top();
bool isEmpty();
- void handleSoftKeyPress(int command);
-
static QMainWindow *mainWindowOfWidget(QWidget *widget);
static QSoftKeyStack *softKeyStackOfWidget(QWidget *widget);
diff --git a/src/gui/widgets/qsoftkeystack_p.h b/src/gui/widgets/qsoftkeystack_p.h
index e728cbb..75d7ad4 100644
--- a/src/gui/widgets/qsoftkeystack_p.h
+++ b/src/gui/widgets/qsoftkeystack_p.h
@@ -82,7 +82,7 @@ public:
void popandPush(const QList<QSoftKeyAction*> &softkeys);
const QSoftkeySet& top();
bool isEmpty();
- void handleSoftKeyPress(int command);
+ static void handleSoftKeyPress(int command);
private:
void mapSoftKeys(const QSoftkeySet &top);
diff --git a/src/gui/widgets/qsoftkeystack_s60.cpp b/src/gui/widgets/qsoftkeystack_s60.cpp
index e9ca13a..8dfd5dd 100644
--- a/src/gui/widgets/qsoftkeystack_s60.cpp
+++ b/src/gui/widgets/qsoftkeystack_s60.cpp
@@ -48,6 +48,8 @@
#include "private/qcore_symbian_p.h"
#include "qsoftkeystack_p.h"
+#include "qapplication.h"
+#include "qmainwindow.h"
void QSoftKeyStackPrivate::mapSoftKeys(const QSoftkeySet &top)
{
@@ -99,9 +101,15 @@ void QSoftKeyStackPrivate::setNativeSoftKeys()
void QSoftKeyStackPrivate::handleSoftKeyPress(int command)
{
- const QSoftkeySet top = softKeyStack.top();
+ const QMainWindow *activeMainWindow =
+ qobject_cast<const QMainWindow*>(QApplication::activeWindow());
+ if (!activeMainWindow)
+ return;
+ QSoftKeyStackPrivate *d_ptr = activeMainWindow->softKeyStack()->d_func();
+
+ const QSoftkeySet top = d_ptr->softKeyStack.top();
int index = command-SOFTKEYSTART;
- if( index<0 || index>=top.count()){
+ if (index < 0 || index >= top.count()) {
// ### FIX THIS, add proper error handling, now fail quietly
return;
}