Changeset View
Changeset View
Standalone View
Standalone View
daemon/kdeconnectd.cpp
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 79 | { | |||
---|---|---|---|---|---|
85 | notification->sendEvent(); | 85 | notification->sendEvent(); | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | 88 | | |||
89 | private: | 89 | private: | ||
90 | QNetworkAccessManager* m_nam; | 90 | QNetworkAccessManager* m_nam; | ||
91 | }; | 91 | }; | ||
92 | 92 | | |||
93 | // Copied from plasma-workspace/libkworkspace/kworkspace.cpp | ||||
94 | static void detectPlatform(int argc, char **argv) | ||||
95 | { | ||||
96 | if (qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) { | ||||
97 | return; | ||||
98 | } | ||||
99 | for (int i = 0; i < argc; i++) { | ||||
100 | if (qstrcmp(argv[i], "-platform") == 0 || | ||||
101 | qstrcmp(argv[i], "--platform") == 0 || | ||||
102 | QByteArray(argv[i]).startsWith("-platform=") || | ||||
103 | QByteArray(argv[i]).startsWith("--platform=")) { | ||||
104 | return; | ||||
105 | } | ||||
106 | } | ||||
107 | const QByteArray sessionType = qgetenv("XDG_SESSION_TYPE"); | ||||
108 | if (sessionType.isEmpty()) { | ||||
109 | return; | ||||
110 | } | ||||
111 | if (qstrcmp(sessionType, "wayland") == 0) { | ||||
112 | qputenv("QT_QPA_PLATFORM", "wayland"); | ||||
113 | } else if (qstrcmp(sessionType, "x11") == 0) { | ||||
114 | qputenv("QT_QPA_PLATFORM", "xcb"); | ||||
115 | } | ||||
116 | } | ||||
117 | | ||||
93 | int main(int argc, char* argv[]) | 118 | int main(int argc, char* argv[]) | ||
94 | { | 119 | { | ||
120 | detectPlatform(argc, argv); | ||||
121 | | ||||
95 | QApplication app(argc, argv); | 122 | QApplication app(argc, argv); | ||
96 | KAboutData aboutData( | 123 | KAboutData aboutData( | ||
97 | QStringLiteral("org.kde.kdeconnect.daemon"), | 124 | QStringLiteral("org.kde.kdeconnect.daemon"), | ||
98 | i18n("KDE Connect Daemon"), | 125 | i18n("KDE Connect Daemon"), | ||
99 | QStringLiteral(KDECONNECT_VERSION_STRING), | 126 | QStringLiteral(KDECONNECT_VERSION_STRING), | ||
100 | i18n("KDE Connect Daemon"), | 127 | i18n("KDE Connect Daemon"), | ||
101 | KAboutLicense::GPL | 128 | KAboutLicense::GPL | ||
102 | ); | 129 | ); | ||
Show All 34 Lines |