FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_SERVERLIST, 65, 22, 117, 136, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- CONTROL "Automatically synchronize with an Internet time server", IDC_AUTODAYLIGHT,
- "Button", BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,11,7,241,10
+ CONTROL "Automatically synchronize with an Internet time server", IDC_AUTOSYNC,
+ "Button", BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP, 11 ,7, 241, 10
LTEXT "Server:", -1, 34, 22, 28, 13
PUSHBUTTON "Update Now", IDC_UPDATEBUTTON, 187, 22, 49, 14
- LTEXT "", IDC_SUCSYNC, 16, 54, 214, 23
+ LTEXT "", IDC_SUCSYNC, 12, 54, 214, 23
LTEXT "", IDC_NEXTSYNC, 12, 96, 137, 12
LTEXT "Synchronazation can only occur when your computer is connected to the internet.", -1, 12, 114, 225, 25
END
IDS_TIMEZONEUNKNOWN "Unknown"
IDS_INETTIMESUCSYNC "The time has been successfully synchronized with %s on % at %s"
IDS_INETTIMENEXTSYNC "Next synchronization: %s at %s"
+ IDS_INETTIMESYNCING "Please wait while ReactOS synchronizes the time with %s"
+ IDS_INETTIMEERROR "An error occured while ReactOS was synchronizing with %s"
END
#define IDC_CPLICON 1
-#define IDD_DATETIMEPAGE 100
-#define IDC_DATEPICKER 101
-#define IDC_MONTHCALENDAR 102
-#define IDC_TIMEZONE 106
-#define IDC_TIMEPICKER 107
-
-#define IDD_TIMEZONEPAGE 110
-#define IDC_TIMEZONELIST 111
-#define IDC_AUTODAYLIGHT 113
-
-#define IDD_INETTIMEPAGE 120
-#define IDC_SERVERLIST 121
-#define IDC_UPDATEBUTTON 122
-#define IDC_SUCSYNC 126
-#define IDC_NEXTSYNC 127
-
-#define IDS_CPLNAME 1001
-#define IDS_CPLDESCRIPTION 1002
-#define IDS_TIMEZONETEXT 1003
-#define IDS_TIMEZONEINVALID 1004
-#define IDS_TIMEZONEUNKNOWN 1005
-#define IDS_INETTIMESUCSYNC 1006
-#define IDS_INETTIMENEXTSYNC 1007
+#define IDD_DATETIMEPAGE 100
+#define IDC_DATEPICKER 101
+#define IDC_MONTHCALENDAR 102
+#define IDC_TIMEZONE 106
+#define IDC_TIMEPICKER 107
+
+#define IDD_TIMEZONEPAGE 110
+#define IDC_TIMEZONELIST 111
+#define IDC_AUTODAYLIGHT 113
+
+#define IDD_INETTIMEPAGE 120
+#define IDC_SERVERLIST 121
+#define IDC_UPDATEBUTTON 122
+#define IDC_AUTOSYNC 123
+#define IDC_SUCSYNC 126
+#define IDC_NEXTSYNC 127
+
+#define IDS_CPLNAME 1001
+#define IDS_CPLDESCRIPTION 1002
+#define IDS_TIMEZONETEXT 1003
+#define IDS_TIMEZONEINVALID 1004
+#define IDS_TIMEZONEUNKNOWN 1005
+#define IDS_INETTIMESUCSYNC 1006
+#define IDS_INETTIMENEXTSYNC 1007
+#define IDS_INETTIMESYNCING 1008
+#define IDS_INETTIMEERROR 1009
#endif /* __CPL_RESOURCE_H */
-
-/* EOF */
/*
- * ReactOS
- * Copyright (C) 2004 ReactOS Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-/* $Id$
- *
- * PROJECT: ReactOS Timedate Control Panel
- * FILE: lib/cpl/timedate/timedate.c
- * PURPOSE: ReactOS Timedate Control Panel
- * PROGRAMMER: Eric Kohl
+ * PROJECT: ReactOS Timedate Control Panel
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: lib/cpl/timedate/timedate.c
+ * PURPOSE: ReactOS Timedate Control Panel
+ * COPYRIGHT: Copyright 2004-2005 Eric Kohl <"programmer@email.com">
+ * Copyright 2006 Ged Murphy <gedmurphy@ntlworld.com>
+ *
*/
#include <windows.h>
#include "resource.h"
#include "timedate.h"
+#define SERVERLISTSIZE 6
typedef struct _TZ_INFO
{
ULONG Index; /* 'Index ' */
} TIMEZONE_ENTRY, *PTIMEZONE_ENTRY;
+typedef struct _SERVERS
+{
+ CHAR *Address;
+ WCHAR *Name;
+} SERVERS;
+
#define NUM_APPLETS (1)
HINSTANCE hApplet = 0;
+BOOL bSynced = FALSE;
PTIMEZONE_ENTRY TimeZoneListHead = NULL;
PTIMEZONE_ENTRY TimeZoneListTail = NULL;
}
+#define MAX_KEY_LENGTH 255
+#define MAX_VALUE_NAME 16383
+
+static VOID
+CreateNTPServerList(HWND hwnd)
+{
+ HWND hList;
+ WCHAR ValName[MAX_VALUE_NAME];
+ WCHAR Data[256];
+ DWORD Index = 0;
+ DWORD ValSize;
+ DWORD dwNameSize;
+ // DWORD dwValueSize;
+ LONG Ret;
+ HKEY hKey;
+
+ hList = GetDlgItem(hwnd, IDC_SERVERLIST);
+
+ Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DateTime\\Servers",
+ 0,
+ KEY_READ,
+ &hKey);
+ if (Ret != ERROR_SUCCESS)
+ return;
+
+ while (TRUE)
+ {
+ ValSize = MAX_VALUE_NAME;
+ ValName[0] = '\0';
+ Ret = RegEnumValue(hKey,
+ Index,
+ ValName,
+ &ValSize,
+ NULL,
+ NULL,
+ (LPBYTE)Data,
+ &dwNameSize);
+
+ if (Ret == ERROR_SUCCESS)
+ {
+ SendMessageW(hList, CB_ADDSTRING, 0, (LPARAM)Data);
+ Index++;
+ }
+ else if (Ret != ERROR_MORE_DATA)
+ break;
+ }
+
+ SendMessageW(hList, CB_SELECTSTRING, 0, 0);
+
+}
+
+
+
+
/* Property page dialog callback */
INT_PTR CALLBACK
InetTimePageProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_INITDIALOG:
- break;
- case WM_COMMAND:
- break;
+ HWND hCheck;
+ INT Check;
- case WM_DESTROY:
- break;
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ CreateNTPServerList(hwndDlg);
- case WM_NOTIFY:
- {
- switch (lParam)
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
{
+ case IDC_UPDATEBUTTON:
+ MessageBox(NULL, L"Boo!", NULL, 0);
+ break;
+
+ case IDC_SERVERLIST:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ /* Enable the 'Apply' button */
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ break;
+
+ case IDC_AUTOSYNC:
+ if (HIWORD(wParam) == BN_CLICKED)
+ {
+ hCheck = GetDlgItem(hwndDlg, IDC_AUTOSYNC);
+ Check = (INT)SendMessageW(hCheck, BM_GETCHECK, 0, 0);
+ bSynced = (Check) ? TRUE : FALSE;
+ /* Enable the 'Apply' button */
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+ }
+ break;
- default:
+ case WM_DESTROY:
+ break;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnm = (LPNMHDR)lParam;
+
+ switch (lpnm->code)
+ {
+ case PSN_APPLY:
+ //DebugBreak();
+
+ /* SetNTPServer(GetDlgItem(hwndDlg, IDC_SERVERLIST));
+ SetLocalTimeZone(GetDlgItem(hwndDlg, IDC_TIMEZONELIST));
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
+ */
+ return TRUE;
+
+ default:
break;
}
+ }
+ break;
+ }
- }
- break;
- }
-
- return FALSE;
+ return FALSE;
}