diff options
author | Alessandro Portale <aportale@trolltech.com> | 2009-05-27 20:47:19 (GMT) |
---|---|---|
committer | Alessandro Portale <aportale@trolltech.com> | 2009-05-27 20:47:19 (GMT) |
commit | 8c7098210e6dfa7886d6e33918899a211019b699 (patch) | |
tree | ce3dc0ea52772b3d2f50f9ebda24886a984771a7 /src/gui/widgets/qsoftkeystack_s60.cpp | |
parent | 51d580aef7fce99a7c531fa35e50637ec8704a5d (diff) | |
download | Qt-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.
Diffstat (limited to 'src/gui/widgets/qsoftkeystack_s60.cpp')
-rw-r--r-- | src/gui/widgets/qsoftkeystack_s60.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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; } |