You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Legacy.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Copyright (C) 2002-2005 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. #ifndef WINVNCCONF_LEGACY
  19. #define WINVNCCONF_LEGACY
  20. #include <windows.h>
  21. #include <lmcons.h>
  22. #include <vncconfig/resource.h>
  23. #include <rfb_win32/Registry.h>
  24. #include <rfb_win32/Dialog.h>
  25. #include <rfb_win32/MsgBox.h>
  26. #include <rfb/ServerCore.h>
  27. #include <rfb/Security.h>
  28. namespace rfb {
  29. namespace win32 {
  30. class LegacyPage : public PropSheetPage {
  31. public:
  32. LegacyPage(const RegKey& rk, bool userSettings_)
  33. : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_LEGACY)), regKey(rk), userSettings(userSettings_) {}
  34. void initDialog() {
  35. setItemChecked(IDC_PROTOCOL_3_3, rfb::Server::protocol3_3);
  36. }
  37. bool onCommand(int id, int /*cmd*/) {
  38. switch (id) {
  39. case IDC_LEGACY_IMPORT:
  40. {
  41. DWORD result = MsgBox(0,
  42. _T("Importing your legacy VNC 3.3 settings will overwrite your existing settings.\n")
  43. _T("Are you sure you wish to continue?"),
  44. MB_ICONWARNING | MB_YESNO);
  45. if (result == IDYES) {
  46. LoadPrefs();
  47. MsgBox(0, _T("Imported VNC 3.3 settings successfully."),
  48. MB_ICONINFORMATION | MB_OK);
  49. // Sleep to allow RegConfig thread to reload settings
  50. Sleep(1000);
  51. propSheet->reInitPages();
  52. }
  53. }
  54. return true;
  55. case IDC_PROTOCOL_3_3:
  56. setChanged(isItemChecked(IDC_PROTOCOL_3_3) != rfb::Server::protocol3_3);
  57. return false;
  58. };
  59. return false;
  60. }
  61. bool onOk() {
  62. regKey.setBool(_T("Protocol3.3"), isItemChecked(IDC_PROTOCOL_3_3));
  63. return true;
  64. }
  65. void LoadPrefs();
  66. void LoadUserPrefs(const RegKey& key);
  67. protected:
  68. bool allowProperties;
  69. RegKey regKey;
  70. bool userSettings;
  71. };
  72. };
  73. };
  74. #endif