Anthrax feature for Windows

This commit is contained in:
av%netscape.com 1998-08-25 23:22:26 +00:00
parent efe89d97b4
commit eae6f4356c
6 changed files with 129 additions and 132 deletions

View File

@ -59,6 +59,9 @@ public:
#define MIME_SAVE "browser-handle-internal-savetodisk"
#define MIME_SHELLEXECUTE "browser-handle-shellexecute"
#define MIME_OLE "browser-handle-oleserver"
//~~~
#define MIME_PLUGIN "browser-handle-plugin"
#define MIME_PLUGINAPPLET "browser-handle-plugin-applet"
// Helper functions
extern NET_cdataStruct *

View File

@ -152,6 +152,8 @@ typedef struct _fe_EventStruct {
#define HANDLE_MOREINFO 500
#define HANDLE_SHELLEXECUTE 600
#define HANDLE_BY_OLE 700
//~~~
#define HANDLE_VIA_PLUGINAPPLET 800
#define TB_PICTURESANDTEXT 0
#define TB_PICTURES 1

View File

@ -581,7 +581,14 @@ CBrowserPrefs::GetHelperInfo(NET_cdataStruct *pcdata, LPHELPERINFO lpInfo)
lpInfo->bAskBeforeOpening = TRUE;
}
break;
//~~~
case HANDLE_VIA_PLUGIN:
case HANDLE_VIA_PLUGINAPPLET:
if (pcdata->num_exts > 0) {
GetOpenCommandForExt(pcdata->exts[0], lpInfo->szOpenCmd, sizeof(lpInfo->szOpenCmd));
lpInfo->bAskBeforeOpening = FALSE;
}
break;
default:
break;
}

View File

