Use QMenuBar instead of own global menu implementation on Linux
This commit is contained in:
parent
60cbd96d91
commit
79f96480c2
|
@ -94,7 +94,6 @@ if (LINUX)
|
||||||
target_link_libraries(Telegram
|
target_link_libraries(Telegram
|
||||||
PRIVATE
|
PRIVATE
|
||||||
desktop-app::external_statusnotifieritem
|
desktop-app::external_statusnotifieritem
|
||||||
desktop-app::external_dbusmenu_qt
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <surface.h>
|
#include <surface.h>
|
||||||
#include <xdgforeign.h>
|
#include <xdgforeign.h>
|
||||||
#include <plasmashell.h>
|
#include <plasmashell.h>
|
||||||
#include <appmenu.h>
|
|
||||||
|
|
||||||
using namespace KWayland::Client;
|
using namespace KWayland::Client;
|
||||||
|
|
||||||
|
@ -37,10 +36,6 @@ public:
|
||||||
return _plasmaShell.get();
|
return _plasmaShell.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] AppMenuManager *appMenuManager() {
|
|
||||||
return _appMenuManager.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] QEventLoop &interfacesLoop() {
|
[[nodiscard]] QEventLoop &interfacesLoop() {
|
||||||
return _interfacesLoop;
|
return _interfacesLoop;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +51,6 @@ private:
|
||||||
Registry _applicationRegistry;
|
Registry _applicationRegistry;
|
||||||
std::unique_ptr<XdgExporter> _xdgExporter;
|
std::unique_ptr<XdgExporter> _xdgExporter;
|
||||||
std::unique_ptr<PlasmaShell> _plasmaShell;
|
std::unique_ptr<PlasmaShell> _plasmaShell;
|
||||||
std::unique_ptr<AppMenuManager> _appMenuManager;
|
|
||||||
QEventLoop _interfacesLoop;
|
QEventLoop _interfacesLoop;
|
||||||
bool _interfacesAnnounced = false;
|
bool _interfacesAnnounced = false;
|
||||||
};
|
};
|
||||||
|
@ -123,21 +117,6 @@ WaylandIntegration::Private::Private()
|
||||||
&PlasmaShell::destroy);
|
&PlasmaShell::destroy);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(
|
|
||||||
&_applicationRegistry,
|
|
||||||
&Registry::appMenuAnnounced,
|
|
||||||
[=](uint name, uint version) {
|
|
||||||
_appMenuManager = std::unique_ptr<AppMenuManager>{
|
|
||||||
_applicationRegistry.createAppMenuManager(name, version),
|
|
||||||
};
|
|
||||||
|
|
||||||
connect(
|
|
||||||
_applicationConnection,
|
|
||||||
&ConnectionThread::connectionDied,
|
|
||||||
_appMenuManager.get(),
|
|
||||||
&AppMenuManager::destroy);
|
|
||||||
});
|
|
||||||
|
|
||||||
_connection.initConnection();
|
_connection.initConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,27 +187,5 @@ void WaylandIntegration::skipTaskbar(QWindow *window, bool skip) {
|
||||||
plasmaSurface->setSkipTaskbar(skip);
|
plasmaSurface->setSkipTaskbar(skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandIntegration::registerAppMenu(
|
|
||||||
QWindow *window,
|
|
||||||
const QString &serviceName,
|
|
||||||
const QString &objectPath) {
|
|
||||||
const auto manager = _private->appMenuManager();
|
|
||||||
if (!manager) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto surface = Surface::fromWindow(window);
|
|
||||||
if (!surface) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto appMenu = manager->create(surface, surface);
|
|
||||||
if (!appMenu) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
appMenu->setAddress(serviceName, objectPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
|
@ -18,10 +18,6 @@ public:
|
||||||
[[nodiscard]] QString nativeHandle(QWindow *window);
|
[[nodiscard]] QString nativeHandle(QWindow *window);
|
||||||
[[nodiscard]] bool skipTaskbarSupported();
|
[[nodiscard]] bool skipTaskbarSupported();
|
||||||
void skipTaskbar(QWindow *window, bool skip);
|
void skipTaskbar(QWindow *window, bool skip);
|
||||||
void registerAppMenu(
|
|
||||||
QWindow *window,
|
|
||||||
const QString &serviceName,
|
|
||||||
const QString &objectPath);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WaylandIntegration();
|
WaylandIntegration();
|
||||||
|
|
|
@ -44,11 +44,5 @@ bool WaylandIntegration::skipTaskbarSupported() {
|
||||||
void WaylandIntegration::skipTaskbar(QWindow *window, bool skip) {
|
void WaylandIntegration::skipTaskbar(QWindow *window, bool skip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandIntegration::registerAppMenu(
|
|
||||||
QWindow *window,
|
|
||||||
const QString &serviceName,
|
|
||||||
const QString &objectPath) {
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
|
@ -43,15 +43,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtCore/QSize>
|
#include <QtCore/QSize>
|
||||||
#include <QtCore/QTemporaryFile>
|
#include <QtCore/QTemporaryFile>
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
#include <QtWidgets/QMenuBar>
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
#include <QtDBus/QDBusConnection>
|
|
||||||
#include <QtDBus/QDBusMessage>
|
|
||||||
#include <QtDBus/QDBusObjectPath>
|
|
||||||
#include <QtDBus/QDBusMetaType>
|
#include <QtDBus/QDBusMetaType>
|
||||||
|
|
||||||
#include <statusnotifieritem.h>
|
#include <statusnotifieritem.h>
|
||||||
#include <dbusmenuexporter.h>
|
|
||||||
|
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
#include <giomm.h>
|
#include <giomm.h>
|
||||||
|
@ -74,12 +71,6 @@ constexpr auto kSNIWatcherService = "org.kde.StatusNotifierWatcher"_cs;
|
||||||
constexpr auto kSNIWatcherObjectPath = "/StatusNotifierWatcher"_cs;
|
constexpr auto kSNIWatcherObjectPath = "/StatusNotifierWatcher"_cs;
|
||||||
constexpr auto kSNIWatcherInterface = kSNIWatcherService;
|
constexpr auto kSNIWatcherInterface = kSNIWatcherService;
|
||||||
|
|
||||||
constexpr auto kAppMenuService = "com.canonical.AppMenu.Registrar"_cs;
|
|
||||||
constexpr auto kAppMenuObjectPath = "/com/canonical/AppMenu/Registrar"_cs;
|
|
||||||
constexpr auto kAppMenuInterface = kAppMenuService;
|
|
||||||
|
|
||||||
constexpr auto kMainMenuObjectPath = "/MenuBar"_cs;
|
|
||||||
|
|
||||||
bool TrayIconMuted = true;
|
bool TrayIconMuted = true;
|
||||||
int32 TrayIconCount = 0;
|
int32 TrayIconCount = 0;
|
||||||
base::flat_map<int, QImage> TrayIconImageBack;
|
base::flat_map<int, QImage> TrayIconImageBack;
|
||||||
|
@ -364,6 +355,31 @@ QIcon TrayIconGen(int counter, bool muted) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendKeySequence(
|
||||||
|
Qt::Key key,
|
||||||
|
Qt::KeyboardModifiers modifiers = Qt::NoModifier) {
|
||||||
|
const auto focused = QApplication::focusWidget();
|
||||||
|
if (qobject_cast<QLineEdit*>(focused)
|
||||||
|
|| qobject_cast<QTextEdit*>(focused)
|
||||||
|
|| qobject_cast<HistoryInner*>(focused)) {
|
||||||
|
QApplication::postEvent(
|
||||||
|
focused,
|
||||||
|
new QKeyEvent(QEvent::KeyPress, key, modifiers));
|
||||||
|
|
||||||
|
QApplication::postEvent(
|
||||||
|
focused,
|
||||||
|
new QKeyEvent(QEvent::KeyRelease, key, modifiers));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ForceDisabled(QAction *action, bool disabled) {
|
||||||
|
if (action->isEnabled()) {
|
||||||
|
if (disabled) action->setDisabled(true);
|
||||||
|
} else if (!disabled) {
|
||||||
|
action->setDisabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
bool IsIndicatorApplication() {
|
bool IsIndicatorApplication() {
|
||||||
// Hack for indicator-application,
|
// Hack for indicator-application,
|
||||||
|
@ -520,90 +536,6 @@ uint djbStringHash(const std::string &string) {
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsAppMenuSupported() {
|
|
||||||
try {
|
|
||||||
const auto connection = Gio::DBus::Connection::get_sync(
|
|
||||||
Gio::DBus::BusType::BUS_TYPE_SESSION);
|
|
||||||
|
|
||||||
return base::Platform::DBus::NameHasOwner(
|
|
||||||
connection,
|
|
||||||
std::string(kAppMenuService));
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This call must be made from the same bus connection as DBusMenuExporter
|
|
||||||
// So it must use QDBusConnection
|
|
||||||
void RegisterAppMenu(QWindow *window, const QString &menuPath) {
|
|
||||||
if (const auto integration = WaylandIntegration::Instance()) {
|
|
||||||
integration->registerAppMenu(
|
|
||||||
window,
|
|
||||||
QDBusConnection::sessionBus().baseService(),
|
|
||||||
menuPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto message = QDBusMessage::createMethodCall(
|
|
||||||
kAppMenuService.utf16(),
|
|
||||||
kAppMenuObjectPath.utf16(),
|
|
||||||
kAppMenuInterface.utf16(),
|
|
||||||
qsl("RegisterWindow"));
|
|
||||||
|
|
||||||
message.setArguments({
|
|
||||||
window->winId(),
|
|
||||||
QVariant::fromValue(QDBusObjectPath(menuPath))
|
|
||||||
});
|
|
||||||
|
|
||||||
QDBusConnection::sessionBus().send(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This call must be made from the same bus connection as DBusMenuExporter
|
|
||||||
// So it must use QDBusConnection
|
|
||||||
void UnregisterAppMenu(QWindow *window) {
|
|
||||||
if (const auto integration = WaylandIntegration::Instance()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto message = QDBusMessage::createMethodCall(
|
|
||||||
kAppMenuService.utf16(),
|
|
||||||
kAppMenuObjectPath.utf16(),
|
|
||||||
kAppMenuInterface.utf16(),
|
|
||||||
qsl("UnregisterWindow"));
|
|
||||||
|
|
||||||
message.setArguments({
|
|
||||||
window->winId()
|
|
||||||
});
|
|
||||||
|
|
||||||
QDBusConnection::sessionBus().send(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendKeySequence(
|
|
||||||
Qt::Key key,
|
|
||||||
Qt::KeyboardModifiers modifiers = Qt::NoModifier) {
|
|
||||||
const auto focused = QApplication::focusWidget();
|
|
||||||
if (qobject_cast<QLineEdit*>(focused)
|
|
||||||
|| qobject_cast<QTextEdit*>(focused)
|
|
||||||
|| qobject_cast<HistoryInner*>(focused)) {
|
|
||||||
QApplication::postEvent(
|
|
||||||
focused,
|
|
||||||
new QKeyEvent(QEvent::KeyPress, key, modifiers));
|
|
||||||
|
|
||||||
QApplication::postEvent(
|
|
||||||
focused,
|
|
||||||
new QKeyEvent(QEvent::KeyRelease, key, modifiers));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ForceDisabled(QAction *action, bool disabled) {
|
|
||||||
if (action->isEnabled()) {
|
|
||||||
if (disabled) action->setDisabled(true);
|
|
||||||
} else if (!disabled) {
|
|
||||||
action->setDisabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -628,7 +560,6 @@ MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
||||||
void MainWindow::initHook() {
|
void MainWindow::initHook() {
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
_sniAvailable = IsSNIAvailable();
|
_sniAvailable = IsSNIAvailable();
|
||||||
_appMenuSupported = IsAppMenuSupported();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_private->dbusConnection = Gio::DBus::Connection::get_sync(
|
_private->dbusConnection = Gio::DBus::Connection::get_sync(
|
||||||
|
@ -667,19 +598,6 @@ void MainWindow::initHook() {
|
||||||
QString::fromStdString(oldOwner),
|
QString::fromStdString(oldOwner),
|
||||||
QString::fromStdString(newOwner));
|
QString::fromStdString(newOwner));
|
||||||
});
|
});
|
||||||
|
|
||||||
_appMenuWatcherId = base::Platform::DBus::RegisterServiceWatcher(
|
|
||||||
_private->dbusConnection,
|
|
||||||
std::string(kAppMenuService),
|
|
||||||
[=](
|
|
||||||
const Glib::ustring &service,
|
|
||||||
const Glib::ustring &oldOwner,
|
|
||||||
const Glib::ustring &newOwner) {
|
|
||||||
handleAppMenuOwnerChanged(
|
|
||||||
QString::fromStdString(service),
|
|
||||||
QString::fromStdString(oldOwner),
|
|
||||||
QString::fromStdString(newOwner));
|
|
||||||
});
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,12 +622,6 @@ void MainWindow::initHook() {
|
||||||
return base::EventFilterResult::Continue;
|
return base::EventFilterResult::Continue;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (_appMenuSupported) {
|
|
||||||
LOG(("Using D-Bus global menu."));
|
|
||||||
} else {
|
|
||||||
LOG(("Not using D-Bus global menu."));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UseUnityCounter()) {
|
if (UseUnityCounter()) {
|
||||||
LOG(("Using Unity launcher counter."));
|
LOG(("Using Unity launcher counter."));
|
||||||
} else {
|
} else {
|
||||||
|
@ -864,25 +776,6 @@ void MainWindow::handleSNIOwnerChanged(
|
||||||
(Core::App().settings().workMode() == WorkMode::TrayOnly)
|
(Core::App().settings().workMode() == WorkMode::TrayOnly)
|
||||||
&& trayAvailable());
|
&& trayAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::handleAppMenuOwnerChanged(
|
|
||||||
const QString &service,
|
|
||||||
const QString &oldOwner,
|
|
||||||
const QString &newOwner) {
|
|
||||||
if (oldOwner.isEmpty() && !newOwner.isEmpty()) {
|
|
||||||
_appMenuSupported = true;
|
|
||||||
LOG(("Using D-Bus global menu."));
|
|
||||||
} else if (!oldOwner.isEmpty() && newOwner.isEmpty()) {
|
|
||||||
_appMenuSupported = false;
|
|
||||||
LOG(("Not using D-Bus global menu."));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_appMenuSupported && _mainMenuExporter) {
|
|
||||||
RegisterAppMenu(windowHandle(), kMainMenuObjectPath.utf16());
|
|
||||||
} else {
|
|
||||||
UnregisterAppMenu(windowHandle());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
void MainWindow::psSetupTrayIcon() {
|
void MainWindow::psSetupTrayIcon() {
|
||||||
|
@ -1007,16 +900,6 @@ void MainWindow::initTrayMenuHook() {
|
||||||
_trayIconMenuXEmbed->deleteOnHide(false);
|
_trayIconMenuXEmbed->deleteOnHide(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
|
||||||
|
|
||||||
void MainWindow::createGlobalMenu() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateGlobalMenuHook() {
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
|
||||||
|
|
||||||
void MainWindow::createGlobalMenu() {
|
void MainWindow::createGlobalMenu() {
|
||||||
const auto ensureWindowShown = [=] {
|
const auto ensureWindowShown = [=] {
|
||||||
if (isHidden()) {
|
if (isHidden()) {
|
||||||
|
@ -1024,7 +907,8 @@ void MainWindow::createGlobalMenu() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
psMainMenu = new QMenu(this);
|
psMainMenu = new QMenuBar(this);
|
||||||
|
psMainMenu->hide();
|
||||||
|
|
||||||
auto file = psMainMenu->addMenu(tr::lng_mac_menu_file(tr::now));
|
auto file = psMainMenu->addMenu(tr::lng_mac_menu_file(tr::now));
|
||||||
|
|
||||||
|
@ -1201,14 +1085,6 @@ void MainWindow::createGlobalMenu() {
|
||||||
|
|
||||||
about->setMenuRole(QAction::AboutQtRole);
|
about->setMenuRole(QAction::AboutQtRole);
|
||||||
|
|
||||||
_mainMenuExporter = new DBusMenuExporter(
|
|
||||||
kMainMenuObjectPath.utf16(),
|
|
||||||
psMainMenu);
|
|
||||||
|
|
||||||
if (_appMenuSupported) {
|
|
||||||
RegisterAppMenu(windowHandle(), kMainMenuObjectPath.utf16());
|
|
||||||
}
|
|
||||||
|
|
||||||
updateGlobalMenu();
|
updateGlobalMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1327,8 +1203,6 @@ void MainWindow::updateGlobalMenuHook() {
|
||||||
ForceDisabled(psClearFormat, !markdownEnabled);
|
ForceDisabled(psClearFormat, !markdownEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
|
||||||
|
|
||||||
void MainWindow::handleNativeSurfaceChanged(bool exist) {
|
void MainWindow::handleNativeSurfaceChanged(bool exist) {
|
||||||
if (exist) {
|
if (exist) {
|
||||||
SkipTaskbar(
|
SkipTaskbar(
|
||||||
|
@ -1336,16 +1210,6 @@ void MainWindow::handleNativeSurfaceChanged(bool exist) {
|
||||||
(Core::App().settings().workMode() == WorkMode::TrayOnly)
|
(Core::App().settings().workMode() == WorkMode::TrayOnly)
|
||||||
&& trayAvailable());
|
&& trayAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
|
||||||
if (_appMenuSupported && _mainMenuExporter) {
|
|
||||||
if (exist) {
|
|
||||||
RegisterAppMenu(windowHandle(), kMainMenuObjectPath.utf16());
|
|
||||||
} else {
|
|
||||||
UnregisterAppMenu(windowHandle());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
|
@ -1360,21 +1224,9 @@ MainWindow::~MainWindow() {
|
||||||
_private->dbusConnection->signal_unsubscribe(
|
_private->dbusConnection->signal_unsubscribe(
|
||||||
_sniWatcherId);
|
_sniWatcherId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_appMenuWatcherId != 0) {
|
|
||||||
_private->dbusConnection->signal_unsubscribe(
|
|
||||||
_appMenuWatcherId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete _sniTrayIcon;
|
delete _sniTrayIcon;
|
||||||
|
|
||||||
if (_appMenuSupported) {
|
|
||||||
UnregisterAppMenu(windowHandle());
|
|
||||||
}
|
|
||||||
|
|
||||||
delete _mainMenuExporter;
|
|
||||||
delete psMainMenu;
|
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/platform_main_window.h"
|
#include "platform/platform_main_window.h"
|
||||||
#include "base/unique_qptr.h"
|
#include "base/unique_qptr.h"
|
||||||
|
|
||||||
|
class QMenuBar;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PopupMenu;
|
class PopupMenu;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
class QTemporaryFile;
|
class QTemporaryFile;
|
||||||
class DBusMenuExporter;
|
|
||||||
class StatusNotifierItem;
|
class StatusNotifierItem;
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
|
@ -74,20 +75,7 @@ private:
|
||||||
bool _sniAvailable = false;
|
bool _sniAvailable = false;
|
||||||
base::unique_qptr<Ui::PopupMenu> _trayIconMenuXEmbed;
|
base::unique_qptr<Ui::PopupMenu> _trayIconMenuXEmbed;
|
||||||
|
|
||||||
void updateIconCounters();
|
QMenuBar *psMainMenu = nullptr;
|
||||||
void handleNativeSurfaceChanged(bool exist);
|
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
|
||||||
StatusNotifierItem *_sniTrayIcon = nullptr;
|
|
||||||
uint _sniRegisteredSignalId = 0;
|
|
||||||
uint _sniWatcherId = 0;
|
|
||||||
uint _appMenuWatcherId = 0;
|
|
||||||
std::unique_ptr<QTemporaryFile> _trayIconFile;
|
|
||||||
|
|
||||||
bool _appMenuSupported = false;
|
|
||||||
DBusMenuExporter *_mainMenuExporter = nullptr;
|
|
||||||
|
|
||||||
QMenu *psMainMenu = nullptr;
|
|
||||||
QAction *psLogout = nullptr;
|
QAction *psLogout = nullptr;
|
||||||
QAction *psUndo = nullptr;
|
QAction *psUndo = nullptr;
|
||||||
QAction *psRedo = nullptr;
|
QAction *psRedo = nullptr;
|
||||||
|
@ -108,19 +96,8 @@ private:
|
||||||
QAction *psMonospace = nullptr;
|
QAction *psMonospace = nullptr;
|
||||||
QAction *psClearFormat = nullptr;
|
QAction *psClearFormat = nullptr;
|
||||||
|
|
||||||
void setSNITrayIcon(int counter, bool muted);
|
void updateIconCounters();
|
||||||
void attachToSNITrayIcon();
|
void handleNativeSurfaceChanged(bool exist);
|
||||||
void handleSNIHostRegistered();
|
|
||||||
|
|
||||||
void handleSNIOwnerChanged(
|
|
||||||
const QString &service,
|
|
||||||
const QString &oldOwner,
|
|
||||||
const QString &newOwner);
|
|
||||||
|
|
||||||
void handleAppMenuOwnerChanged(
|
|
||||||
const QString &service,
|
|
||||||
const QString &oldOwner,
|
|
||||||
const QString &newOwner);
|
|
||||||
|
|
||||||
void psLinuxUndo();
|
void psLinuxUndo();
|
||||||
void psLinuxRedo();
|
void psLinuxRedo();
|
||||||
|
@ -136,6 +113,21 @@ private:
|
||||||
void psLinuxStrikeOut();
|
void psLinuxStrikeOut();
|
||||||
void psLinuxMonospace();
|
void psLinuxMonospace();
|
||||||
void psLinuxClearFormat();
|
void psLinuxClearFormat();
|
||||||
|
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
StatusNotifierItem *_sniTrayIcon = nullptr;
|
||||||
|
uint _sniRegisteredSignalId = 0;
|
||||||
|
uint _sniWatcherId = 0;
|
||||||
|
std::unique_ptr<QTemporaryFile> _trayIconFile;
|
||||||
|
|
||||||
|
void setSNITrayIcon(int counter, bool muted);
|
||||||
|
void attachToSNITrayIcon();
|
||||||
|
void handleSNIHostRegistered();
|
||||||
|
|
||||||
|
void handleSNIOwnerChanged(
|
||||||
|
const QString &service,
|
||||||
|
const QString &oldOwner,
|
||||||
|
const QString &newOwner);
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue