From c27b5a2ebe2ebd1615273869b0e8ba3e0fe59225 Mon Sep 17 00:00:00 2001 From: oana Date: Mon, 9 Apr 2012 12:31:36 +0000 Subject: [PATCH] Create a parentless menu bar by copying it from the main window menu bar to be used as the default application menu on Mac OS X. git-svn-id: http://yate.null.ro/svn/yate/trunk@5003 acf43c95-373e-0410-b603-e72c3f656dc1 --- clients/qt4/qt4client.cpp | 31 +++++++++++++++++++++++++++++++ share/skins/default/qt4client.ui | 6 ++++++ 2 files changed, 37 insertions(+) diff --git a/clients/qt4/qt4client.cpp b/clients/qt4/qt4client.cpp index 2c7becb1..edad74df 100644 --- a/clients/qt4/qt4client.cpp +++ b/clients/qt4/qt4client.cpp @@ -2870,6 +2870,37 @@ void QtWindow::doInit() wndWidget()->setMinimumHeight(min - h); else wndWidget()->setMinimumHeight(0); + +#ifdef Q_WS_MAC + if (m_mainWindow) { + // Create a parentless menu bar to be set as the default application menu by copying it from the main window menu + DDebug(QtDriver::self(),DebugAll,"Setting as default menu bar the menu bar of window '%s' [%p]", + m_id.c_str(),this); + QMenuBar* mainMenu = menuBars[0]; + QMenuBar* defaultMenu = new QMenuBar(0); + QList topActions = mainMenu->actions(); + for (int i = 0; i < topActions.count(); i++) { + QMenu* menu = topActions[i]->menu(); + if (menu) { + QMenu* m = new QMenu(menu->title(),defaultMenu); + String tmp; + QtClient::getProperty(menu,YSTRING("_yate_menuNoCopy"),tmp); + if (tmp.toBoolean()) + continue; + defaultMenu->addMenu(m); + QList actions = menu->actions(); + for (int j = 0; j < actions.count(); j++) { + QAction* act = actions[j]; + tmp.clear(); + QtClient::getProperty(act,YSTRING("_yate_menuNoCopy"),tmp); + if (tmp.toBoolean()) + continue; + m->addAction(act); + } + } + } + } +#endif } // Create window's children dynamic properties from config diff --git a/share/skins/default/qt4client.ui b/share/skins/default/qt4client.ui index bafdf5ea..b7b4664d 100644 --- a/share/skins/default/qt4client.ui +++ b/share/skins/default/qt4client.ui @@ -121,6 +121,9 @@ &Friends + + true + Subscription @@ -3055,6 +3058,9 @@ QTextEdit { Show notifications + + true +