diff -Nru qt4-x11-4.7.0~beta1+git20100522/debian/changelog qt4-x11-4.7.0~beta1+git20100522/debian/changelog --- qt4-x11-4.7.0~beta1+git20100522/debian/changelog 2010-08-10 15:36:11.000000000 +0100 +++ qt4-x11-4.7.0~beta1+git20100522/debian/changelog 2010-08-19 09:31:07.000000000 +0100 @@ -1,3 +1,9 @@ +qt4-x11 (4:4.7.0~beta1+git20100522-0ubuntu1~lucid1~ppa1+appmenu20100819) lucid; urgency=low + + * appmenu patch 20100819 + + -- Aurélien Gâteau Thu, 19 Aug 2010 10:30:41 +0200 + qt4-x11 (4:4.7.0~beta1+git20100522-0ubuntu1~lucid1~ppa1+appmenu20100810) lucid; urgency=low * appmenu patch 20100810 diff -Nru qt4-x11-4.7.0~beta1+git20100522/debian/patches/kubuntu_15_appmenu.diff qt4-x11-4.7.0~beta1+git20100522/debian/patches/kubuntu_15_appmenu.diff --- qt4-x11-4.7.0~beta1+git20100522/debian/patches/kubuntu_15_appmenu.diff 2010-08-10 15:35:22.000000000 +0100 +++ qt4-x11-4.7.0~beta1+git20100522/debian/patches/kubuntu_15_appmenu.diff 2010-08-19 09:30:37.000000000 +0100 @@ -1,4 +1,4 @@ -Appmenu patch 20100810 +Appmenu patch 20100819 diff --git a/src/3rdparty/dbusmenu-qt/.gitattributes b/src/3rdparty/dbusmenu-qt/.gitattributes new file mode 100644 index 0000000..c9bcc1a @@ -3125,10 +3125,10 @@ { diff --git a/src/gui/widgets/qmenu_x11.cpp b/src/gui/widgets/qmenu_x11.cpp new file mode 100644 -index 0000000..3d663b1 +index 0000000..cfc8fa9 --- /dev/null +++ b/src/gui/widgets/qmenu_x11.cpp -@@ -0,0 +1,169 @@ +@@ -0,0 +1,208 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -3170,7 +3170,11 @@ +** +****************************************************************************/ +#include "qmenu.h" ++#include "qapplication.h" ++#include "qboxlayout.h" +#include "qdebug.h" ++#include "qmainwindow.h" ++#include "qtoolbar.h" +#include "qwidgetaction.h" +#include +#include @@ -3235,6 +3239,8 @@ +: exporter(0) +, rootMenu(new QMenu) +, menuBar(_menuBar) ++, cornerWidgetToolBar(0) ++, cornerWidgetContainer(0) +, objectPath(_objectPath) +, previousWinId(0) +{ @@ -3272,6 +3278,8 @@ + +QMenuBarPrivate::QX11MenuBarPrivate::~QX11MenuBarPrivate() +{ ++ delete cornerWidgetToolBar; ++ cornerWidgetToolBar = 0; + delete exporter; + exporter = 0; + delete rootMenu; @@ -3295,11 +3303,42 @@ + exporter->activateAction(action); +} + ++void QMenuBarPrivate::QX11MenuBarPrivate::updateCornerWidgetToolBar() ++{ ++ if (!cornerWidgetToolBar) { ++ QMainWindow *window = qobject_cast(menuBar->window()); ++ if (!window) { ++ qWarning() << "Menubar parent is not a QMainWindow, not showing corner widgets"; ++ return; ++ } ++ cornerWidgetToolBar = window->addToolBar(QApplication::translate("QMenuBar", "Corner Toolbar")); ++ cornerWidgetToolBar->setObjectName(QLatin1String("CornerToolBar")); ++ cornerWidgetContainer = new QWidget; ++ cornerWidgetToolBar->addWidget(cornerWidgetContainer); ++ new QHBoxLayout(cornerWidgetContainer); ++ } else { ++ QLayout *layout = cornerWidgetContainer->layout(); ++ while (layout->count() > 0) { ++ layout->takeAt(0); ++ } ++ } ++ QWidget *left = menuBar->cornerWidget(Qt::TopLeftCorner); ++ QWidget *right = menuBar->cornerWidget(Qt::TopRightCorner); ++ if (left) { ++ left->setParent(cornerWidgetContainer); ++ cornerWidgetContainer->layout()->addWidget(left); ++ } ++ if (right) { ++ right->setParent(cornerWidgetContainer); ++ cornerWidgetContainer->layout()->addWidget(right); ++ } ++} ++ +QT_END_NAMESPACE + +#endif //QT_NO_MENUBAR diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp -index aa4ffce..8e5eb3a 100644 +index aa4ffce..e2f7b80 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -67,6 +67,11 @@ @@ -3314,7 +3353,28 @@ #ifdef Q_WS_WINCE extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp #endif -@@ -201,8 +206,6 @@ void QMenuBarPrivate::updateGeometries() +@@ -173,6 +178,10 @@ void QMenuBarPrivate::updateGeometries() + return; + int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2); + int q_start = -1; ++ ++#ifdef Q_WS_X11 ++ if(!q->isNativeMenuBar()) { ++#endif + if(leftWidget || rightWidget) { + int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q) + + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); +@@ -194,6 +203,9 @@ void QMenuBarPrivate::updateGeometries() + rightWidget->setGeometry(vRect); + } + } ++#ifdef Q_WS_X11 ++ } ++#endif + + #ifdef Q_WS_MAC + if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. +@@ -201,8 +213,6 @@ void QMenuBarPrivate::updateGeometries() return; } #endif @@ -3323,7 +3383,7 @@ #ifndef QT_NO_SHORTCUT if(itemsDirty) { for(int j = 0; j < shortcutIndexMap.size(); ++j) -@@ -212,6 +215,16 @@ void QMenuBarPrivate::updateGeometries() +@@ -212,6 +222,16 @@ void QMenuBarPrivate::updateGeometries() shortcutIndexMap.append(q->grabShortcut(QKeySequence::mnemonic(actions.at(i)->text()))); } #endif @@ -3340,7 +3400,7 @@ itemsDirty = false; hiddenActions.clear(); -@@ -743,6 +756,22 @@ void QMenuBarPrivate::init() +@@ -743,6 +763,22 @@ void QMenuBarPrivate::init() QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); } #endif @@ -3363,7 +3423,7 @@ q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; #ifdef QT3_SUPPORT -@@ -821,6 +850,10 @@ QMenuBar::~QMenuBar() +@@ -821,6 +857,10 @@ QMenuBar::~QMenuBar() Q_D(QMenuBar); d->symbianDestroyMenuBar(); #endif @@ -3374,7 +3434,7 @@ } /*! -@@ -1072,6 +1105,9 @@ void QMenuBar::paintEvent(QPaintEvent *e) +@@ -1072,6 +1112,9 @@ void QMenuBar::paintEvent(QPaintEvent *e) */ void QMenuBar::setVisible(bool visible) { @@ -3384,7 +3444,7 @@ #if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) if (isNativeMenuBar()) return; -@@ -1272,17 +1308,17 @@ void QMenuBar::actionEvent(QActionEvent *e) +@@ -1272,17 +1315,17 @@ void QMenuBar::actionEvent(QActionEvent *e) { Q_D(QMenuBar); d->itemsDirty = true; @@ -3407,7 +3467,7 @@ if(e->type() == QEvent::ActionAdded) nativeMenuBar->addAction(e->action(), nativeMenuBar->findAction(e->before())); else if(e->type() == QEvent::ActionRemoved) -@@ -1366,9 +1402,6 @@ void QMenuBarPrivate::handleReparent() +@@ -1366,9 +1409,6 @@ void QMenuBarPrivate::handleReparent() newWindow->installEventFilter(q); } @@ -3417,7 +3477,7 @@ #ifdef Q_WS_MAC if (q->isNativeMenuBar() && !macWidgetHasNativeMenubar(newParent)) { // If the new parent got a native menubar from before, keep that -@@ -1378,6 +1411,17 @@ void QMenuBarPrivate::handleReparent() +@@ -1378,6 +1418,17 @@ void QMenuBarPrivate::handleReparent() macCreateMenuBar(newParent); } #endif @@ -3435,7 +3495,7 @@ #ifdef Q_WS_WINCE if (qt_wince_is_mobile() && wce_menubar) -@@ -1415,6 +1459,9 @@ void QMenuBarPrivate::handleReparent() +@@ -1415,6 +1466,9 @@ void QMenuBarPrivate::handleReparent() } #endif // QT_SOFTKEYS_ENABLED #endif // Q_WS_S60 @@ -3445,7 +3505,7 @@ } #ifdef QT3_SUPPORT -@@ -1563,6 +1610,11 @@ bool QMenuBar::event(QEvent *e) +@@ -1563,6 +1617,11 @@ bool QMenuBar::event(QEvent *e) bool QMenuBar::eventFilter(QObject *object, QEvent *event) { Q_D(QMenuBar); @@ -3457,7 +3517,7 @@ if (object == parent() && object) { #ifdef QT3_SUPPORT if (d->doAutoResize && event->type() == QEvent::Resize) { -@@ -1656,7 +1708,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const +@@ -1656,7 +1715,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const QSize QMenuBar::minimumSizeHint() const { Q_D(const QMenuBar); @@ -3466,7 +3526,27 @@ const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; -@@ -1712,7 +1764,7 @@ QSize QMenuBar::minimumSizeHint() const +@@ -1679,6 +1738,9 @@ QSize QMenuBar::minimumSizeHint() const + ret += QSize(2*fw + hmargin, 2*fw + vmargin); + } + int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; ++#ifdef Q_WS_X11 ++ if (as_gui_menubar) { ++#endif + if(d->leftWidget) { + QSize sz = d->leftWidget->minimumSizeHint(); + ret.setWidth(ret.width() + sz.width()); +@@ -1691,6 +1753,9 @@ QSize QMenuBar::minimumSizeHint() const + if(sz.height() + margin > ret.height()) + ret.setHeight(sz.height() + margin); + } ++#ifdef Q_WS_X11 ++ } ++#endif + if(as_gui_menubar) { + QStyleOptionMenuItem opt; + opt.rect = rect(); +@@ -1712,7 +1777,7 @@ QSize QMenuBar::minimumSizeHint() const QSize QMenuBar::sizeHint() const { Q_D(const QMenuBar); @@ -3475,7 +3555,27 @@ const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; -@@ -1771,7 +1823,7 @@ QSize QMenuBar::sizeHint() const +@@ -1738,6 +1803,9 @@ QSize QMenuBar::sizeHint() const + ret += QSize(fw + hmargin, fw + vmargin); + } + int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; ++#ifdef Q_WS_X11 ++ if(as_gui_menubar) { ++#endif + if(d->leftWidget) { + QSize sz = d->leftWidget->sizeHint(); + ret.setWidth(ret.width() + sz.width()); +@@ -1750,6 +1818,9 @@ QSize QMenuBar::sizeHint() const + if(sz.height() + margin > ret.height()) + ret.setHeight(sz.height() + margin); + } ++#ifdef Q_WS_X11 ++ } ++#endif + if(as_gui_menubar) { + QStyleOptionMenuItem opt; + opt.rect = rect(); +@@ -1771,7 +1842,7 @@ QSize QMenuBar::sizeHint() const int QMenuBar::heightForWidth(int) const { Q_D(const QMenuBar); @@ -3484,7 +3584,24 @@ const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; -@@ -1814,7 +1866,15 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id) +@@ -1791,10 +1862,16 @@ int QMenuBar::heightForWidth(int) const + height += 2*vmargin; + } + int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; ++#ifdef Q_WS_X11 ++ if (as_gui_menubar) { ++#endif + if(d->leftWidget) + height = qMax(d->leftWidget->sizeHint().height() + margin, height); + if(d->rightWidget) + height = qMax(d->rightWidget->sizeHint().height() + margin, height); ++#ifdef Q_WS_X11 ++ } ++#endif + if(as_gui_menubar) { + QStyleOptionMenuItem opt; + opt.init(this); +@@ -1814,7 +1891,15 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id) { Q_Q(QMenuBar); QAction *act = actions.at(id); @@ -3501,7 +3618,29 @@ if (act && !act->menu()) { activateAction(act, QAction::Trigger); //100 is the same as the default value in QPushButton::animateClick -@@ -2000,6 +2060,34 @@ QAction *QMenuBar::defaultAction() const +@@ -1860,10 +1945,18 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) + return; + } + +- if (w) { +- w->setParent(this); +- w->installEventFilter(this); ++#ifdef Q_WS_X11 ++ if(isNativeMenuBar()) { ++ d->x11_menubar->updateCornerWidgetToolBar(); ++ } else { ++#endif ++ if (w) { ++ w->setParent(this); ++ w->installEventFilter(this); ++ } ++#ifdef Q_WS_X11 + } ++#endif + + d->_q_updateLayout(); + } +@@ -2000,6 +2093,34 @@ QAction *QMenuBar::defaultAction() const } #endif @@ -3553,22 +3692,23 @@ #endif // QT_NO_MENUBAR diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h -index 82070fe..c16b439 100644 +index 82070fe..355f019 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h -@@ -68,6 +68,11 @@ class CEikMenuBar; +@@ -68,6 +68,12 @@ class CEikMenuBar; #endif #endif +#ifdef Q_WS_X11 +class QDBusServiceWatcher; ++class QToolBar; +class DBusMenuExporter; +#endif + QT_BEGIN_NAMESPACE #ifndef QT_NO_MENUBAR -@@ -92,6 +97,9 @@ public: +@@ -92,6 +98,9 @@ public: #ifdef Q_WS_S60 , symbian_menubar(0) #endif @@ -3578,7 +3718,7 @@ { } ~QMenuBarPrivate() -@@ -105,6 +113,9 @@ public: +@@ -105,6 +114,9 @@ public: #ifdef Q_WS_S60 delete symbian_menubar; #endif @@ -3588,7 +3728,7 @@ } void init(); -@@ -150,6 +161,11 @@ public: +@@ -150,6 +162,11 @@ public: void _q_updateDefaultAction(); #endif @@ -3600,7 +3740,7 @@ //extra widgets in the menubar QPointer leftWidget, rightWidget; QMenuBarExtension *extension; -@@ -273,6 +289,33 @@ public: +@@ -273,6 +290,37 @@ public: QAction *menuBarAction; #endif #endif @@ -3622,9 +3762,13 @@ + + void popupAction(QAction *); + ++ void updateCornerWidgetToolBar(); ++ + DBusMenuExporter *exporter; + QMenu *rootMenu; + QMenuBar *menuBar; ++ QToolBar *cornerWidgetToolBar; ++ QWidget *cornerWidgetContainer; + QString objectPath; + uint previousWinId; + } *x11_menubar;