diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-19 08:27:44 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-19 08:27:44 (GMT) |
commit | 07c5dedbcd4e91c90601eb4e4c6cdd969b2d5aa0 (patch) | |
tree | 7daede972f3538df3ecb4c083aceb30416df1ec9 | |
parent | a761b0e60bab05fe50d07de2a78840337dce6370 (diff) | |
parent | 5552e1c6604d4aee42d90050136085a27c8d112b (diff) | |
download | Qt-07c5dedbcd4e91c90601eb4e4c6cdd969b2d5aa0.zip Qt-07c5dedbcd4e91c90601eb4e4c6cdd969b2d5aa0.tar.gz Qt-07c5dedbcd4e91c90601eb4e4c6cdd969b2d5aa0.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | src/gui/inputmethod/qmacinputcontext_mac.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 56 |
3 files changed, 51 insertions, 12 deletions
@@ -2873,7 +2873,6 @@ fi # pass on $CFG_SDK to the configure tests. if [ '!' -z "$CFG_SDK" ]; then MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK" - echo "tests command line: $MAC_CONFIG_TEST_COMMANDLINE" fi # find the default framework value diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp index 116d233..994edb9 100644 --- a/src/gui/inputmethod/qmacinputcontext_mac.cpp +++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp @@ -217,7 +217,11 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void case kEventClassTextInput: { handled_event = false; QWidget *widget = QApplicationPrivate::focus_widget; - if(!widget || (context && widget->inputContext() != context)) { + bool canCompose = widget && (!context || widget->inputContext() == context) + && !(widget->inputMethodHints() & Qt::ImhDigitsOnly + || widget->inputMethodHints() & Qt::ImhFormattedNumbersOnly + || widget->inputMethodHints() & Qt::ImhHiddenText); + if(!canCompose) { handled_event = false; } else if(ekind == kEventTextInputOffsetToPos) { if(!widget->testAttribute(Qt::WA_InputMethodEnabled)) { diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 832605e..6efa85b 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -43,9 +43,15 @@ #include "qevent.h" #include "qdialog.h" +#include "qpushbutton.h" #include "qdialogbuttonbox.h" #include "private/qsoftkeymanager_p.h" +#ifdef Q_WS_S60 +static const int s60CommandStart = 6000; +#endif + + class tst_QSoftKeyManager : public QObject { Q_OBJECT @@ -171,22 +177,52 @@ void tst_QSoftKeyManager::handleCommand() } /* - This tests that softkey enable state follows the state of widget that owns the action - to which the softkey is related to. + This tests that the state of a widget that owns softkey action is respected when handling the softkey + command. */ void tst_QSoftKeyManager::checkSoftkeyEnableStates() { - QWidget w1, w2; - w1.setEnabled(false); - w2.setEnabled(true); + QDialog w; + QDialogButtonBox *buttons = new QDialogButtonBox( + QDialogButtonBox::RestoreDefaults | QDialogButtonBox::Help, + Qt::Horizontal, + &w); + QPushButton *pBDefaults = buttons->button(QDialogButtonBox::RestoreDefaults); + QPushButton *pBHelp = buttons->button(QDialogButtonBox::Help); + pBHelp->setEnabled(false); + w.show(); + QApplication::processEvents(); - QAction *disabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w1); - QAction *enabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w2); + QSignalSpy spy0(w.actions()[0], SIGNAL(triggered())); //restore defaults action + QSignalSpy spy1(w.actions()[1], SIGNAL(triggered())); //disabled help action - QVERIFY(disabledAction->isEnabled()==false); - QVERIFY(enabledAction->isEnabled()==true); + //Verify that enabled button gets all the action trigger signals and + //disabled button gets none. + for (int i = 0; i < 10; i++) { + //simulate "Restore Defaults" softkey press + qApp->symbianHandleCommand(s60CommandStart); + //simulate "help" softkey press + qApp->symbianHandleCommand(s60CommandStart + 1); + } + QApplication::processEvents(); + QCOMPARE(spy0.count(), 10); + QCOMPARE(spy1.count(), 0); + spy0.clear(); + spy1.clear(); + + for (int i = 0; i < 10; i++) { + //simulate "Restore Defaults" softkey press + qApp->symbianHandleCommand(s60CommandStart); + //simulate "help" softkey press + qApp->symbianHandleCommand(s60CommandStart + 1); + //switch enabled button to disabled and vice versa + pBHelp->setEnabled(!pBHelp->isEnabled()); + pBDefaults->setEnabled(!pBDefaults->isEnabled()); + } + QApplication::processEvents(); + QCOMPARE(spy0.count(), 5); + QCOMPARE(spy1.count(), 5); } - QTEST_MAIN(tst_QSoftKeyManager) #include "tst_qsoftkeymanager.moc" |