2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Use RegisterUrlScheme from lib_base

This commit is contained in:
Ilya Fedin
2021-07-18 07:25:01 +04:00
committed by John Preston
parent 9b1d967967
commit 49fed41dfa
7 changed files with 18 additions and 191 deletions

View File

@@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/ui_integration.h"
#include "chat_helpers/emoji_keywords.h"
#include "chat_helpers/stickers_emoji_image_loader.h"
#include "base/platform/base_platform_url_scheme.h"
#include "base/platform/base_platform_last_input.h"
#include "base/platform/base_platform_info.h"
#include "platform/platform_specific.h"
@@ -197,6 +198,7 @@ void Application::run() {
ValidateScale();
if (Local::oldSettingsVersion() < AppVersion) {
RegisterUrlScheme();
psNewVersion();
}
@@ -1130,6 +1132,19 @@ void Application::startShortcuts() {
}, _lifetime);
}
void Application::RegisterUrlScheme() {
base::Platform::RegisterUrlScheme(base::Platform::UrlSchemeDescriptor{
.executable = cExeDir() + cExeName(),
.arguments = qsl("-workdir \"%1\"").arg(cWorkingDir()),
.protocol = qsl("tg"),
.protocolName = qsl("Telegram Link"),
.shortAppName = qsl("tdesktop"),
.longAppName = QCoreApplication::applicationName(),
.displayAppName = AppName.utf16(),
.displayAppDescription = AppName.utf16(),
});
}
bool IsAppLaunched() {
return (Application::Instance != nullptr);
}

View File

@@ -277,6 +277,8 @@ public:
void setScreenIsLocked(bool locked);
bool screenIsLocked() const;
static void RegisterUrlScheme();
protected:
bool eventFilter(QObject *object, QEvent *event) override;