mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 17:51:41 -05:00
Use QuietHours registry key only in latest Windows
Sometimes the windows quiet hours registry key gets set even in Windows 7 (or older) and we disable notifications though it has nothing to do with real user settings. Check for 8.1 at least.
This commit is contained in:
parent
746d58e453
commit
4232fa2f6e
1 changed files with 6 additions and 1 deletions
|
@ -546,6 +546,11 @@ bool QuietHoursEnabled = false;
|
|||
DWORD QuietHoursValue = 0;
|
||||
|
||||
void queryQuietHours() {
|
||||
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8_1) {
|
||||
// No system quiet hours in Windows prior to Windows 8.1
|
||||
return;
|
||||
}
|
||||
|
||||
LPTSTR lpKeyName = L"Software\\Microsoft\\Windows\\CurrentVersion\\Notifications\\Settings";
|
||||
LPTSTR lpValueName = L"NOC_GLOBAL_SETTING_TOASTS_ENABLED";
|
||||
HKEY key;
|
||||
|
@ -558,7 +563,7 @@ void queryQuietHours() {
|
|||
result = RegQueryValueEx(key, lpValueName, 0, &type, (LPBYTE)&value, &size);
|
||||
RegCloseKey(key);
|
||||
|
||||
auto quietHoursEnabled = (result == ERROR_SUCCESS);
|
||||
auto quietHoursEnabled = (result == ERROR_SUCCESS) && (value == 0);
|
||||
if (QuietHoursEnabled != quietHoursEnabled) {
|
||||
QuietHoursEnabled = quietHoursEnabled;
|
||||
QuietHoursValue = value;
|
||||
|
|
Loading…
Add table
Reference in a new issue