mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
@@ -560,6 +560,41 @@ bool AutostartSupported() {
|
||||
return !InSnap();
|
||||
}
|
||||
|
||||
void AutostartToggle(bool enabled, Fn<void(bool)> done) {
|
||||
const auto guard = gsl::finally([&] {
|
||||
done(enabled);
|
||||
});
|
||||
|
||||
#ifdef __HAIKU__
|
||||
|
||||
HaikuAutostart(enabled);
|
||||
|
||||
#else // __HAIKU__
|
||||
|
||||
const auto silent = !done;
|
||||
if (InFlatpak()) {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
PortalAutostart(enabled, silent);
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
} else {
|
||||
const auto autostart = QStandardPaths::writableLocation(
|
||||
QStandardPaths::GenericConfigLocation)
|
||||
+ qsl("/autostart/");
|
||||
|
||||
if (enabled) {
|
||||
GenerateDesktopFile(autostart, qsl("-autostart"), silent);
|
||||
} else {
|
||||
QFile::remove(autostart + QGuiApplication::desktopFileName());
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __HAIKU__
|
||||
}
|
||||
|
||||
bool AutostartSkip() {
|
||||
return !cAutoStart();
|
||||
}
|
||||
|
||||
bool TrayIconSupported() {
|
||||
return App::wnd()
|
||||
? App::wnd()->trayAvailable()
|
||||
@@ -637,7 +672,7 @@ QString psAppDataPath() {
|
||||
|
||||
void psDoCleanup() {
|
||||
try {
|
||||
psAutoStart(false, true);
|
||||
Platform::AutostartToggle(false);
|
||||
psSendToMenu(false, true);
|
||||
} catch (...) {
|
||||
}
|
||||
@@ -837,29 +872,6 @@ void psNewVersion() {
|
||||
#endif // __HAIKU__
|
||||
}
|
||||
|
||||
void psAutoStart(bool start, bool silent) {
|
||||
#ifdef __HAIKU__
|
||||
HaikuAutostart(start);
|
||||
return;
|
||||
#endif // __HAIKU__
|
||||
|
||||
if (InFlatpak()) {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
PortalAutostart(start, silent);
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
} else {
|
||||
const auto autostart = QStandardPaths::writableLocation(
|
||||
QStandardPaths::GenericConfigLocation)
|
||||
+ qsl("/autostart/");
|
||||
|
||||
if (start) {
|
||||
GenerateDesktopFile(autostart, qsl("-autostart"), silent);
|
||||
} else {
|
||||
QFile::remove(autostart + QGuiApplication::desktopFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void psSendToMenu(bool send, bool silent) {
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,9 @@ inline void IgnoreApplicationActivationRightNow() {
|
||||
inline void WriteCrashDumpDetails() {
|
||||
}
|
||||
|
||||
inline void AutostartRequestStateFromSystem(Fn<void(bool)> callback) {
|
||||
}
|
||||
|
||||
} // namespace Platform
|
||||
|
||||
inline void psCheckLocalSocket(const QString &serverName) {
|
||||
@@ -40,7 +43,6 @@ inline void psCheckLocalSocket(const QString &serverName) {
|
||||
|
||||
void psActivateProcess(uint64 pid = 0);
|
||||
QString psAppDataPath();
|
||||
void psAutoStart(bool start, bool silent = false);
|
||||
void psSendToMenu(bool send, bool silent = false);
|
||||
|
||||
int psCleanup();
|
||||
|
Reference in New Issue
Block a user