equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the S60 port of the Qt Toolkit. |
7 ** This file is part of the S60 port of the Qt Toolkit. |
8 ** |
8 ** |
79 static QList<SymbianMenuItem*> symbianMenus; |
79 static QList<SymbianMenuItem*> symbianMenus; |
80 static QList<QMenuBar*> nativeMenuBars; |
80 static QList<QMenuBar*> nativeMenuBars; |
81 static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; |
81 static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; |
82 static QPointer<QWidget> widgetWithContextMenu; |
82 static QPointer<QWidget> widgetWithContextMenu; |
83 static QList<QAction*> contextMenuActionList; |
83 static QList<QAction*> contextMenuActionList; |
|
84 static QWidget* actionMenu = NULL; |
84 static int contexMenuCommand=0; |
85 static int contexMenuCommand=0; |
85 |
86 |
86 bool menuExists() |
87 bool menuExists() |
87 { |
88 { |
88 QWidget *w = qApp->activeWindow(); |
89 QWidget *w = qApp->activeWindow(); |
222 mb->symbian_menubar->rebuild(); |
223 mb->symbian_menubar->rebuild(); |
223 } |
224 } |
224 } |
225 } |
225 |
226 |
226 #ifdef Q_WS_S60 |
227 #ifdef Q_WS_S60 |
|
228 void qt_symbian_next_menu_from_action(QWidget *actionContainer) |
|
229 { |
|
230 actionMenu = actionContainer; |
|
231 } |
|
232 |
227 void qt_symbian_show_toplevel( CEikMenuPane* menuPane) |
233 void qt_symbian_show_toplevel( CEikMenuPane* menuPane) |
228 { |
234 { |
|
235 if (actionMenu) { |
|
236 QMenuBarPrivate *mb = 0; |
|
237 mb = menubars()->value(actionMenu); |
|
238 qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; |
|
239 deleteAll( &symbianMenus ); |
|
240 Q_ASSERT(mb); |
|
241 mb->symbian_menubar->rebuild(); |
|
242 for (int i = 0; i < symbianMenus.count(); ++i) |
|
243 QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); |
|
244 actionMenu = NULL; |
|
245 return; |
|
246 } |
|
247 |
229 if (!menuExists()) |
248 if (!menuExists()) |
230 return; |
249 return; |
231 rebuildMenu(); |
250 rebuildMenu(); |
232 for (int i = 0; i < symbianMenus.count(); ++i) |
251 for (int i = 0; i < symbianMenus.count(); ++i) |
233 QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); |
252 QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); |
269 } |
288 } |
270 |
289 |
271 void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent) |
290 void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent) |
272 { |
291 { |
273 Q_Q(QMenuBar); |
292 Q_Q(QMenuBar); |
274 if (parent && parent->isWindow()){ |
293 if (parent) { |
275 menubars()->insert(q->window(), this); |
294 if(parent->isWindow()) { |
276 symbian_menubar = new QSymbianMenuBarPrivate(this); |
295 menubars()->insert(q->window(), this); |
277 nativeMenuBars.append(q); |
296 symbian_menubar = new QSymbianMenuBarPrivate(this); |
|
297 nativeMenuBars.append(q); |
|
298 } else { |
|
299 menubars()->insert(q->parentWidget(), this); |
|
300 symbian_menubar = new QSymbianMenuBarPrivate(this); |
|
301 nativeMenuBars.append(q); |
|
302 } |
278 } |
303 } |
279 } |
304 } |
280 |
305 |
281 void QMenuBarPrivate::symbianDestroyMenuBar() |
306 void QMenuBarPrivate::symbianDestroyMenuBar() |
282 { |
307 { |
283 Q_Q(QMenuBar); |
308 Q_Q(QMenuBar); |
284 int index = nativeMenuBars.indexOf(q); |
309 int index = nativeMenuBars.indexOf(q); |
285 nativeMenuBars.removeAt(index); |
310 nativeMenuBars.removeAt(index); |
286 menubars()->remove(q->window(), this); |
311 menubars()->remove(q->window(), this); |
|
312 menubars()->remove(q->parentWidget(), this); |
287 rebuildMenu(); |
313 rebuildMenu(); |
288 if (symbian_menubar) |
314 if (symbian_menubar) |
289 delete symbian_menubar; |
315 delete symbian_menubar; |
290 symbian_menubar = 0; |
316 symbian_menubar = 0; |
291 } |
317 } |