@ -30,6 +30,8 @@
#include "resource.h"
#include "xp_core.h"
#include "xp_help.h"
//~~~
#include "xp_mem.h"
#include "prefapi.h"
#include "brprefid.h"
#include "../../../defaults.h"
@ -53,7 +55,8 @@
#define HANDLE_MOREINFO 500
#define HANDLE_SHELLEXECUTE 600
#define HANDLE_BY_OLE 700
//~~~
#define HANDLE_VIA_PLUGINAPPLET 800
/////////////////////////////////////////////////////////////////////////////
// Helper routines
@ -1051,6 +1054,54 @@ CEditTypeDialog::InitDialog()
}
#endif /* MOZ_MAIL_NEWS */
//~~~
typedef char** (* TYPE_FIND_PLUGIN_FOR_TYPE)(const char *);
TYPE_FIND_PLUGIN_FOR_TYPE fp_find_plugin_for_type = NULL;
HINSTANCE hLib = LoadLibrary("mozilla.exe");
if(hLib != NULL)
{
fp_find_plugin_for_type = (TYPE_FIND_PLUGIN_FOR_TYPE)GetProcAddress((HMODULE)hLib, "NPL_FindPluginsForType");
if(fp_find_plugin_for_type != NULL)
{
char ** ppchPlugins = fp_find_plugin_for_type(LPCTSTR(m_strMimeType));
HWND hWndCombo1 = GetDlgItem(m_hwndDlg, IDC_COMBO1);
if(ppchPlugins != NULL)
{
int iCount = 0;
for(int i = 0; ppchPlugins[i] != NULL; i++)
{
char * pch = ppchPlugins[i];
ComboBox_AddString(hWndCombo1, pch);
if(pch != NULL)
XP_FREE(pch);
iCount++;
}
XP_FREE(ppchPlugins);
ComboBox_SetCurSel(hWndCombo1, iCount - 1);
}
else
{
char sz[256];
LoadString(m_hInstance, IDS_NONE, sz, sizeof(sz));
ComboBox_AddString(hWndCombo1, sz);
ComboBox_SetCurSel(hWndCombo1, 0);
EnableDlgItem(IDC_RADIO4, FALSE);
EnableDlgItem(IDC_COMBO1, FALSE);
}
}
FreeLibrary((HMODULE)hLib);
}
char sz[256];
LoadString(m_hInstance, IDS_NONE, sz, sizeof(sz));
HWND hWndCombo2 = GetDlgItem(m_hwndDlg, IDC_COMBO2);
ComboBox_AddString(hWndCombo2, sz);
ComboBox_SetCurSel(hWndCombo2, 0);
EnableDlgItem(IDC_RADIO5, FALSE);
EnableDlgItem(IDC_COMBO2, FALSE);
return CDialog::InitDialog();
}
@ -1086,6 +1137,13 @@ CEditTypeDialog::DoTransfer(BOOL bSaveAndValidate)
case HANDLE_BY_OLE:
nRadio = 2;
break;
//~~~
case HANDLE_VIA_PLUGIN:
nRadio = 3;
break;
case HANDLE_VIA_PLUGINAPPLET:
nRadio = 4;
break;
}
}
@ -1112,7 +1170,13 @@ CEditTypeDialog::DoTransfer(BOOL bSaveAndValidate)
if (m_nHowToHandle != HANDLE_EXTERNAL)
m_nHowToHandle = HANDLE_SHELLEXECUTE;
break;
//~~~
case 3:
m_nHowToHandle = HANDLE_VIA_PLUGIN;
break;
case 4:
m_nHowToHandle = HANDLE_VIA_PLUGINAPPLET;
break;
default:
assert(FALSE);
break;
@ -1136,8 +1200,9 @@ CEditTypeDialog::OnCommand(int id, HWND hwndCtl, UINT notifyCode)
if (BrowseForProgram(m_hInstance, m_hwndDlg, szPath))
Edit_SetText(GetDlgItem(m_hwndDlg, IDC_EDIT2), szPath);
return TRUE;
} else if ((id == IDC_RADIO1 || id == IDC_RADIO2 || id == IDC_RADIO3) && (notifyCode == BN_CLICKED)) {
//~~~
} else if ((id == IDC_RADIO1 || id == IDC_RADIO2 || id == IDC_RADIO3 || id == IDC_RADIO4 || id == IDC_RADIO5)
&& (notifyCode == BN_CLICKED)) {
// Check whether the check box to prompt before opening a downloaded
// file should be enabled
CheckControls();
@ -1686,7 +1751,7 @@ CApplicationsPrefs::DisplayFileDetails()
int nIndex;
CString strHandledBy, strExts;
LPCSTR lpszMimeType = "";
BOOL bIsPlugin = FALSE;
//~~~BOOL bIsPlugin = FALSE;
//Begin CRN_MIME
BOOL bIsLocked = FALSE;
XP_Bool bAddEnabled = TRUE;
@ -1745,7 +1810,10 @@ CApplicationsPrefs::DisplayFileDetails()
case HANDLE_VIA_PLUGIN:
strHandledBy.LoadString(m_hInstance, IDS_PLUGIN);
bIsPlugin = TRUE;
//~~~bIsPlugin = TRUE;
break;
case HANDLE_VIA_PLUGINAPPLET:
strHandledBy.LoadString(m_hInstance, IDS_PLUGINAPPLET);
break;
}
@ -1809,10 +1877,11 @@ CApplicationsPrefs::DisplayFileDetails()
EnableDlgItem(IDC_BUTTON1, bAddEnabled); //This is the "New Type.." button. CRN_MIME
// Disable the Edit and Remove buttons if the item is handled by a plug-in,
//~~~
// Disable the Edit and Remove buttons if the item is handled by a plug-in,
// because changing or removing the item won't actually do anything
EnableDlgItem(IDC_BUTTON2, !bIsPlugin && !bIsLocked && bEditEnabled); //CRN_MIME Added "&& !bIsLocked && bEditEnabled
EnableDlgItem(IDC_BUTTON3, !bIsPlugin && !bIsLocked && bRemoveEnabled); //CRN_MIME Added "&& !bIsLocked && bRemoveEnabled
//EnableDlgItem(IDC_BUTTON2, !bIsPlugin && !bIsLocked && bEditEnabled); //CRN_MIME Added "&& !bIsLocked && bEditEnabled
//EnableDlgItem(IDC_BUTTON3, !bIsPlugin && !bIsLocked && bRemoveEnabled); //CRN_MIME Added "&& !bIsLocked && bRemoveEnabled
}
void

View File

