blob: e66dc56b5890311b0414390f6617fc4d3ab0ef84 [file] [log] [blame]
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00001/* Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19#ifndef WINVNCCONF_LEGACY
20#define WINVNCCONF_LEGACY
21
22#define WIN32_LEAN_AND_MEAN
23#include <windows.h>
24#include <lmcons.h>
25
26#include <vncconfig/resource.h>
27#include <rfb_win32/Registry.h>
28#include <rfb_win32/Dialog.h>
29#include <rfb_win32/Win32Util.h>
30#include <rfb/ServerCore.h>
31
32namespace rfb {
33
34 namespace win32 {
35
36 class LegacyPage : public PropSheetPage {
37 public:
38 LegacyPage(const RegKey& rk, bool userSettings_)
39 : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_LEGACY)), regKey(rk), userSettings(userSettings_) {}
40 void initDialog() {
41 setItemChecked(IDC_PROTOCOL_3_3, rfb::Server::protocol3_3);
42 }
43 bool onCommand(int id, int cmd) {
44 switch (id) {
45 case IDC_LEGACY_IMPORT:
46 {
47 DWORD result = MsgBox(0,
48 _T("Importing your legacy VNC 3.3 settings will overwrite your existing settings.\n")
49 _T("Are you sure you wish to continue?"),
50 MB_ICONWARNING | MB_YESNO);
51 if (result == IDYES) {
52 LoadPrefs();
53 MsgBox(0, _T("Imported VNC 3.3 settings successfully."),
54 MB_ICONINFORMATION | MB_OK);
55
56 // Sleep to allow RegConfig thread to reload settings
57 Sleep(1000);
58 propSheet->reInitPages();
59 }
60 }
61 return true;
62 case IDC_PROTOCOL_3_3:
63 setChanged(isItemChecked(IDC_PROTOCOL_3_3) != rfb::Server::protocol3_3);
64 return false;
65 };
66 return false;
67 }
68 bool onOk() {
69 regKey.setBool(_T("Protocol3.3"), isItemChecked(IDC_PROTOCOL_3_3));
70 return true;
71 }
72
73 void LoadPrefs();
74 void LoadUserPrefs(const RegKey& key);
75
76 protected:
77 bool allowProperties;
78 RegKey regKey;
79 bool userSettings;
80 };
81
82 };
83
84};
85
86#endif