blob: 02059a643c1a5668e84bfdbabf94d5db4fc411ab [file] [log] [blame]
Constantin Kaplinsky7f8d7742006-05-11 05:29:14 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 *
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00003 * 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
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000022#include <windows.h>
23#include <lmcons.h>
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000024#include <vncconfig/resource.h>
25#include <rfb_win32/Registry.h>
26#include <rfb_win32/Dialog.h>
Constantin Kaplinsky7f8d7742006-05-11 05:29:14 +000027#include <rfb_win32/MsgBox.h>
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000028#include <rfb/ServerCore.h>
Constantin Kaplinsky7f8d7742006-05-11 05:29:14 +000029#include <rfb/secTypes.h>
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000030
31namespace rfb {
32
33 namespace win32 {
34
35 class LegacyPage : public PropSheetPage {
36 public:
37 LegacyPage(const RegKey& rk, bool userSettings_)
38 : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_LEGACY)), regKey(rk), userSettings(userSettings_) {}
39 void initDialog() {
40 setItemChecked(IDC_PROTOCOL_3_3, rfb::Server::protocol3_3);
41 }
42 bool onCommand(int id, int cmd) {
43 switch (id) {
44 case IDC_LEGACY_IMPORT:
45 {
46 DWORD result = MsgBox(0,
47 _T("Importing your legacy VNC 3.3 settings will overwrite your existing settings.\n")
48 _T("Are you sure you wish to continue?"),
49 MB_ICONWARNING | MB_YESNO);
50 if (result == IDYES) {
51 LoadPrefs();
52 MsgBox(0, _T("Imported VNC 3.3 settings successfully."),
53 MB_ICONINFORMATION | MB_OK);
54
55 // Sleep to allow RegConfig thread to reload settings
56 Sleep(1000);
57 propSheet->reInitPages();
58 }
59 }
60 return true;
61 case IDC_PROTOCOL_3_3:
62 setChanged(isItemChecked(IDC_PROTOCOL_3_3) != rfb::Server::protocol3_3);
63 return false;
64 };
65 return false;
66 }
67 bool onOk() {
68 regKey.setBool(_T("Protocol3.3"), isItemChecked(IDC_PROTOCOL_3_3));
69 return true;
70 }
71
72 void LoadPrefs();
73 void LoadUserPrefs(const RegKey& key);
74
75 protected:
76 bool allowProperties;
77 RegKey regKey;
78 bool userSettings;
79 };
80
81 };
82
83};
84
Constantin Kaplinsky7f8d7742006-05-11 05:29:14 +000085#endif