--- CMakeLists.txt.orig 2016-02-18 10:13:58 UTC +++ CMakeLists.txt @@ -25,7 +25,7 @@ set(dbusmenu_qt_lib_VERSION ${dbusmenu_qt_lib_SOVERSIO set(dbusmenu_qt_lib_VERSION ${dbusmenu_qt_lib_SOVERSION}.${dbusmenu_qt_lib_API_VERSION}.${dbusmenu_qt_lib_PATCH_VERSION}) # Check if we want to explicitly select the Qt version to be used or autodetect -if (NOT USE_QT4 AND NOT USE_QT5) +if (NOT USE_QT4 AND NOT USE_QT5 AND NOT USE_QT6) # Autodetect, prefering Qt5 message(STATUS "Autodetecting Qt version to use") find_package(Qt5Widgets QUIET) @@ -35,7 +35,15 @@ endif() endif() # Detect for which Qt version we're building -if (USE_QT5) +if (USE_QT6) + find_package(Qt6 REQUIRED COMPONENTS Core Widgets DBus) + include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}) + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTOMOC_RELAXED_MODE ON) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + set(QT_SUFFIX "qt6") +elseif (USE_QT5) find_package(Qt5Widgets REQUIRED) find_package(Qt5DBus REQUIRED) include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}) @@ -69,9 +77,9 @@ endif (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual") endif (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL) -check_cxx_compiler_flag(-std=c++11 __DBUSMENU_HAVE_CXX11) +check_cxx_compiler_flag(-std=c++17 __DBUSMENU_HAVE_CXX11) if (__DBUSMENU_HAVE_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") endif (__DBUSMENU_HAVE_CXX11) include(CMakePackageConfigHelpers) @@ -103,12 +111,10 @@ install(FILES ${CMAKE_BINARY_DIR}/dbusmenu-${QT_SUFFIX configure_file(dbusmenu-qt.pc.in ${CMAKE_BINARY_DIR}/dbusmenu-${QT_SUFFIX}.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/dbusmenu-${QT_SUFFIX}.pc - DESTINATION ${LIB_DESTINATION}/pkgconfig + DESTINATION libdata/pkgconfig ) add_subdirectory(src) -add_subdirectory(tests) -add_subdirectory(tools) if(WITH_DOC) configure_file(Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY) @@ -118,7 +124,7 @@ if(WITH_DOC) ) install(DIRECTORY ${CMAKE_BINARY_DIR}/html/ - DESTINATION share/doc/libdbusmenu-${QT_SUFFIX}-doc + DESTINATION share/doc/libdbusmenu-${QT_SUFFIX} ) endif(WITH_DOC) --- src/CMakeLists.txt.orig 2016-02-18 10:13:58 UTC +++ src/CMakeLists.txt @@ -21,20 +21,23 @@ endif (__DBUSMENU_HAVE_W_ALL) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif (__DBUSMENU_HAVE_W_ALL) -check_cxx_compiler_flag(-std=c++11 __DBUSMENU_HAVE_CXX11) +check_cxx_compiler_flag(-std=c++17 __DBUSMENU_HAVE_CXX11) if (__DBUSMENU_HAVE_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") endif (__DBUSMENU_HAVE_CXX11) # Check whether QIcon::name() exists. It was added in late Qt 4.7 cycle, and is # not present in betas. -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) set(CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}") set(CMAKE_REQUIRED_LIBRARIES "${QT_QTGUI_LIBRARIES};${QT_QTCORE_LIBRARIES}") -else() +elseif(USE_QT5) set(CMAKE_REQUIRED_INCLUDES "${Qt5Gui_INCLUDE_DIRS};${Qt5Core_INCLUDE_DIRS}") set(CMAKE_REQUIRED_LIBRARIES "${Qt5Gui_LIBRARIES};${Qt5Core_LIBRARIES}") +else() + set(CMAKE_REQUIRED_INCLUDES "${Qt6Gui_INCLUDE_DIRS};${Qt6Core_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${Qt6Gui_LIBRARIES};${Qt6Core_LIBRARIES}") endif() check_cxx_source_compiles(" #include @@ -64,17 +67,22 @@ include_directories( ${CMAKE_BINARY_DIR}/src ) -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) qt4_automoc(${dbusmenu_qt_SRCS}) qt4_add_dbus_adaptor(dbusmenu_qt_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.dbusmenu.xml ${CMAKE_CURRENT_SOURCE_DIR}/dbusmenuexporterdbus_p.h DBusMenuExporterDBus ) -else() +elseif(USE_QT5) qt5_add_dbus_adaptor(dbusmenu_qt_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.dbusmenu.xml ${CMAKE_CURRENT_SOURCE_DIR}/dbusmenuexporterdbus_p.h DBusMenuExporterDBus ) +else() + qt6_add_dbus_adaptor(dbusmenu_qt_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.dbusmenu.xml + ${CMAKE_CURRENT_SOURCE_DIR}/dbusmenuexporterdbus_p.h DBusMenuExporterDBus + ) endif() configure_file(dbusmenu_version.h.in @@ -88,7 +96,7 @@ set_target_properties(dbusmenu-${QT_SUFFIX} PROPERTIES ) -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) target_link_libraries(dbusmenu-${QT_SUFFIX} ${QT_QTGUI_LIBRARIES} ${QT_QTDBUS_LIBRARIES} @@ -96,10 +104,10 @@ else() ) else() target_link_libraries(dbusmenu-${QT_SUFFIX} - ${Qt5Gui_LIBRARIES} - ${Qt5Core_LIBRARIES} - ${Qt5DBus_LIBRARIES} - ${Qt5Widgets_LIBRARIES} + Qt::Gui + Qt::Core + Qt::DBus + Qt::Widgets ) endif() --- src/dbusmenuexporter.cpp.orig 2016-02-18 10:13:53 UTC +++ src/dbusmenuexporter.cpp @@ -29,6 +29,7 @@ #include #include #include +#include // Local #include "dbusmenu_config.h" @@ -484,7 +485,7 @@ void DBusMenuExporter::activateAction(QAction *action) { int id = d->idForAction(action); DMRETURN_IF_FAIL(id >= 0); - uint timeStamp = QDateTime::currentDateTime().toTime_t(); + uint timeStamp = QDateTime::currentDateTime().toSecsSinceEpoch(); d->m_dbusObject->ItemActivationRequested(id, timeStamp); } --- src/dbusmenuimporter.cpp.orig 2016-02-18 10:13:53 UTC +++ src/dbusmenuimporter.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // Local #include "dbusmenutypes_p.h" --- tests/CMakeLists.txt.orig 2016-02-18 10:13:58 UTC +++ tests/CMakeLists.txt @@ -1,9 +1,9 @@ -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) qt4_automoc(slowmenu.cpp) endif() add_executable(slowmenu slowmenu.cpp) -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) target_link_libraries(slowmenu ${QT_QTGUI_LIBRARIES} ${QT_QTDBUS_LIBRARIES} @@ -26,7 +26,7 @@ if (NOT USE_QT5) ${QT_QTTEST_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR} ) -else() +elseif(USE_QT5) find_package(Qt5Test REQUIRED) target_link_libraries(slowmenu @@ -51,6 +51,31 @@ else() ${Qt5Test_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ) +else() + find_package(Qt6Test REQUIRED) + + target_link_libraries(slowmenu + ${Qt6Gui_LIBRARIES} + ${Qt6Core_LIBRARIES} + ${Qt6DBus_LIBRARIES} + dbusmenu-qt6 + ) + + set(test_LIBRARIES + ${Qt6Gui_LIBRARIES} + ${Qt6Core_LIBRARIES} + ${Qt6DBus_LIBRARIES} + ${Qt6Test_LIBRARIES} + dbusmenu-qt6 + ) + + include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/../src + ${CMAKE_CURRENT_BINARY_DIR}/../src + ${CMAKE_CURRENT_BINARY_DIR} + ${Qt6Test_INCLUDE_DIRS} + ${Qt6DBus_INCLUDE_DIRS} + ) endif() # Macros to create "check" target @@ -77,7 +102,7 @@ set(dbusmenuexportertest_SRCS testutils.cpp ) -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) qt4_automoc(${dbusmenuexportertest_SRCS}) endif() @@ -94,7 +119,7 @@ set(dbusmenuimportertest_SRCS testutils.cpp ) -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) qt4_automoc(${dbusmenuimportertest_SRCS}) endif() @@ -110,7 +135,7 @@ set(dbusmenushortcuttest_SRCS dbusmenushortcuttest.cpp ) -if (NOT USE_QT5) +if (NOT USE_QT5 AND NOT USE_QT6) qt4_automoc(${dbusmenushortcuttest_SRCS}) endif() --- src/dbusmenushortcut_p.cpp.orig 2023-02-18 11:49:10 UTC +++ src/dbusmenushortcut_p.cpp @@ -22,6 +22,7 @@ // Qt #include +#include // Local #include "debug_p.h" @@ -82,4 +83,30 @@ QKeySequence DBusMenuShortcut::toKeySequence() const } QString string = tmp.join(QLatin1String(", ")); return QKeySequence::fromString(string); +} + +QDBusArgument &operator<<(QDBusArgument &argument, const DBusMenuShortcut &obj) +{ + int id = qMetaTypeId(); + argument.beginArray(id); + typename DBusMenuShortcut::ConstIterator it = obj.constBegin(); + typename DBusMenuShortcut::ConstIterator end = obj.constEnd(); + for ( ; it != end; ++it) + argument << *it; + argument.endArray(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, DBusMenuShortcut &obj) +{ + argument.beginArray(); + obj.clear(); + while (!argument.atEnd()) { + QStringList item; + argument >> item; + obj.push_back(item); + } + argument.endArray(); + + return argument; } --- src/dbusmenushortcut_p.h.orig 2023-02-18 11:49:59 UTC +++ src/dbusmenushortcut_p.h @@ -30,6 +30,7 @@ class QKeySequence; class QKeySequence; +class QDBusArgument; class DBUSMENU_EXPORT DBusMenuShortcut : public QList { @@ -39,5 +40,8 @@ Q_DECLARE_METATYPE(DBusMenuShortcut) }; Q_DECLARE_METATYPE(DBusMenuShortcut) + +DBUSMENU_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const DBusMenuShortcut &); +DBUSMENU_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, DBusMenuShortcut &); #endif /* DBUSMENUSHORTCUT_H */