mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Operate with QString instead of QDBusObjectPath
This commit is contained in:
parent
e594b75f4c
commit
e247be7e33
2 changed files with 8 additions and 9 deletions
|
@ -48,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtDBus/QDBusMessage>
|
#include <QtDBus/QDBusMessage>
|
||||||
#include <QtDBus/QDBusReply>
|
#include <QtDBus/QDBusReply>
|
||||||
#include <QtDBus/QDBusError>
|
#include <QtDBus/QDBusError>
|
||||||
|
#include <QtDBus/QDBusObjectPath>
|
||||||
#include <QtDBus/QDBusMetaType>
|
#include <QtDBus/QDBusMetaType>
|
||||||
|
|
||||||
#include <statusnotifieritem.h>
|
#include <statusnotifieritem.h>
|
||||||
|
@ -451,7 +452,7 @@ bool IsAppMenuSupported() {
|
||||||
return interface->isServiceRegistered(kAppMenuService.utf16());
|
return interface->isServiceRegistered(kAppMenuService.utf16());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterAppMenu(uint winId, const QDBusObjectPath &menuPath) {
|
void RegisterAppMenu(uint winId, const QString &menuPath) {
|
||||||
auto message = QDBusMessage::createMethodCall(
|
auto message = QDBusMessage::createMethodCall(
|
||||||
kAppMenuService.utf16(),
|
kAppMenuService.utf16(),
|
||||||
kAppMenuObjectPath.utf16(),
|
kAppMenuObjectPath.utf16(),
|
||||||
|
@ -460,7 +461,7 @@ void RegisterAppMenu(uint winId, const QDBusObjectPath &menuPath) {
|
||||||
|
|
||||||
message.setArguments({
|
message.setArguments({
|
||||||
winId,
|
winId,
|
||||||
QVariant::fromValue(menuPath)
|
QVariant::fromValue(QDBusObjectPath(menuPath))
|
||||||
});
|
});
|
||||||
|
|
||||||
QDBusConnection::sessionBus().send(message);
|
QDBusConnection::sessionBus().send(message);
|
||||||
|
@ -759,7 +760,7 @@ void MainWindow::handleAppMenuOwnerChanged(
|
||||||
LOG(("Not using D-Bus global menu."));
|
LOG(("Not using D-Bus global menu."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_appMenuSupported && !_mainMenuPath.path().isEmpty()) {
|
if (_appMenuSupported && !_mainMenuPath.isEmpty()) {
|
||||||
RegisterAppMenu(winId(), _mainMenuPath);
|
RegisterAppMenu(winId(), _mainMenuPath);
|
||||||
} else {
|
} else {
|
||||||
UnregisterAppMenu(winId());
|
UnregisterAppMenu(winId());
|
||||||
|
@ -1075,10 +1076,10 @@ void MainWindow::createGlobalMenu() {
|
||||||
|
|
||||||
about->setMenuRole(QAction::AboutQtRole);
|
about->setMenuRole(QAction::AboutQtRole);
|
||||||
|
|
||||||
_mainMenuPath.setPath(qsl("/MenuBar"));
|
_mainMenuPath = qsl("/MenuBar");
|
||||||
|
|
||||||
_mainMenuExporter = new DBusMenuExporter(
|
_mainMenuExporter = new DBusMenuExporter(
|
||||||
_mainMenuPath.path(),
|
_mainMenuPath,
|
||||||
psMainMenu);
|
psMainMenu);
|
||||||
|
|
||||||
if (_appMenuSupported) {
|
if (_appMenuSupported) {
|
||||||
|
@ -1214,7 +1215,7 @@ void MainWindow::handleVisibleChangedHook(bool visible) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
if (_appMenuSupported && !_mainMenuPath.path().isEmpty()) {
|
if (_appMenuSupported && !_mainMenuPath.isEmpty()) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
RegisterAppMenu(winId(), _mainMenuPath);
|
RegisterAppMenu(winId(), _mainMenuPath);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,8 +14,6 @@ class PopupMenu;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
#include <QtDBus/QDBusObjectPath>
|
|
||||||
|
|
||||||
class QTemporaryFile;
|
class QTemporaryFile;
|
||||||
class DBusMenuExporter;
|
class DBusMenuExporter;
|
||||||
class StatusNotifierItem;
|
class StatusNotifierItem;
|
||||||
|
@ -94,7 +92,7 @@ private:
|
||||||
|
|
||||||
bool _appMenuSupported = false;
|
bool _appMenuSupported = false;
|
||||||
DBusMenuExporter *_mainMenuExporter = nullptr;
|
DBusMenuExporter *_mainMenuExporter = nullptr;
|
||||||
QDBusObjectPath _mainMenuPath;
|
QString _mainMenuPath;
|
||||||
|
|
||||||
std::unique_ptr<internal::GSDMediaKeys> _gsdMediaKeys;
|
std::unique_ptr<internal::GSDMediaKeys> _gsdMediaKeys;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue