From c912b0234ead0e35a969b5600a61c77b60e18aa6 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 28 Sep 2009 11:54:06 +0200 Subject: Make sure the correct soft key is triggered. In cases where there are both softkey actions as well as "normal" actions, we need to be sure to skip over the none softkey actions since they should not be a part of the softkey framework and the 'index' will be out of sync. Reviewed-by: Sami Merila --- src/gui/kernel/qsoftkeymanager.cpp | 12 ++++++-- tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 36 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 45ecb5a..7874622 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -247,9 +247,15 @@ bool QSoftKeyManager::handleCommand(int command) if (command >= s60CommandStart && QSoftKeyManagerPrivate::softKeySource) { int index = command - s60CommandStart; const QList& softKeys = QSoftKeyManagerPrivate::softKeySource->actions(); - if (index < softKeys.count()) { - softKeys.at(index)->activate(QAction::Trigger); - return true; + for (int i = 0, j = 0; i < softKeys.count(); ++i) { + QAction *action = softKeys.at(i); + if (action->softKeyRole() != QAction::NoSoftKey) { + if (j == index) { + action->activate(QAction::Trigger); + return true; + } + j++; + } } } diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 81ef498..8788117 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -42,6 +42,8 @@ #include #include "qevent.h" +#include "qdialog.h" +#include "qdialogbuttonbox.h" #include "private/qsoftkeymanager_p.h" class tst_QSoftKeyManager : public QObject @@ -59,6 +61,7 @@ public slots: void cleanup(); private slots: void updateSoftKeysCompressed(); + void handleCommand(); }; class EventListener : public QObject @@ -133,6 +136,39 @@ void tst_QSoftKeyManager::updateSoftKeysCompressed() QVERIFY(listener.numUpdateSoftKeys == 1); } +/* + This tests that when the S60 environment sends us a command + that it actually gets mapped to the correct action. +*/ +void tst_QSoftKeyManager::handleCommand() +{ + QDialog w; + QDialogButtonBox *buttons = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, + &w); + + w.show(); + QApplication::processEvents(); + + QCOMPARE(w.actions().count(), 2); + + QSignalSpy spy0(w.actions()[0], SIGNAL(triggered())); + QSignalSpy spy1(w.actions()[1], SIGNAL(triggered())); + + // These should work eventually, but do not yet +// QTest::keyPress(&w, Qt::Key_Context1); +// QTest::keyPress(&w, Qt::Key_Context2); + + qApp->symbianHandleCommand(6000); + qApp->symbianHandleCommand(6001); + + QApplication::processEvents(); + + QCOMPARE(spy0.count(), 1); + QCOMPARE(spy1.count(), 1); +} + QTEST_MAIN(tst_QSoftKeyManager) #include "tst_qsoftkeymanager.moc" -- cgit v0.12 From 994daec967ea0e3db2fa6093efe1274f9a79d2ff Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 28 Sep 2009 10:46:29 +0200 Subject: compile fix with namespace Reviewed-by: sroedal --- src/gui/painting/qpaintbuffer.cpp | 5 +++++ src/gui/painting/qpaintbuffer_p.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 1038f74..57e7cd0 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -49,6 +49,8 @@ //#define QPAINTBUFFER_DEBUG_DRAW +QT_BEGIN_NAMESPACE + extern int qt_defaultDpiX(); extern int qt_defaultDpiY(); extern void qt_format_text(const QFont &font, @@ -1740,7 +1742,9 @@ struct QPaintBufferCacheEntry QVariant::Type type; quint64 cacheKey; }; +QT_END_NAMESPACE Q_DECLARE_METATYPE(QPaintBufferCacheEntry) +QT_BEGIN_NAMESPACE QDataStream &operator<<(QDataStream &stream, const QPaintBufferCacheEntry &entry) { @@ -1832,3 +1836,4 @@ QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer) return stream; } +QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h index a80fa8d..6a7ac73 100644 --- a/src/gui/painting/qpaintbuffer_p.h +++ b/src/gui/painting/qpaintbuffer_p.h @@ -59,6 +59,8 @@ #include #include +QT_BEGIN_NAMESPACE + class QPaintBufferPrivate; class QPaintBufferPlayback; @@ -440,4 +442,6 @@ private: FreeFunc free; }; +QT_END_NAMESPACE + #endif // QPAINTBUFFER_P_H -- cgit v0.12 From 857a77fe62b9ad3165cf67a5c2e869e5e7dd9e36 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 28 Sep 2009 12:05:54 +0200 Subject: compile fix with namespaced qt Reviewed-by: Simon Hausmann --- src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h | 5 +++-- .../javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp | 3 ++- src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp | 4 ++-- src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h | 4 +++- src/script/bridge/qscriptactivationobject.cpp | 2 +- src/script/bridge/qscriptfunction.cpp | 4 ++-- src/script/bridge/qscriptobject.cpp | 4 ++-- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h index 8072162..811818d 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h @@ -43,11 +43,12 @@ namespace JSC { #if PLATFORM(QT) #ifdef QT_BUILD_SCRIPT_LIB - virtual void scriptUnload(qint64 id) + virtual void scriptUnload(QT_PREPEND_NAMESPACE(qint64) id) { UNUSED_PARAM(id); }; - virtual void scriptLoad(qint64 id, const UString &program, + virtual void scriptLoad(QT_PREPEND_NAMESPACE(qint64) id, + const UString &program, const UString &fileName, int baseLineNumber) { UNUSED_PARAM(id); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp index 7d3a84d..ec242cc 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp @@ -3469,7 +3469,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi structure = callDataScopeChain->globalObject()->emptyObjectStructure(); #ifdef QT_BUILD_SCRIPT_LIB // ### world-class hack - QScriptObject* newObject = new (globalData) QScriptObject(structure); + QT_PREPEND_NAMESPACE(QScriptObject)* newObject + = new (globalData) QT_PREPEND_NAMESPACE(QScriptObject)(structure); #else JSObject* newObject = new (globalData) JSObject(structure); #endif diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp index a110dcd..0b147df 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp @@ -1777,7 +1777,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct) else structure = constructor->scope().node()->globalObject()->emptyObjectStructure(); #ifdef QT_BUILD_SCRIPT_LIB - return new (stackFrame.globalData) QScriptObject(structure); + return new (stackFrame.globalData) QT_PREPEND_NAMESPACE(QScriptObject)(structure); #else return new (stackFrame.globalData) JSObject(structure); #endif @@ -3108,4 +3108,4 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw) } // namespace JSC -#endif // ENABLE(JIT) + #endif // ENABLE(JIT) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h index b7af4f8..4d327cc 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h @@ -20,10 +20,12 @@ #ifndef QWEBINSPECTOR_P_H #define QWEBINSPECTOR_P_H +QT_BEGIN_NAMESPACE class QSize; +class QWidget; +QT_END_NAMESPACE class QWebInspector; class QWebPage; -class QWidget; class QWebInspectorPrivate { public: diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp index 7982982..edccb3e 100644 --- a/src/script/bridge/qscriptactivationobject.cpp +++ b/src/script/bridge/qscriptactivationobject.cpp @@ -46,7 +46,7 @@ namespace JSC { - ASSERT_CLASS_FITS_IN_CELL(QScript::QScriptActivationObject); + ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScript::QScriptActivationObject)); } QT_BEGIN_NAMESPACE diff --git a/src/script/bridge/qscriptfunction.cpp b/src/script/bridge/qscriptfunction.cpp index 5f419ff..d3767bf 100644 --- a/src/script/bridge/qscriptfunction.cpp +++ b/src/script/bridge/qscriptfunction.cpp @@ -55,8 +55,8 @@ namespace JSC { -ASSERT_CLASS_FITS_IN_CELL(QScript::FunctionWrapper); -ASSERT_CLASS_FITS_IN_CELL(QScript::FunctionWithArgWrapper); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScript::FunctionWrapper)); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScript::FunctionWithArgWrapper)); } QT_BEGIN_NAMESPACE diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp index 0d899f8..55644fe 100644 --- a/src/script/bridge/qscriptobject.cpp +++ b/src/script/bridge/qscriptobject.cpp @@ -46,8 +46,8 @@ namespace JSC { //QT_USE_NAMESPACE -ASSERT_CLASS_FITS_IN_CELL(QScriptObject); -ASSERT_CLASS_FITS_IN_CELL(QScriptObjectPrototype); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScriptObject)); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScriptObjectPrototype)); } QT_BEGIN_NAMESPACE -- cgit v0.12