This patch puts back external contributions to dbusmenu-qt and will hopefully go away when copyright issues in upstream project are resolved. Index: libdbusmenu-qt-0.6.3/.gitattributes =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libdbusmenu-qt-0.6.3/.gitattributes 2010-09-16 17:11:42.000000000 +0200 @@ -0,0 +1 @@ +org.ayatana.dbusmenu.xml -crlf Index: libdbusmenu-qt-0.6.3/.krazy =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libdbusmenu-qt-0.6.3/.krazy 2010-09-16 17:11:42.000000000 +0200 @@ -0,0 +1 @@ +SKIP /tests/ Index: libdbusmenu-qt-0.6.3/CMakeLists.txt =================================================================== --- libdbusmenu-qt-0.6.3.orig/CMakeLists.txt 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/CMakeLists.txt 2010-09-16 17:11:42.000000000 +0200 @@ -36,7 +36,7 @@ set(dbusmenu_qt_lib_PATCH_VERSION 3) set(dbusmenu_qt_lib_VERSION ${dbusmenu_qt_lib_SOVERSION}.${dbusmenu_qt_lib_API_VERSION}.${dbusmenu_qt_lib_PATCH_VERSION}) -find_package(Qt4 REQUIRED) +find_package(Qt4 4.6.0 REQUIRED) include_directories( ${QT_INCLUDE_DIR} @@ -52,6 +52,10 @@ DESTINATION lib${LIB_SUFFIX}/pkgconfig ) +option(BUILD_TESTS "Build tests" ON) + add_subdirectory(src) -add_subdirectory(tests) +if (BUILD_TESTS) + add_subdirectory(tests) +endif (BUILD_TESTS) add_subdirectory(tools) Index: libdbusmenu-qt-0.6.3/cmake/modules/FindQJSON.cmake =================================================================== --- libdbusmenu-qt-0.6.3.orig/cmake/modules/FindQJSON.cmake 2010-09-16 17:10:25.000000000 +0200 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -# Find QJSON - JSON handling library for Qt -# -# This module defines -# QJSON_FOUND - whether the qsjon library was found -# QJSON_LIBRARIES - the qjson library -# QJSON_INCLUDE_DIR - the include path of the qjson library -# - -if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) - - # Already in cache - set (QJSON_FOUND TRUE) - -else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) - - if (NOT WIN32) - # use pkg-config to get the values of QJSON_INCLUDE_DIRS - # and QJSON_LIBRARY_DIRS to add as hints to the find commands. - include (FindPkgConfig) - pkg_check_modules (QJSON QJson>=0.5) - endif (NOT WIN32) - - find_library (QJSON_LIBRARIES - NAMES - qjson - PATHS - ${QJSON_LIBRARY_DIRS} - ${LIB_INSTALL_DIR} - ${KDE4_LIB_DIR} - ) - - find_path (QJSON_INCLUDE_DIR - NAMES - qjson/parser.h - PATHS - ${QJSON_INCLUDE_DIRS} - ${INCLUDE_INSTALL_DIR} - ${KDE4_INCLUDE_DIR} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR) - -endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) Index: libdbusmenu-qt-0.6.3/cmake/modules/FindQJson.cmake =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libdbusmenu-qt-0.6.3/cmake/modules/FindQJson.cmake 2010-09-16 17:11:42.000000000 +0200 @@ -0,0 +1,39 @@ +# - Try to find the QJson library +# Once done this will define +# +# QJSON_FOUND - system has the QJson library +# QJSON_INCLUDE_DIR - the QJson include directory +# QJSON_LIBRARY - Link this to use the QJson library +# +# Copyright (c) 2010, Pino Toscano, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (QJSON_INCLUDE_DIR AND QJSON_LIBRARY) + + # in cache already + set(QJSON_FOUND TRUE) + +else (QJSON_INCLUDE_DIR AND QJSON_LIBRARY) + if (NOT WIN32) + find_package(PkgConfig) + pkg_check_modules(PC_QJSON QJson) + endif(NOT WIN32) + + find_path(QJSON_INCLUDE_DIR qjson/parser.h + HINTS + ${PC_QJSON_INCLUDE_DIRS} + ) + + find_library(QJSON_LIBRARY NAMES qjson + HINTS + ${PC_QJSON_LIBRARY_DIRS} + ) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(QJson DEFAULT_MSG QJSON_LIBRARY QJSON_INCLUDE_DIR) + + mark_as_advanced(QJSON_INCLUDE_DIR QJSON_LIBRARY) + +endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARY) Index: libdbusmenu-qt-0.6.3/dbusmenu-qt.pc.in =================================================================== --- libdbusmenu-qt-0.6.3.orig/dbusmenu-qt.pc.in 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/dbusmenu-qt.pc.in 2010-09-16 17:11:42.000000000 +0200 @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@CMAKE_INSTALL_PREFIX@/lib +libdir=@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@ includedir=@CMAKE_INSTALL_PREFIX@/include/dbusmenu-qt Name: libdbusmenu-qt Index: libdbusmenu-qt-0.6.3/src/CMakeLists.txt =================================================================== --- libdbusmenu-qt-0.6.3.orig/src/CMakeLists.txt 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/src/CMakeLists.txt 2010-09-16 17:11:42.000000000 +0200 @@ -17,6 +17,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif (__DBUSMENU_HAVE_W_ALL) +if (MSVC) + add_definitions(-D__PRETTY_FUNCTION__=__FUNCTION__) +endif (MSVC) + # Check whether QIcon::name() exists. It was added in late Qt 4.7 cycle, and is # not present in betas. set(CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}") @@ -34,6 +38,7 @@ endif() configure_file(dbusmenu_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/dbusmenu_config.h @ONLY) + set(dbusmenu_qt_SRCS dbusmenu_p.cpp dbusmenuexporter.cpp @@ -74,7 +79,10 @@ ) install(TARGETS dbusmenu-qt - LIBRARY DESTINATION lib${LIB_SUFFIX}) + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) install(DIRECTORY . DESTINATION include/dbusmenu-qt Index: libdbusmenu-qt-0.6.3/src/dbusmenuexporter.cpp =================================================================== --- libdbusmenu-qt-0.6.3.orig/src/dbusmenuexporter.cpp 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/src/dbusmenuexporter.cpp 2010-09-16 17:11:42.000000000 +0200 @@ -79,6 +79,7 @@ { QVariantMap map; map.insert("enabled", false); + map.insert("x-kde-title", true); const QWidgetAction *widgetAction = qobject_cast(action_); DMRETURN_VALUE_IF_FAIL(widgetAction, map); Index: libdbusmenu-qt-0.6.3/src/dbusmenuimporter.cpp =================================================================== --- libdbusmenu-qt-0.6.3.orig/src/dbusmenuimporter.cpp 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/src/dbusmenuimporter.cpp 2010-09-16 17:11:42.000000000 +0200 @@ -32,6 +32,8 @@ #include #include #include +#include +#include // Local #include "dbusmenuitem_p.h" @@ -41,7 +43,6 @@ //#define BENCHMARK #ifdef BENCHMARK -#include static QTime sChrono; #endif @@ -66,6 +67,29 @@ DBusMenuImporterMethod m_method; }; +class EventSniffer : public QObject +{ +public: + EventSniffer(QObject *parent = 0) + : QObject(parent) { } + + ~EventSniffer() { } + + bool eventFilter(QObject *object, QEvent *event) + { + Q_UNUSED(object); + + if (event->type() == QEvent::Paint || + event->type() == QEvent::KeyPress || + event->type() == QEvent::KeyRelease) { + return false; + } + + event->accept(); + return true; + } +}; + class DBusMenuImporterPrivate { public: @@ -143,8 +167,30 @@ group->addAction(action); } } + + bool isMenuTitle = map.take("x-kde-title").toBool(); + updateAction(action, map, map.keys()); + if (isMenuTitle) { + QAction *buttonAction = action; + QFont font = buttonAction->font(); + font.setBold(true); + buttonAction->setFont(font); + buttonAction->setEnabled(true); + + QWidgetAction *action = new QWidgetAction(parent); + action->setObjectName("kmenu_title"); + QToolButton *titleButton = new QToolButton(0); + EventSniffer *eventSniffer = new EventSniffer(titleButton); + titleButton->installEventFilter(eventSniffer); // prevent clicks on the title of the menu + titleButton->setDefaultAction(buttonAction); + titleButton->setDown(true); // prevent hover style changes in some styles + titleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + action->setDefaultWidget(titleButton); + return action; + } + return action; } Index: libdbusmenu-qt-0.6.3/src/dbusmenuimporter.h =================================================================== --- libdbusmenu-qt-0.6.3.orig/src/dbusmenuimporter.h 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/src/dbusmenuimporter.h 2010-09-16 17:11:42.000000000 +0200 @@ -109,12 +109,12 @@ void dispatch(QDBusPendingCallWatcher *); void sendClickedEvent(int); void slotItemUpdated(int id); + void slotLayoutUpdated(uint revision, int parentId); void slotMenuAboutToShow(); void slotAboutToShowDBusCallFinished(QDBusPendingCallWatcher *); void slotItemPropertyUpdated(int id, const QString &key, const QDBusVariant &value); void slotItemActivationRequested(int id, uint timestamp); void processPendingLayoutUpdates(); - void slotLayoutUpdated(uint revision, int parentId); private: Q_DISABLE_COPY(DBusMenuImporter) Index: libdbusmenu-qt-0.6.3/src/dbusmenushortcut_p.cpp =================================================================== --- libdbusmenu-qt-0.6.3.orig/src/dbusmenushortcut_p.cpp 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/src/dbusmenushortcut_p.cpp 2010-09-16 17:11:42.000000000 +0200 @@ -29,6 +29,11 @@ static const int QT_COLUMN = 0; static const int DM_COLUMN = 1; +#ifdef _MSC_VER +// dummy implementation to make MSVC happy (due to QList::toSet()) +uint qHash( const QStringList& key ) { return 0; } +#endif + static void processKeyTokens(QStringList* tokens, int srcCol, int dstCol) { struct Row { Index: libdbusmenu-qt-0.6.3/src/dbusmenushortcut_p.h =================================================================== --- libdbusmenu-qt-0.6.3.orig/src/dbusmenushortcut_p.h 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/src/dbusmenushortcut_p.h 2010-09-16 17:11:42.000000000 +0200 @@ -38,6 +38,10 @@ static DBusMenuShortcut fromKeySequence(const QKeySequence&); }; +#ifdef _MSC_VER +uint qHash( const QStringList& key ); +#endif + Q_DECLARE_METATYPE(DBusMenuShortcut) #endif /* DBUSMENUSHORTCUT_H */ Index: libdbusmenu-qt-0.6.3/tools/CMakeLists.txt =================================================================== --- libdbusmenu-qt-0.6.3.orig/tools/CMakeLists.txt 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/tools/CMakeLists.txt 2010-09-16 17:11:42.000000000 +0200 @@ -1,7 +1,11 @@ -find_package(QJSON) -if (QJSON_FOUND) - message(STATUS "QJSON found, testapp will be built") - add_subdirectory(testapp) -else (QJSON_FOUND) - message(STATUS "QJSON not found, testapp will not be built") -endif (QJSON_FOUND) +if (BUILD_TESTS) + find_package(QJson) + if (QJSON_FOUND) + message(STATUS "QJSON found and tests enabled, testapp will be built") + add_subdirectory(testapp) + else (QJSON_FOUND) + message(STATUS "QJSON not found, testapp will not be built") + endif (QJSON_FOUND) +else (BUILD_TESTS) + message(STATUS "Tests disabled, testapp will not be built") +endif (BUILD_TESTS) Index: libdbusmenu-qt-0.6.3/tools/testapp/CMakeLists.txt =================================================================== --- libdbusmenu-qt-0.6.3.orig/tools/testapp/CMakeLists.txt 2010-09-16 17:10:25.000000000 +0200 +++ libdbusmenu-qt-0.6.3/tools/testapp/CMakeLists.txt 2010-09-16 17:11:42.000000000 +0200 @@ -19,5 +19,5 @@ ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} - ${QJSON_LIBRARIES} + ${QJSON_LIBRARY} )