mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-05 09:05:14 +00:00
Option to set API ID and hash from start parameter
This commit is contained in:
@@ -458,6 +458,15 @@ void RegisterCustomScheme(bool force) {
|
||||
|
||||
HKEY rkey;
|
||||
QString exe = QDir::toNativeSeparators(cExeDir() + cExeName());
|
||||
QString possibleParams;
|
||||
|
||||
if (!cUseEnvApi()) {
|
||||
possibleParams += " -no-env-api";
|
||||
}
|
||||
if (cApiFromStartParams()) {
|
||||
possibleParams += " -api-id \"" + QString::number(cApiId()) + "\"";
|
||||
possibleParams += " -api-hash \"" + cApiHash() + "\"";
|
||||
}
|
||||
|
||||
// Legacy URI scheme registration
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tg", &rkey)) return;
|
||||
@@ -470,7 +479,7 @@ void RegisterCustomScheme(bool force) {
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell", &rkey)) return;
|
||||
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;
|
||||
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\"") + possibleParams + qsl(" -- \"%1\""))) return;
|
||||
|
||||
// URI scheme registration as Default Program - Windows Vista and above
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg", &rkey)) return;
|
||||
@@ -480,7 +489,7 @@ void RegisterCustomScheme(bool force) {
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg\\shell", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg\\shell\\open", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.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("\"") + possibleParams + qsl(" -- \"%1\""))) return;
|
||||
|
||||
if (!_psOpenRegKey(L"Software\\KotatogramDesktop", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\KotatogramDesktop\\Capabilities", &rkey)) return;
|
||||
|
Reference in New Issue
Block a user