Changeset 9526


Ignore:
Timestamp:
2005-04-01T09:47:48+12:00 (19 years ago)
Author:
mdewsnip
Message:

Added to the settings dialog the option to have the Local Library use the default browser, rather than explicitly IE, Netscape, or other. There already existed code for finding the default browser, but it wasn't being used.

For the UNESCO 2.60 CD-ROM the default selection will stay as Internet Explorer, but afterwards it will change to use the default browser by default.

Location:
trunk/gsdl/src/w32server
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/w32server/resource.h

    r1292 r9526  
    3535#define ID_OK_BUTTON                    1021
    3636#define ID_CANCEL_BUTTON                1022
     37#define ID_RADIO_DEFAULT                1023
    3738#define ID_PROJECT_SETTINGS             40001
    3839#define ID_PROJECT_EXIT                 40002
  • trunk/gsdl/src/w32server/settings.cpp

    r4642 r9526  
    343343static void check_browser_settings (int &browser, char *browser_exe,
    344344                    int netscapeneeded) {
    345  
    346345  // sort out which browser to use
    347346  if ((browser == GS_NETSCAPE) && (netscape_exe[0] == '\0'))
     
    359358 
    360359  // get the browser's executable
    361   if (browser == GS_NETSCAPE) {
     360  if (browser == GS_DEFAULT) {
     361    strcpy (browser_exe, default_browser_exe);
     362  } else if (browser == GS_NETSCAPE) {
    362363    strcpy (browser_exe, netscape_exe);
    363364  } else if (browser == GS_IEXPLORE) {
     
    395396
    396397  check_installed_browsers (netscapeneeded);
    397   gsdl_browser = GS_IEXPLORE;
     398  gsdl_browser = GS_IEXPLORE;  // !! TO DO: Change this to GS_DEFAULT to use the default browser by default !!
    398399  strcpy (gsdl_browser_exe, default_browser_exe);
    399400  check_browser_settings (gsdl_browser, gsdl_browser_exe, netscapeneeded);
     
    526527
    527528static int read_dialog_browser_field (HWND hwndDlg) {
     529  if (SendDlgItemMessage(hwndDlg, ID_RADIO_DEFAULT,
     530             BM_GETCHECK, 0, 0) == 1) return GS_DEFAULT;
    528531  if (SendDlgItemMessage(hwndDlg, ID_RADIO_NETSCAPE,
    529532             BM_GETCHECK, 0, 0) == 1) return GS_NETSCAPE;
     
    538541
    539542static void set_dialog_browser_field (HWND hwndDlg, int browser, char *othername) {
    540   // if we are trying to set the browser to netscape or
     543  // if we are trying to set the browser to default, netscape or
    541544  // internet explorer and we can't find them, set the browser
    542545  // to 'other'
     546  if ((browser == GS_DEFAULT) && (default_browser_exe[0] == '\0'))
     547    browser = GS_NETSCAPE;
    543548  if ((browser == GS_NETSCAPE) && (netscape_exe[0] == '\0'))
    544549    browser = GS_IEXPLORE;
     
    549554 
    550555  // update the radio buttons
     556  SendDlgItemMessage(hwndDlg, ID_RADIO_DEFAULT, BM_SETCHECK,
     557             (browser == GS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED, 0);
    551558  SendDlgItemMessage(hwndDlg, ID_RADIO_NETSCAPE, BM_SETCHECK,
    552559             (browser == GS_NETSCAPE) ? BST_CHECKED : BST_UNCHECKED, 0);
     
    557564 
    558565  // update the other name field
    559   if (browser == GS_NETSCAPE) {
     566  if (browser == GS_DEFAULT) {
     567    SetDlgItemText(hwndDlg, ID_OTHER_NAME, default_browser_exe);
     568  } else if (browser == GS_NETSCAPE) {
    560569    SetDlgItemText(hwndDlg, ID_OTHER_NAME, netscape_exe);
    561570  } else if (browser == GS_IEXPLORE) {
     
    611620    dialog_update_enables(hwndDlg);
    612621   
    613     // make sure that the netscape and internet explorer
     622    // make sure that the default browser, netscape and internet explorer
    614623    // radio buttons are only enabled if they could be found
     624    if (default_browser_exe[0] == '\0')
     625      EnableWindow (GetDlgItem (hwndDlg, ID_RADIO_DEFAULT), FALSE);
    615626    if (netscape_exe[0] == '\0')
    616627      EnableWindow (GetDlgItem (hwndDlg, ID_RADIO_NETSCAPE), FALSE);
     
    661672    }
    662673    return 1;
     674
     675      case ID_RADIO_DEFAULT:
     676    set_dialog_browser_field (hwndDlg, GS_DEFAULT, NULL);
     677    dialog_update_enables(hwndDlg);
     678    return 1;
    663679   
    664680      case ID_RADIO_NETSCAPE:
  • trunk/gsdl/src/w32server/settings.h

    r4642 r9526  
    3232#define GS_IEXPLORE 1
    3333#define GS_OTHER    2
     34#define GS_DEFAULT  3
    3435
    3536#include "text_t.h"
Note: See TracChangeset for help on using the changeset viewer.