diff options
author | Iain <qt-info@nokia.com> | 2009-05-11 17:37:45 (GMT) |
---|---|---|
committer | Iain <qt-info@nokia.com> | 2009-05-11 17:37:45 (GMT) |
commit | 4592301363ad625e583b76b2f46f616486e5d0d6 (patch) | |
tree | 061d87dcacc338c1f0423fe73bca219ead704b09 /src/gui/widgets | |
parent | dabd8caa4a2faffefbc7f9bb4f233283458c779e (diff) | |
parent | 7aec9035cb0e23eecfdcec9e441092a485ca7f0a (diff) | |
download | Qt-4592301363ad625e583b76b2f46f616486e5d0d6.zip Qt-4592301363ad625e583b76b2f46f616486e5d0d6.tar.gz Qt-4592301363ad625e583b76b2f46f616486e5d0d6.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_p.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_symbian.cpp | 59 | ||||
-rw-r--r-- | src/gui/widgets/qmenubar_p.h | 9 |
5 files changed, 53 insertions, 27 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index fa337af..116d000 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1774,8 +1774,8 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e) } #endif - if (e->button() == Qt::LeftButton && (!d->clickCausedFocus - || QApplication::autoSipOnMouseFocus())) { + if (e->button() == Qt::LeftButton && qApp->autoSipEnabled() + && (!d->clickCausedFocus || qApp->autoSipOnMouseFocus())) { QEvent event(QEvent::RequestSoftwareInputPanel); QApplication::sendEvent(this, &event); } diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 1e544f7..1676eb8 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -52,13 +52,15 @@ #endif QT_BEGIN_HEADER +#ifdef Q_OS_SYMBIAN + class CEikMenuPane; +#endif QT_BEGIN_NAMESPACE QT_MODULE(Gui) #ifdef Q_OS_SYMBIAN - class CEikMenuPane; IMPORT_C void qt_symbian_show_toplevel(CEikMenuPane* menuPane); IMPORT_C void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); #endif diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 61cc3db..d47749f 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -61,6 +61,9 @@ #include "QtCore/qbasictimer.h" #include "private/qwidget_p.h" +#ifdef Q_OS_SYMBIAN +class CEikMenuPane; +#endif QT_BEGIN_NAMESPACE #ifndef QT_NO_MENU @@ -121,7 +124,6 @@ struct QWceMenuAction { }; #endif #ifdef Q_OS_SYMBIAN -class CEikMenuPane; struct QSymbianMenuAction { uint command; int parent; diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 9e53df5..86affe3 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -32,8 +32,10 @@ QT_BEGIN_NAMESPACE // ### FIX/Document this, we need some safe range of menu id's for Qt that don't clash with AIW ones +typedef QMultiHash<QWidget *, QMenuBarPrivate *> MenuBarHash; +Q_GLOBAL_STATIC(MenuBarHash, menubars) + #define QT_FIRST_MENU_ITEM 32000 -static QList<QMenuBarPrivate *> s60_menubars; struct SymbianMenuItem { @@ -47,6 +49,15 @@ static QList<SymbianMenuItem*> symbianMenus; static QList<QMenuBar*> nativeMenuBars; static uint qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; +bool menuExists() +{ + QWidget *w = qApp->activeWindow(); + QMenuBarPrivate *mb = menubars()->value(w); + if ((!mb) && !menubars()->count()) + return false; + return true; +} + // ### FIX THIS, copy/paste of original (faulty) stripped text implementation. // Implementation should be removed from QAction implementation to some generic place static QString qt_strippedText_copy_from_qaction(QString s) @@ -167,7 +178,7 @@ static void setSoftkeys() { CEikButtonGroupContainer* cba = CEikonEnv::Static()->AppUiFactory()->Cba(); if (cba){ - if (s60_menubars.count()>0) + if (menuExists()) cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT); else cba->SetCommandSetL(R_AVKON_SOFTKEYS_EXIT); @@ -176,24 +187,23 @@ static void setSoftkeys() static void rebuildMenu() { - qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; - deleteAll( &symbianMenus ); - if (s60_menubars.count()==0) - return; - for (int i = 0; i < s60_menubars.last()->actions.size(); ++i) { - QSymbianMenuAction *symbianActionTopLevel = new QSymbianMenuAction; - symbianActionTopLevel->action = s60_menubars.last()->actions.at(i); - symbianActionTopLevel->parent = 0; - symbianActionTopLevel->command = qt_symbian_menu_static_cmd_id++; - qt_symbian_insert_action(symbianActionTopLevel, &symbianMenus); + QMenuBarPrivate *mb = 0; + setSoftkeys(); + QWidget *w = qApp->activeWindow(); + if (w) + { + mb = menubars()->value(w); + qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; + deleteAll( &symbianMenus ); + if (!mb) + return; + mb->symbian_menubar->rebuild(); } - - return; } Q_GUI_EXPORT void qt_symbian_show_toplevel( CEikMenuPane* menuPane) { - if (s60_menubars.count()==0) + if (!menuExists()) return; rebuildMenu(); for (int i = 0; i < symbianMenus.count(); ++i) @@ -251,6 +261,7 @@ void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent) { Q_Q(QMenuBar); if (parent && parent->isWindow()){ + menubars()->insert(q->window(), this); symbian_menubar = new QSymbianMenuBarPrivate(this); nativeMenuBars.append(q); } @@ -261,7 +272,7 @@ void QMenuBarPrivate::symbianDestroyMenuBar() Q_Q(QMenuBar); int index = nativeMenuBars.indexOf(q); nativeMenuBars.removeAt(index); - s60_menubars.removeLast(); + menubars()->remove(q->window(), this); rebuildMenu(); if (symbian_menubar) delete symbian_menubar; @@ -271,7 +282,6 @@ void QMenuBarPrivate::symbianDestroyMenuBar() QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate *menubar) { d = menubar; - s60_menubars.append(menubar); } QMenuBarPrivate::QSymbianMenuBarPrivate::~QSymbianMenuBarPrivate() @@ -364,10 +374,19 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::removeAction(QSymbianMenuAction *a void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild() { setSoftkeys(); - if (s60_menubars.count()==0) + qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; + deleteAll( &symbianMenus ); + if (!d) return; + for (int i = 0; i < d->actions.size(); ++i) { + QSymbianMenuAction *symbianActionTopLevel = new QSymbianMenuAction; + symbianActionTopLevel->action = d->actions.at(i); + symbianActionTopLevel->parent = 0; + symbianActionTopLevel->command = qt_symbian_menu_static_cmd_id++; + qt_symbian_insert_action(symbianActionTopLevel, &symbianMenus); + } +} - rebuildMenu(); - } +QT_END_NAMESPACE #endif //QT_NO_MENUBAR diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index f617d80..d562cd9 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -61,14 +61,17 @@ #include "qguifunctions_wince.h" #endif -QT_BEGIN_NAMESPACE - #ifndef QT_NO_MENUBAR -class QMenuBarExtension; #ifdef Q_OS_SYMBIAN class CCoeControl; class CEikMenuBar; #endif +#endif + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_MENUBAR +class QMenuBarExtension; class QMenuBarPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QMenuBar) |