mirror of https://github.com/procxx/kepka.git
Allow to disable 'register custom scheme' functions using a macro.
Adding "DEFINES += TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME" to Telegram.pro would disable these functions. This can be useful when the application is distributed using an installer or a package manager that can apply these settings system-globaly. Signed-off-by: Eduardo Sánchez Muñoz <eduardosanchezmunoz@gmail.com> (github: eduardosm)
This commit is contained in:
parent
42d297f192
commit
d955b29585
|
@ -1165,6 +1165,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
void psRegisterCustomScheme() {
|
void psRegisterCustomScheme() {
|
||||||
|
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||||
QString home(_psHomeDir());
|
QString home(_psHomeDir());
|
||||||
if (home.isEmpty()) return;
|
if (home.isEmpty()) return;
|
||||||
|
|
||||||
|
@ -1249,6 +1250,7 @@ void psRegisterCustomScheme() {
|
||||||
LOG(("App Error: Could not open '%1' for write").arg(file));
|
LOG(("App Error: Could not open '%1' for write").arg(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void psNewVersion() {
|
void psNewVersion() {
|
||||||
|
|
|
@ -932,8 +932,10 @@ void objc_finish() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void objc_registerCustomScheme() {
|
void objc_registerCustomScheme() {
|
||||||
|
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||||
OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]);
|
OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]);
|
||||||
DEBUG_LOG(("App Info: set default handler for 'tg' scheme result: %1").arg(result));
|
DEBUG_LOG(("App Info: set default handler for 'tg' scheme result: %1").arg(result));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL _execUpdater(BOOL update = YES) {
|
BOOL _execUpdater(BOOL update = YES) {
|
||||||
|
|
|
@ -2211,6 +2211,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterCustomScheme() {
|
void RegisterCustomScheme() {
|
||||||
|
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||||
DEBUG_LOG(("App Info: Checking custom scheme 'tg'.."));
|
DEBUG_LOG(("App Info: Checking custom scheme 'tg'.."));
|
||||||
|
|
||||||
HKEY rkey;
|
HKEY rkey;
|
||||||
|
@ -2227,6 +2228,7 @@ void RegisterCustomScheme() {
|
||||||
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
|
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
|
||||||
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
|
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
|
||||||
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void psNewVersion() {
|
void psNewVersion() {
|
||||||
|
|
Loading…
Reference in New Issue