TDESKTOP_DISABLE_DBUS_INTEGRATION -> DESKTOP_APP_DISABLE_DBUS_INTEGRATION

This commit is contained in:
Ilya Fedin 2020-08-08 16:07:13 +04:00 committed by John Preston
parent 361b99b0c9
commit 252bdd2353
7 changed files with 74 additions and 78 deletions

View file

@ -33,7 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QSize> #include <QtCore/QSize>
#include <QtGui/QWindow> #include <QtGui/QWindow>
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <QtDBus/QDBusInterface> #include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusConnection> #include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface> #include <QtDBus/QDBusConnectionInterface>
@ -42,7 +42,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtDBus/QDBusReply> #include <QtDBus/QDBusReply>
#include <QtDBus/QDBusError> #include <QtDBus/QDBusError>
#include <QtDBus/QDBusMetaType> #include <QtDBus/QDBusMetaType>
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
namespace Platform { namespace Platform {
namespace { namespace {
@ -236,7 +236,7 @@ QIcon TrayIconGen(int counter, bool muted) {
return result; return result;
} }
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
bool IsIndicatorApplication() { bool IsIndicatorApplication() {
// Hack for indicator-application, which doesn't handle icons sent across D-Bus: // Hack for indicator-application, which doesn't handle icons sent across D-Bus:
// save the icon to a temp file and set the icon name to that filename. // save the icon to a temp file and set the icon name to that filename.
@ -305,10 +305,10 @@ bool UseUnityCounter() {
return Result; return Result;
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
bool IsSNIAvailable() { bool IsSNIAvailable() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
auto message = QDBusMessage::createMethodCall( auto message = QDBusMessage::createMethodCall(
kSNIWatcherService.utf16(), kSNIWatcherService.utf16(),
qsl("/StatusNotifierWatcher"), qsl("/StatusNotifierWatcher"),
@ -328,7 +328,7 @@ bool IsSNIAvailable() {
} else if (reply.error().type() != QDBusError::ServiceUnknown) { } else if (reply.error().type() != QDBusError::ServiceUnknown) {
LOG(("SNI Error: %1").arg(reply.error().message())); LOG(("SNI Error: %1").arg(reply.error().message()));
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return false; return false;
} }
@ -342,7 +342,7 @@ quint32 djbStringHash(QString string) {
return hash; return hash;
} }
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
bool IsAppMenuSupported() { bool IsAppMenuSupported() {
const auto interface = QDBusConnection::sessionBus().interface(); const auto interface = QDBusConnection::sessionBus().interface();
@ -406,7 +406,7 @@ void ForceDisabled(QAction *action, bool disabled) {
action->setDisabled(false); action->setDisabled(false);
} }
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
} // namespace } // namespace
@ -428,7 +428,7 @@ void MainWindow::initHook() {
LOG(("System tray available: %1").arg(Logs::b(trayAvailable))); LOG(("System tray available: %1").arg(Logs::b(trayAvailable)));
Platform::SetTrayIconSupported(trayAvailable); Platform::SetTrayIconSupported(trayAvailable);
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
auto sniWatcher = new QDBusServiceWatcher( auto sniWatcher = new QDBusServiceWatcher(
kSNIWatcherService.utf16(), kSNIWatcherService.utf16(),
QDBusConnection::sessionBus(), QDBusConnection::sessionBus(),
@ -472,7 +472,7 @@ void MainWindow::initHook() {
} else { } else {
LOG(("Not using Unity launcher counter.")); LOG(("Not using Unity launcher counter."));
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
updateWaylandDecorationColors(); updateWaylandDecorationColors();
@ -483,11 +483,11 @@ void MainWindow::initHook() {
} }
bool MainWindow::hasTrayIcon() const { bool MainWindow::hasTrayIcon() const {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return trayIcon || (SNIAvailable && _sniTrayIcon); return trayIcon || (SNIAvailable && _sniTrayIcon);
#else #else
return trayIcon; return trayIcon;
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
} }
void MainWindow::psShowTrayMenu() { void MainWindow::psShowTrayMenu() {
@ -495,14 +495,14 @@ void MainWindow::psShowTrayMenu() {
} }
void MainWindow::psTrayMenuUpdated() { void MainWindow::psTrayMenuUpdated() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (_sniTrayIcon && trayIconMenu) { if (_sniTrayIcon && trayIconMenu) {
_sniTrayIcon->setContextMenu(trayIconMenu); _sniTrayIcon->setContextMenu(trayIconMenu);
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
} }
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
void MainWindow::setSNITrayIcon(int counter, bool muted) { void MainWindow::setSNITrayIcon(int counter, bool muted) {
const auto iconName = GetTrayIconName(counter, muted); const auto iconName = GetTrayIconName(counter, muted);
@ -618,14 +618,14 @@ void MainWindow::onAppMenuOwnerChanged(
UnregisterAppMenu(winId()); UnregisterAppMenu(winId());
} }
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
void MainWindow::psSetupTrayIcon() { void MainWindow::psSetupTrayIcon() {
const auto counter = Core::App().unreadBadge(); const auto counter = Core::App().unreadBadge();
const auto muted = Core::App().unreadBadgeMuted(); const auto muted = Core::App().unreadBadgeMuted();
if (SNIAvailable) { if (SNIAvailable) {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
LOG(("Using SNI tray icon.")); LOG(("Using SNI tray icon."));
if (!_sniTrayIcon) { if (!_sniTrayIcon) {
_sniTrayIcon = new StatusNotifierItem( _sniTrayIcon = new StatusNotifierItem(
@ -638,7 +638,7 @@ void MainWindow::psSetupTrayIcon() {
attachToSNITrayIcon(); attachToSNITrayIcon();
} }
updateIconCounters(); updateIconCounters();
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
} else { } else {
LOG(("Using Qt tray icon.")); LOG(("Using Qt tray icon."));
if (!trayIcon) { if (!trayIcon) {
@ -657,13 +657,13 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) {
if (!Platform::TrayIconSupported()) { if (!Platform::TrayIconSupported()) {
return; return;
} else if (mode == dbiwmWindowOnly) { } else if (mode == dbiwmWindowOnly) {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (_sniTrayIcon) { if (_sniTrayIcon) {
_sniTrayIcon->setContextMenu(0); _sniTrayIcon->setContextMenu(0);
_sniTrayIcon->deleteLater(); _sniTrayIcon->deleteLater();
} }
_sniTrayIcon = nullptr; _sniTrayIcon = nullptr;
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (trayIcon) { if (trayIcon) {
trayIcon->setContextMenu(0); trayIcon->setContextMenu(0);
@ -686,7 +686,7 @@ void MainWindow::updateIconCounters() {
updateWindowIcon(); updateWindowIcon();
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (UseUnityCounter()) { if (UseUnityCounter()) {
const auto launcherUrl = "application://" + GetLauncherFilename(); const auto launcherUrl = "application://" + GetLauncherFilename();
QVariantMap dbusUnityProperties; QVariantMap dbusUnityProperties;
@ -714,7 +714,7 @@ void MainWindow::updateIconCounters() {
if (_sniTrayIcon) { if (_sniTrayIcon) {
setSNITrayIcon(counter, muted); setSNITrayIcon(counter, muted);
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (trayIcon && IsIconRegenerationNeeded(counter, muted)) { if (trayIcon && IsIconRegenerationNeeded(counter, muted)) {
trayIcon->setIcon(TrayIconGen(counter, muted)); trayIcon->setIcon(TrayIconGen(counter, muted));
@ -732,11 +732,11 @@ void MainWindow::updateWaylandDecorationColors() {
} }
void MainWindow::LibsLoaded() { void MainWindow::LibsLoaded() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
qDBusRegisterMetaType<ToolTip>(); qDBusRegisterMetaType<ToolTip>();
qDBusRegisterMetaType<IconPixmap>(); qDBusRegisterMetaType<IconPixmap>();
qDBusRegisterMetaType<IconPixmapList>(); qDBusRegisterMetaType<IconPixmapList>();
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
} }
void MainWindow::initTrayMenuHook() { void MainWindow::initTrayMenuHook() {
@ -744,7 +744,7 @@ void MainWindow::initTrayMenuHook() {
_trayIconMenuXEmbed->deleteOnHide(false); _trayIconMenuXEmbed->deleteOnHide(false);
} }
#ifdef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifdef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
void MainWindow::createGlobalMenu() { void MainWindow::createGlobalMenu() {
} }
@ -752,7 +752,7 @@ void MainWindow::createGlobalMenu() {
void MainWindow::updateGlobalMenuHook() { void MainWindow::updateGlobalMenuHook() {
} }
#else // TDESKTOP_DISABLE_DBUS_INTEGRATION #else // DESKTOP_APP_DISABLE_DBUS_INTEGRATION
void MainWindow::createGlobalMenu() { void MainWindow::createGlobalMenu() {
psMainMenu = new QMenu(this); psMainMenu = new QMenu(this);
@ -1063,10 +1063,10 @@ void MainWindow::onVisibleChanged(bool visible) {
} }
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
MainWindow::~MainWindow() { MainWindow::~MainWindow() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
delete _sniTrayIcon; delete _sniTrayIcon;
if (AppMenuSupported) { if (AppMenuSupported) {
@ -1075,7 +1075,7 @@ MainWindow::~MainWindow() {
delete _mainMenuExporter; delete _mainMenuExporter;
delete psMainMenu; delete psMainMenu;
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
delete _trayIconMenuXEmbed; delete _trayIconMenuXEmbed;
} }

View file

@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/popup_menu.h" #include "ui/widgets/popup_menu.h"
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "statusnotifieritem.h" #include "statusnotifieritem.h"
#include <QtCore/QTemporaryFile> #include <QtCore/QTemporaryFile>
#include <QtDBus/QDBusObjectPath> #include <QtDBus/QDBusObjectPath>
@ -45,7 +45,7 @@ public:
public slots: public slots:
void psShowTrayMenu(); void psShowTrayMenu();
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
void onSNIOwnerChanged( void onSNIOwnerChanged(
const QString &service, const QString &service,
const QString &oldOwner, const QString &oldOwner,
@ -73,7 +73,7 @@ public slots:
void onVisibleChanged(bool visible); void onVisibleChanged(bool visible);
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION #ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
GtkClipboard *gtkClipboard() { GtkClipboard *gtkClipboard() {
@ -112,7 +112,7 @@ private:
void updateIconCounters(); void updateIconCounters();
void updateWaylandDecorationColors(); void updateWaylandDecorationColors();
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
StatusNotifierItem *_sniTrayIcon = nullptr; StatusNotifierItem *_sniTrayIcon = nullptr;
std::unique_ptr<QTemporaryFile> _trayIconFile = nullptr; std::unique_ptr<QTemporaryFile> _trayIconFile = nullptr;
@ -142,7 +142,7 @@ private:
void setSNITrayIcon(int counter, bool muted); void setSNITrayIcon(int counter, bool muted);
void attachToSNITrayIcon(); void attachToSNITrayIcon();
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION #ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
GtkClipboard *_gtkClipboard = nullptr; GtkClipboard *_gtkClipboard = nullptr;

View file

@ -17,18 +17,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h" #include "main/main_session.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <QtCore/QVersionNumber> #include <QtCore/QVersionNumber>
#include <QtDBus/QDBusMessage> #include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusReply> #include <QtDBus/QDBusReply>
#include <QtDBus/QDBusError> #include <QtDBus/QDBusError>
#include <QtDBus/QDBusMetaType> #include <QtDBus/QDBusMetaType>
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
namespace Platform { namespace Platform {
namespace Notifications { namespace Notifications {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
namespace { namespace {
constexpr auto kService = "org.freedesktop.Notifications"_cs; constexpr auto kService = "org.freedesktop.Notifications"_cs;
@ -446,16 +446,16 @@ const QDBusArgument &operator>>(
argument.endStructure(); argument.endStructure();
return argument; return argument;
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
bool SkipAudio() { bool SkipAudio() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (Supported() if (Supported()
&& GetCapabilities().contains(qsl("inhibitions")) && GetCapabilities().contains(qsl("inhibitions"))
&& !InhibitedNotSupported) { && !InhibitedNotSupported) {
return Inhibited(); return Inhibited();
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return false; return false;
} }
@ -469,18 +469,18 @@ bool SkipFlashBounce() {
} }
bool Supported() { bool Supported() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return NotificationsSupported; return NotificationsSupported;
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return false; return false;
} }
std::unique_ptr<Window::Notifications::Manager> Create( std::unique_ptr<Window::Notifications::Manager> Create(
Window::Notifications::System *system) { Window::Notifications::System *system) {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
GetSupported(); GetSupported();
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if ((Core::App().settings().nativeNotifications() && Supported()) if ((Core::App().settings().nativeNotifications() && Supported())
|| Platform::IsWayland()) { || Platform::IsWayland()) {
@ -490,7 +490,7 @@ std::unique_ptr<Window::Notifications::Manager> Create(
return nullptr; return nullptr;
} }
#ifdef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifdef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
class Manager::Private { class Manager::Private {
public: public:
using Type = Window::Notifications::CachedUserpics::Type; using Type = Window::Notifications::CachedUserpics::Type;
@ -510,7 +510,7 @@ public:
void clearFromSession(not_null<Main::Session*> session) {} void clearFromSession(not_null<Main::Session*> session) {}
void clearNotification(NotificationId id) {} void clearNotification(NotificationId id) {}
}; };
#else // TDESKTOP_DISABLE_DBUS_INTEGRATION #else // DESKTOP_APP_DISABLE_DBUS_INTEGRATION
class Manager::Private { class Manager::Private {
public: public:
using Type = Window::Notifications::CachedUserpics::Type; using Type = Window::Notifications::CachedUserpics::Type;
@ -699,7 +699,7 @@ void Manager::Private::clearNotification(NotificationId id) {
Manager::Private::~Private() { Manager::Private::~Private() {
clearAll(); clearAll();
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Manager::Manager(not_null<Window::Notifications::System*> system) Manager::Manager(not_null<Window::Notifications::System*> system)
: NativeManager(system) : NativeManager(system)

View file

@ -10,15 +10,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_notifications_manager.h" #include "platform/platform_notifications_manager.h"
#include "base/weak_ptr.h" #include "base/weak_ptr.h"
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <QtDBus/QDBusConnection> #include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusArgument> #include <QtDBus/QDBusArgument>
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
namespace Platform { namespace Platform {
namespace Notifications { namespace Notifications {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
class NotificationData : public QObject { class NotificationData : public QObject {
Q_OBJECT Q_OBJECT
@ -78,7 +78,7 @@ QDBusArgument &operator<<(
const QDBusArgument &operator>>( const QDBusArgument &operator>>(
const QDBusArgument &argument, const QDBusArgument &argument,
NotificationData::ImageData &imageData); NotificationData::ImageData &imageData);
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
class Manager class Manager
: public Window::Notifications::NativeManager : public Window::Notifications::NativeManager
@ -111,6 +111,6 @@ private:
} // namespace Notifications } // namespace Notifications
} // namespace Platform } // namespace Platform
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Q_DECLARE_METATYPE(Platform::Notifications::NotificationData::ImageData) Q_DECLARE_METATYPE(Platform::Notifications::NotificationData::ImageData)
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION

View file

@ -31,13 +31,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <private/qwaylandwindow_p.h> #include <private/qwaylandwindow_p.h>
#include <private/qwaylandshellsurface_p.h> #include <private/qwaylandshellsurface_p.h>
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <QtDBus/QDBusInterface> #include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusConnection> #include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusMessage> #include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusReply> #include <QtDBus/QDBusReply>
#include <QtDBus/QDBusError> #include <QtDBus/QDBusError>
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/screensaver.h> #include <xcb/screensaver.h>
@ -74,7 +74,7 @@ QStringList PlatformThemes;
bool IsTrayIconSupported = true; bool IsTrayIconSupported = true;
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
void PortalAutostart(bool autostart, bool silent = false) { void PortalAutostart(bool autostart, bool silent = false) {
QVariantMap options; QVariantMap options;
options["reason"] = tr::lng_settings_auto_start(tr::now); options["reason"] = tr::lng_settings_auto_start(tr::now);
@ -135,7 +135,7 @@ uint FileChooserPortalVersion() {
return Result; return Result;
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
QString FlatpakID() { QString FlatpakID() {
static const auto Result = [] { static const auto Result = [] {
@ -356,7 +356,7 @@ std::optional<crl::time> XCBLastUserInputTime() {
return std::nullopt; return std::nullopt;
} }
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
std::optional<crl::time> FreedesktopDBusLastUserInputTime() { std::optional<crl::time> FreedesktopDBusLastUserInputTime() {
static auto NotSupported = false; static auto NotSupported = false;
@ -443,7 +443,7 @@ std::optional<crl::time> MutterDBusLastUserInputTime() {
return std::nullopt; return std::nullopt;
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
uint XCBMoveResizeFromEdges(Qt::Edges edges) { uint XCBMoveResizeFromEdges(Qt::Edges edges) {
if (edges == (Qt::TopEdge | Qt::LeftEdge)) if (edges == (Qt::TopEdge | Qt::LeftEdge))
@ -667,13 +667,13 @@ bool IsQtPluginsBundled() {
} }
bool IsXDGDesktopPortalPresent() { bool IsXDGDesktopPortalPresent() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
static const auto Result = QDBusInterface( static const auto Result = QDBusInterface(
kXDGDesktopPortalService.utf16(), kXDGDesktopPortalService.utf16(),
kXDGDesktopPortalObjectPath.utf16()).isValid(); kXDGDesktopPortalObjectPath.utf16()).isValid();
return Result; return Result;
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return false; return false;
} }
@ -693,11 +693,11 @@ bool UseXDGDesktopPortal() {
} }
bool CanOpenDirectoryWithPortal() { bool CanOpenDirectoryWithPortal() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED) && !defined TDESKTOP_DISABLE_DBUS_INTEGRATION #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED) && !defined DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return FileChooserPortalVersion() >= 3; return FileChooserPortalVersion() >= 3;
#else // (Qt >= 5.15 || DESKTOP_APP_QT_PATCHED) && !TDESKTOP_DISABLE_DBUS_INTEGRATION #else // (Qt >= 5.15 || DESKTOP_APP_QT_PATCHED) && !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return false; return false;
#endif // (Qt < 5.15 && !DESKTOP_APP_QT_PATCHED) || TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // (Qt < 5.15 && !DESKTOP_APP_QT_PATCHED) || DESKTOP_APP_DISABLE_DBUS_INTEGRATION
} }
QString CurrentExecutablePath(int argc, char *argv[]) { QString CurrentExecutablePath(int argc, char *argv[]) {
@ -873,7 +873,7 @@ std::optional<crl::time> LastUserInputTime() {
return XCBLastUserInputTime(); return XCBLastUserInputTime();
} }
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
const auto freedesktopResult = FreedesktopDBusLastUserInputTime(); const auto freedesktopResult = FreedesktopDBusLastUserInputTime();
if (freedesktopResult.has_value()) { if (freedesktopResult.has_value()) {
return freedesktopResult; return freedesktopResult;
@ -883,7 +883,7 @@ std::optional<crl::time> LastUserInputTime() {
if (mutterResult.has_value()) { if (mutterResult.has_value()) {
return mutterResult; return mutterResult;
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
return std::nullopt; return std::nullopt;
} }
@ -1293,9 +1293,9 @@ void psAutoStart(bool start, bool silent) {
return; return;
if (InFlatpak()) { if (InFlatpak()) {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
PortalAutostart(start, silent); PortalAutostart(start, silent);
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
} else { } else {
const auto autostart = [&] { const auto autostart = [&] {
if (InSnap()) { if (InSnap()) {

View file

@ -38,12 +38,12 @@ Q_IMPORT_PLUGIN(QGenericEnginePlugin)
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QSvgPlugin) Q_IMPORT_PLUGIN(QSvgPlugin)
Q_IMPORT_PLUGIN(QSvgIconPlugin) Q_IMPORT_PLUGIN(QSvgIconPlugin)
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Q_IMPORT_PLUGIN(QConnmanEnginePlugin) Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin) Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin)
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX
#endif // !DESKTOP_APP_USE_PACKAGED #endif // !DESKTOP_APP_USE_PACKAGED
@ -51,11 +51,11 @@ Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin)
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY #if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY
Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin) Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin)
Q_IMPORT_PLUGIN(NimfInputContextPlugin) Q_IMPORT_PLUGIN(NimfInputContextPlugin)
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY #endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES #if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
@ -65,8 +65,8 @@ Q_IMPORT_PLUGIN(Qt5CTStylePlugin)
// conflicts with Qt static link // conflicts with Qt static link
#ifdef DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES #ifdef DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Q_IMPORT_PLUGIN(LXQtPlatformThemePlugin) Q_IMPORT_PLUGIN(LXQtPlatformThemePlugin)
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#endif // DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES #endif // DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
#endif // Q_OS_UNIX && !Q_OS_MAC #endif // Q_OS_UNIX && !Q_OS_MAC

View file

@ -85,10 +85,6 @@ if (TDESKTOP_DISABLE_GTK_INTEGRATION)
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_GTK_INTEGRATION) target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_GTK_INTEGRATION)
endif() endif()
if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_DBUS_INTEGRATION)
endif()
if (NOT TDESKTOP_LAUNCHER_BASENAME) if (NOT TDESKTOP_LAUNCHER_BASENAME)
set(TDESKTOP_LAUNCHER_BASENAME "telegramdesktop") set(TDESKTOP_LAUNCHER_BASENAME "telegramdesktop")
endif() endif()