mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-10 08:51:12 +00:00
Windows URI association fix (#2957)
Signed-off-by: Fela Ameghino <fela.ameghino@mahiz.it> (github: frayxrulez)
This commit is contained in:
parent
be87118778
commit
e569b8c5f9
@ -813,6 +813,7 @@ void RegisterCustomScheme() {
|
||||
HKEY rkey;
|
||||
QString exe = QDir::toNativeSeparators(cExeDir() + cExeName());
|
||||
|
||||
// Legacy URI scheme registration
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tg", &rkey)) return;
|
||||
if (!_psSetKeyValue(rkey, L"URL Protocol", QString())) return;
|
||||
if (!_psSetKeyValue(rkey, 0, qsl("URL:Telegram Link"))) return;
|
||||
@ -824,6 +825,26 @@ void RegisterCustomScheme() {
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
|
||||
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
||||
|
||||
// URI scheme registration as Default Program - Windows Vista and above
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\DefaultIcon", &rkey)) return;
|
||||
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl(",1\""))) return;
|
||||
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell\\open", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell\\open\\command", &rkey)) return;
|
||||
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
||||
|
||||
if (!_psOpenRegKey(L"Software\\TelegramDesktop", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities", &rkey)) return;
|
||||
if (!_psSetKeyValue(rkey, L"ApplicationName", qls("Telegram Desktop"))) return;
|
||||
if (!_psSetKeyValue(rkey, L"ApplicationDescription", qls("Telegram Desktop"))) return;
|
||||
if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities\\UrlAssociations", &rkey)) return;
|
||||
if (!_psSetKeyValue(rkey, L"tg", qls("tdesktop.tg"))) return;
|
||||
|
||||
if (!_psOpenRegKey(L"Software\\RegisteredApplications", &rkey)) return;
|
||||
if (!_psSetKeyValue(key, L"Telegram Desktop", qls("SOFTWARE\\TelegramDesktop\\Capabilities"))) return;
|
||||
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user