mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-26 22:36:59 -05:00
Re-register global D-Bus menu when restoring window from tray, resolves #271
This commit is contained in:
parent
38d64a34a1
commit
8a26cfad79
@ -166,6 +166,9 @@ find_package(Qt5Widgets 5.2 REQUIRED)
|
|||||||
find_package(Qt5Test 5.2 REQUIRED)
|
find_package(Qt5Test 5.2 REQUIRED)
|
||||||
find_package(Qt5LinguistTools 5.2 REQUIRED)
|
find_package(Qt5LinguistTools 5.2 REQUIRED)
|
||||||
find_package(Qt5Network 5.2 REQUIRED)
|
find_package(Qt5Network 5.2 REQUIRED)
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
find_package(Qt5DBus 5.2 REQUIRED)
|
||||||
|
endif()
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
# Debian sets the the build type to None for package builds.
|
# Debian sets the the build type to None for package builds.
|
||||||
|
@ -197,7 +197,11 @@ target_link_libraries(zxcvbn)
|
|||||||
|
|
||||||
if(WITH_XC_HTTP)
|
if(WITH_XC_HTTP)
|
||||||
add_library(keepasshttp STATIC ${keepasshttp_SOURCES})
|
add_library(keepasshttp STATIC ${keepasshttp_SOURCES})
|
||||||
target_link_libraries(keepasshttp ${MHD_LIBRARIES} Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network)
|
target_link_libraries(keepasshttp ${MHD_LIBRARIES}
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Concurrent
|
||||||
|
Qt5::Widgets
|
||||||
|
Qt5::Network)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(autotype STATIC ${autotype_SOURCES})
|
add_library(autotype STATIC ${autotype_SOURCES})
|
||||||
@ -207,7 +211,14 @@ set(autotype_LIB autotype)
|
|||||||
|
|
||||||
add_library(keepassx_core STATIC ${keepassx_SOURCES})
|
add_library(keepassx_core STATIC ${keepassx_SOURCES})
|
||||||
set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
|
set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
|
||||||
target_link_libraries(keepassx_core zxcvbn ${keepasshttp_LIB} ${autotype_LIB} Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network)
|
target_link_libraries(keepassx_core zxcvbn ${keepasshttp_LIB} ${autotype_LIB}
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Concurrent
|
||||||
|
Qt5::Widgets
|
||||||
|
Qt5::Network)
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
target_link_libraries(keepassx_core Qt5::DBus)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE})
|
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE})
|
||||||
target_link_libraries(${PROGNAME}
|
target_link_libraries(${PROGNAME}
|
||||||
@ -221,6 +232,7 @@ target_link_libraries(${PROGNAME}
|
|||||||
${GPGERROR_LIBRARIES}
|
${GPGERROR_LIBRARIES}
|
||||||
${ZLIB_LIBRARIES})
|
${ZLIB_LIBRARIES})
|
||||||
|
|
||||||
|
|
||||||
set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON)
|
set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
@ -22,6 +22,11 @@
|
|||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS)
|
||||||
|
#include <QList>
|
||||||
|
#include <QtDBus/QtDBus>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "config-keepassx.h"
|
#include "config-keepassx.h"
|
||||||
|
|
||||||
#include "autotype/AutoType.h"
|
#include "autotype/AutoType.h"
|
||||||
@ -735,6 +740,24 @@ void MainWindow::toggleWindow()
|
|||||||
setWindowState(windowState() & ~Qt::WindowMinimized);
|
setWindowState(windowState() & ~Qt::WindowMinimized);
|
||||||
raise();
|
raise();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
// re-register global D-Bus menu (needed on Ubuntu with Unity)
|
||||||
|
// see https://github.com/keepassxreboot/keepassxc/issues/271
|
||||||
|
// and https://bugreports.qt.io/browse/QTBUG-58723
|
||||||
|
if (m_ui->menubar->isNativeMenuBar()) {
|
||||||
|
QDBusMessage msg = QDBusMessage::createMethodCall(
|
||||||
|
"com.canonical.AppMenu.Registrar",
|
||||||
|
"/com/canonical/AppMenu/Registrar",
|
||||||
|
"com.canonical.AppMenu.Registrar",
|
||||||
|
"RegisterWindow");
|
||||||
|
QList<QVariant> args;
|
||||||
|
args << QVariant::fromValue(static_cast<uint32_t>(winId()))
|
||||||
|
<< QVariant::fromValue(QDBusObjectPath("/MenuBar/1"));
|
||||||
|
msg.setArguments(args);
|
||||||
|
QDBusConnection::sessionBus().send(msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user