Initial revision


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncconfig/Legacy.h b/vncconfig/Legacy.h
new file mode 100644
index 0000000..e66dc56
--- /dev/null
+++ b/vncconfig/Legacy.h
@@ -0,0 +1,86 @@
+/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
+ *    
+ * This 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 software 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 software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ */
+
+#ifndef WINVNCCONF_LEGACY
+#define WINVNCCONF_LEGACY
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <lmcons.h>
+
+#include <vncconfig/resource.h>
+#include <rfb_win32/Registry.h>
+#include <rfb_win32/Dialog.h>
+#include <rfb_win32/Win32Util.h>
+#include <rfb/ServerCore.h>
+
+namespace rfb {
+
+  namespace win32 {
+
+    class LegacyPage : public PropSheetPage {
+    public:
+      LegacyPage(const RegKey& rk, bool userSettings_)
+        : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_LEGACY)), regKey(rk), userSettings(userSettings_) {}
+      void initDialog() {
+        setItemChecked(IDC_PROTOCOL_3_3, rfb::Server::protocol3_3);
+      }
+      bool onCommand(int id, int cmd) {
+        switch (id) {
+        case IDC_LEGACY_IMPORT:
+          {
+            DWORD result = MsgBox(0,
+              _T("Importing your legacy VNC 3.3 settings will overwrite your existing settings.\n")
+              _T("Are you sure you wish to continue?"),
+              MB_ICONWARNING | MB_YESNO);
+            if (result == IDYES) {
+              LoadPrefs();
+              MsgBox(0, _T("Imported VNC 3.3 settings successfully."),
+                     MB_ICONINFORMATION | MB_OK);
+
+              // Sleep to allow RegConfig thread to reload settings
+              Sleep(1000);
+              propSheet->reInitPages();
+            }
+          }
+          return true;
+        case IDC_PROTOCOL_3_3:
+          setChanged(isItemChecked(IDC_PROTOCOL_3_3) != rfb::Server::protocol3_3);
+          return false;
+        };
+        return false;
+      }
+      bool onOk() {
+        regKey.setBool(_T("Protocol3.3"), isItemChecked(IDC_PROTOCOL_3_3));
+        return true;
+      }
+
+      void LoadPrefs();
+      void LoadUserPrefs(const RegKey& key);
+
+    protected:
+      bool allowProperties;
+      RegKey regKey;
+      bool userSettings;
+    };
+
+  };
+
+};
+
+#endif
\ No newline at end of file