COMBOBOX IDC_TIMEZONELIST, 5, 4, 241, 136,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "&Uhr automatisch auf Sommer-/Winterzeit umstellen",
- IDC_AUTOADJUST, 5, 136, 241, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP
+ IDC_AUTODAYLIGHT, 5, 136, 241, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP
END
COMBOBOX IDC_TIMEZONELIST, 5, 4, 241, 136,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Automatically adjust clock for &daylight saving changes",
- IDC_AUTOADJUST, 5, 136, 241, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP
+ IDC_AUTODAYLIGHT, 5, 136, 241, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP
END
#define IDD_TIMEZONEPAGE 110
#define IDC_TIMEZONELIST 111
-#define IDC_AUTOADJUST 113
+#define IDC_AUTODAYLIGHT 113
#define IDS_CPLNAME 1001
#define IDS_CPLDESCRIPTION 2001
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: timedate.c,v 1.3 2004/11/08 10:33:08 ekohl Exp $
+/* $Id: timedate.c,v 1.4 2004/11/11 12:24:56 ekohl Exp $
*
* PROJECT: ReactOS Timedate Control Panel
* FILE: lib/cpl/timedate/timedate.c
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
+ case PSN_SETACTIVE:
+ /* FIXME: Update the time zone name */
+ return 0;
+
+ case PSN_APPLY:
+
+ /* FIXME: Set date and time */
+
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
+ return TRUE;
+
default:
break;
}
}
+static VOID
+SetLocalTimeZone(HWND hwnd)
+{
+ TIME_ZONE_INFORMATION TimeZoneInformation;
+ PTIMEZONE_ENTRY Entry;
+ DWORD dwIndex;
+ DWORD i;
+
+ dwIndex = SendMessage(hwnd,
+ CB_GETCURSEL,
+ 0,
+ 0);
+
+ i = 0;
+ Entry = TimeZoneListHead;
+ while (i < dwIndex)
+ {
+ if (Entry == NULL)
+ return;
+
+ i++;
+ Entry = Entry->Next;
+ }
+
+ wcscpy(TimeZoneInformation.StandardName,
+ Entry->StandardName);
+ wcscpy(TimeZoneInformation.DaylightName,
+ Entry->DaylightName);
+
+ TimeZoneInformation.Bias = Entry->TimezoneInfo.Bias;
+ TimeZoneInformation.StandardBias = Entry->TimezoneInfo.StandardBias;
+ TimeZoneInformation.DaylightBias = Entry->TimezoneInfo.DaylightBias;
+
+ memcpy(&TimeZoneInformation.StandardDate,
+ &Entry->TimezoneInfo.StandardDate,
+ sizeof(SYSTEMTIME));
+ memcpy(&TimeZoneInformation.DaylightDate,
+ &Entry->TimezoneInfo.DaylightDate,
+ sizeof(SYSTEMTIME));
+
+ /* Set time zone information */
+ SetTimeZoneInformation(&TimeZoneInformation);
+}
+
+
+static VOID
+GetAutoDaylightInfo(HWND hwnd)
+{
+ HKEY hKey;
+
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation",
+ 0,
+ KEY_SET_VALUE,
+ &hKey))
+ return;
+
+ if (RegQueryValueExW(hKey,
+ L"DisableAutoDaylightTimeSet",
+ NULL,
+ NULL,
+ NULL,
+ NULL))
+ {
+ SendMessage(hwnd, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
+ }
+ else
+ {
+ SendMessage(hwnd, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
+ }
+
+ RegCloseKey(hKey);
+}
+
+
+static VOID
+SetAutoDaylightInfo(HWND hwnd)
+{
+ HKEY hKey;
+ DWORD dwValue = 1;
+
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation",
+ 0,
+ KEY_SET_VALUE,
+ &hKey))
+ return;
+
+ if (SendMessage(hwnd, BM_GETCHECK, 0, 0) == BST_UNCHECKED)
+ {
+ RegSetValueExW(hKey,
+ L"DisableAutoDaylightTimeSet",
+ 0,
+ REG_DWORD,
+ (LPBYTE)&dwValue,
+ sizeof(DWORD));
+ }
+ else
+ {
+ RegDeleteKeyW(hKey,
+ L"DisableAutoDaylightTimeSet");
+ }
+
+ RegCloseKey(hKey);
+}
+
+
/* Property page dialog callback */
INT_PTR CALLBACK
TimeZonePageProc(HWND hwndDlg,
case WM_INITDIALOG:
CreateTimeZoneList();
ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_TIMEZONELIST));
+ GetAutoDaylightInfo(GetDlgItem(hwndDlg, IDC_AUTODAYLIGHT));
break;
case WM_COMMAND:
if ((LOWORD(wParam) == IDC_TIMEZONELIST && HIWORD(wParam) == CBN_SELCHANGE) ||
- (LOWORD(wParam) == IDC_AUTOADJUST && HIWORD(wParam) == BN_CLICKED))
+ (LOWORD(wParam) == IDC_AUTODAYLIGHT && HIWORD(wParam) == BN_CLICKED))
{
/* Enable the 'Apply' button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
case WM_DESTROY:
DestroyTimeZoneList();
break;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnm = (LPNMHDR)lParam;
+
+ switch (lpnm->code)
+ {
+ case PSN_APPLY:
+ SetAutoDaylightInfo(GetDlgItem(hwndDlg, IDC_AUTODAYLIGHT));
+ SetLocalTimeZone(GetDlgItem(hwndDlg, IDC_TIMEZONELIST));
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
+ return TRUE;
+
+ default:
+ break;
+ }
+
+ }
+ break;
}
return FALSE;
#define IDC_DATEPICKER 1015
#define IDC_TIMEPICKER 1016
#define IDC_TIMEZONELIST 1017
-#define IDC_DAYLIGHTSAVINGS 1018
+#define IDC_AUTODAYLIGHT 1018
#define IDD_PROCESSPAGE 1020
#define IDC_PROCESSPROGRESS 1021
COMBOBOX IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Automatically adjust clock for &daylight saving changes",
- IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
+ IDC_AUTODAYLIGHT, 53, 124, 201, 10
END
COMBOBOX IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "&Uhr automatisch auf Sommer-/Winterzeit umstellen",
- IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
+ IDC_AUTODAYLIGHT, 53, 124, 201, 10
END
COMBOBOX IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Automatically adjust clock for &daylight saving changes",
- IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
+ IDC_AUTODAYLIGHT, 53, 124, 201, 10
END
COMBOBOX IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Automatically adjust clock for &daylight saving changes",
- IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
+ IDC_AUTODAYLIGHT, 53, 124, 201, 10
END
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: wizard.c,v 1.11 2004/11/05 11:48:45 ekohl Exp $
+/* $Id: wizard.c,v 1.12 2004/11/11 12:23:43 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
CreateTimeZoneList(PSETUPDATA SetupData)
{
WCHAR szKeyName[256];
-// WCHAR szValue[256];
DWORD dwIndex;
DWORD dwNameSize;
DWORD dwValueSize;
}
-#if 0
static VOID
DestroyTimeZoneList(PSETUPDATA SetupData)
{
+ PTIMEZONE_ENTRY Entry;
+
+ while (SetupData->TimeZoneListHead != NULL)
+ {
+ Entry = SetupData->TimeZoneListHead;
+
+ SetupData->TimeZoneListHead = Entry->Next;
+ if (SetupData->TimeZoneListHead != NULL)
+ {
+ SetupData->TimeZoneListHead->Prev = NULL;
+ }
+
+ HeapFree(GetProcessHeap(), 0, Entry);
+ }
+ SetupData->TimeZoneListTail = NULL;
}
-#endif
static VOID
}
+static VOID
+SetAutoDaylightInfo(HWND hwnd)
+{
+ HKEY hKey;
+ DWORD dwValue = 1;
+
+ if (SendMessage(hwnd, BM_GETCHECK, 0, 0) == BST_UNCHECKED)
+ {
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation",
+ 0,
+ KEY_SET_VALUE,
+ &hKey))
+ return;
+
+ RegSetValueExW(hKey,
+ L"DisableAutoDaylightTimeSet",
+ 0,
+ REG_DWORD,
+ (LPBYTE)&dwValue,
+ sizeof(DWORD));
+ RegCloseKey(hKey);
+ }
+}
+
+
INT_PTR CALLBACK
DateTimePageDlgProc(HWND hwndDlg,
UINT uMsg,
CreateTimeZoneList(SetupData);
ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_TIMEZONELIST),
- SetupData);
+ SetupData);
+
+ SendDlgItemMessage(hwndDlg, IDC_AUTODAYLIGHT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
}
break;
{
GetLocalSystemTime(hwndDlg, SetupData);
SetLocalTimeZone(GetDlgItem(hwndDlg, IDC_TIMEZONELIST),
- SetupData);
+ SetupData);
+ SetAutoDaylightInfo(GetDlgItem(hwndDlg, IDC_AUTODAYLIGHT));
SetLocalTime(&SetupData->SystemTime);
}
break;
}
break;
+ case WM_DESTROY:
+ DestroyTimeZoneList(SetupData);
+ break;
+
default:
break;
}