@ -364,85 +364,40 @@ BEGIN
35,10
END
#ifdef MOZ_MAIL_NEWS
IDD_EDIT_TYPE DIALOG DISCARDABLE 0, 0, 223, 220
IDD_EDIT_TYPE DIALOG DISCARDABLE 0, 0, 256, 223
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Type"
FONT 8, "MS Sans Serif"
BEGIN
ICON "",IDC_ICON1,7,4,18,20
ICON "",IDC_ICON1,7,4,20,20
LTEXT "Description",IDC_DESCRIPTION,34,10,180,8,SS_NOPREFIX
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,28,209,1
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,28,242,1
LTEXT "Extension:",IDC_STATIC,7,40,34,8
LTEXT "GIF",IDC_EXTENSION,50,40,165,8
LTEXT "&MIME Type:",IDC_STATIC,7,56,40,8
EDITTEXT IDC_EDIT1,50,53,166,14,ES_AUTOHSCROLL
GROUPBOX "Handled By",IDC_STATIC,7,89,209,77
CONTROL "&Navigator",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
WS_DISABLED | WS_GROUP | WS_TABSTOP,17,101,47,10
CONTROL "&Save to Disk",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,
17,115,57,10
CONTROL "&Application:",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,
17,129,51,10
EDITTEXT IDC_EDIT2,70,128,140,14,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BUTTON1,160,145,50,14
DEFPUSHBUTTON "OK",IDOK,111,199,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,166,199,50,14
CONTROL "As&k me before opening downloaded files of this type",
IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,171,
179,10
CONTROL "Use this MIME as the outgoing default for these file extensions",
IDC_USEASDEFAULT,"Button",BS_AUTO3STATE | WS_TABSTOP,7,
72,211,10
END
IDD_NEW_TYPE DIALOG DISCARDABLE 0, 0, 222, 142
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Type"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "&Description of type:",IDC_STATIC,7,10,62,8
EDITTEXT IDC_EDIT1,71,8,144,14,ES_AUTOHSCROLL
LTEXT "File &extension:",IDC_STATIC,7,27,46,8
EDITTEXT IDC_EDIT2,71,25,144,14,ES_AUTOHSCROLL
LTEXT "&MIME Type:",IDC_STATIC,7,43,40,8
EDITTEXT IDC_EDIT3,71,42,144,14,ES_AUTOHSCROLL
LTEXT "&Application to use:",IDC_STATIC,7,61,59,8
EDITTEXT IDC_EDIT4,71,59,144,14,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BUTTON1,165,76,50,14
DEFPUSHBUTTON "OK",IDOK,109,121,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,165,121,50,14
CONTROL "Use this MIME as the outgoing default for this file extension",
IDC_USEASDEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
100,201,10
END
#else
IDD_EDIT_TYPE DIALOG DISCARDABLE 0, 0, 223, 199
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Type"
FONT 8, "MS Sans Serif"
BEGIN
ICON "",IDC_ICON1,7,4,18,20
LTEXT "Description",IDC_DESCRIPTION,34,10,180,8,SS_NOPREFIX
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,28,209,1
LTEXT "Extension:",IDC_STATIC,7,40,34,8
LTEXT "GIF",IDC_EXTENSION,50,40,165,8
LTEXT "&MIME Type:",IDC_STATIC,7,54,40,8
EDITTEXT IDC_EDIT1,50,52,166,14,ES_AUTOHSCROLL
GROUPBOX "Handled By",IDC_STATIC,7,75,209,77
LTEXT "&MIME type:",IDC_STATIC,7,55,37,8
EDITTEXT IDC_EDIT1,50,52,199,14,ES_AUTOHSCROLL
GROUPBOX "Handled by",IDC_STATIC,7,75,242,94
CONTROL "&Navigator",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
WS_DISABLED | WS_GROUP | WS_TABSTOP,17,87,47,10
CONTROL "&Save to Disk",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,
17,101,57,10
CONTROL "&Save to disk",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,
17,103,55,10
CONTROL "&Application:",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,
17,115,51,10
EDITTEXT IDC_EDIT2,70,114,140,14,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BUTTON1,160,131,50,14
DEFPUSHBUTTON "OK",IDOK,111,173,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,166,173,50,14
17,119,51,10
EDITTEXT IDC_EDIT2,77,117,148,14,ES_AUTOHSCROLL
PUSHBUTTON "&...",IDC_BUTTON1,227,117,16,14
CONTROL "&Plug-in:",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,17,
135,39,10
COMBOBOX IDC_COMBO1,77,134,148,100,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
CONTROL "Plug-in app&let:",IDC_RADIO5,"Button",
BS_AUTORADIOBUTTON,17,151,59,10
COMBOBOX IDC_COMBO2,77,149,148,100,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
CONTROL "As&k me before opening downloaded files of this type",
IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,157,
IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,180,
179,10
DEFPUSHBUTTON "OK",IDOK,145,202,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,199,202,50,14
END
IDD_NEW_TYPE DIALOG DISCARDABLE 0, 0, 217, 126
@ -463,28 +418,6 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,159,101,50,14
END
#ifdef MOZ_SMARTUPDATE
IDD_SMARTUPDATE DIALOG DISCARDABLE 0, 0, 256, 212
STYLE WS_CHILD | WS_CLIPSIBLINGS
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Compress Client Registry",IDC_BUTTON1,7,55,122,14
PUSHBUTTON "Uninstall",IDC_BUTTON2,189,96,50,14
GROUPBOX "",IDC_STATIC,7,7,242,40
CONTROL "Enable SmartUpdate",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,17,17,226,10
CONTROL "Require manual confirmation of each install",IDC_CHECK2,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,30,225,10
GROUPBOX "",IDC_STATIC,7,72,242,127
LISTBOX IDC_LIST1,15,95,169,99,LBS_SORT | LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
LTEXT "To uninstall, select from the following list and click the Uninstall button.",
IDC_STATIC,13,83,230,10
END
#endif /* MOZ_SMARTUPDATE */
IDD_SMARTBROWSING DIALOG DISCARDABLE 0, 0, 256, 211
STYLE WS_CHILD | WS_CLIPSIBLINGS
FONT 8, "MS Sans Serif"
@ -498,9 +431,6 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,17,109,97,10
END
#endif
/////////////////////////////////////////////////////////////////////////////
//
@ -550,6 +480,14 @@ BEGIN
BOTTOMMARGIN, 183
END
IDD_PRIVACY, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 249
TOPMARGIN, 7
BOTTOMMARGIN, 183
END
IDD_CACHE, DIALOG
BEGIN
LEFTMARGIN, 7
@ -609,9 +547,9 @@ BEGIN
IDD_EDIT_TYPE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 216
RIGHTMARGIN, 249
TOPMARGIN, 7
BOTTOMMARGIN, 192
BOTTOMMARGIN, 216
END
IDD_NEW_TYPE, DIALOG
@ -622,16 +560,6 @@ BEGIN
BOTTOMMARGIN, 119
END
#ifdef MOZ_SMARTUPDATE
IDD_SMARTUPDATE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 249
TOPMARGIN, 7
BOTTOMMARGIN, 205
END
#endif /* MOZ_SMARTUPDATE */
IDD_SMARTBROWSING, DIALOG
BEGIN
LEFTMARGIN, 7
@ -639,15 +567,6 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 183
END
IDD_PRIVACY, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 249
TOPMARGIN, 7
BOTTOMMARGIN, 183
END
END
#endif // APSTUDIO_INVOKED
@ -826,20 +745,15 @@ BEGIN
IDS_DISK_SPACE "Disk Space"
IDS_NUMERIC_ONLY "Please enter numeric digits only."
IDS_MORE_DISK_SPACE "More disk space"
IDD_SMARTBROWSING "Smart Browsing\nConfigure browsing aids"
IDD_PRIVACY "Privacy\nEstablish your level of privacy protection"
END
#ifdef MOZ_SMARTUPDATE
STRINGTABLE DISCARDABLE
BEGIN
IDD_SMARTUPDATE "SmartUpdate\nEnable and uninstall SmartUpdates"
IDS_CONTINUE_UNINSTALL "Are you sure you want to uninstall ""%s"" ?"
IDS_UNINSTALL "Uninstall"
IDS_ERROR_UNINSTALL "Error in uninstall."
IDD_SMARTBROWSING "Smart Browsing\nConfigure browsing aids"
IDD_PRIVACY "Privacy\nEstablish your level of privacy protection"
IDS_NONE "<none>"
IDS_PLUGINAPPLET "Applet"
END
#endif /* MOZ_SMARTUPDATE */
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -132,6 +132,8 @@
#endif /* MOZ_SMARTUPDATE */
#define IDD_SMARTBROWSING 147
#define IDD_PRIVACY 148
#define IDS_NONE 149
#define IDS_PLUGINAPPLET 150
#define IDC_EXTENSION 309
#define IDC_ICON1 316
#define IDC_ICON2 317