Merged SeamonkeyCCK_6_2_BRANCH with trunk.

This commit is contained in:
smeredith%netscape.com 2001-11-14 00:23:13 +00:00
parent ffe8346ca7
commit 995e4d5a52
7 changed files with 848 additions and 621 deletions

View File

@ -532,7 +532,7 @@ NODE* CWizardMachineApp::CreateNode(NODE *parentNode, CString iniFile)
NewNode->images = (IMAGE **) GlobalAlloc(0, 20 * sizeof(IMAGE *));
NewNode->numImages = 0;
char sectionBuffer[MID_SIZE];
char sectionBuffer[MAX_SIZE];
GetPrivateProfileString(NULL, NULL, "", sectionBuffer, MAX_SIZE, iniFile);
char iniSection[MID_SIZE];
@ -1110,7 +1110,10 @@ BOOL CWizardMachineApp::FileExists(CString file)
if (! (f = fopen(file, "r") ))
return FALSE;
else
{
fclose(f);
return TRUE;
}
}
BOOL CWizardMachineApp::FillGlobalWidgetArray(CString file)
@ -1378,6 +1381,11 @@ void CWizardMachineApp::BuildWidget(WIDGET* aWidget, CString iniSection, CString
GetPrivateProfileString(iniSection, "onCommand", "", buffer, MAX_SIZE, iniFile);
aWidget->action.onCommand = buffer;
// Used in the ShowSection command to show and hide widgets based on selection in a listbox.
GetPrivateProfileString(iniSection, "ShowInSection", "", buffer, MAX_SIZE, iniFile);
aWidget->showinsection = buffer;
/// Dynamic ID allocation
aWidget->widgetID = pageBaseIndex + idCounter;

View File

@ -53,7 +53,8 @@ typedef struct WIDGET
CString title;
CString group;
CString target;
CString description;
CString description;
CString showinsection; // Used in the ShowSection command to show and hide widgets based on selection in a listbox.
POINT location;
DIMENSION size;
FIELDLEN fieldlen;

View File

@ -176,7 +176,7 @@ LRESULT CWizardUI::OnWizardBack()
UpdateGlobals();
DestroyCurrentScreenWidgets();
return FALSE;
}
}
if (!prevLock.IsLocked())
{
prevLock.Lock();
@ -202,7 +202,7 @@ LRESULT CWizardUI::OnWizardNext()
DestroyCurrentScreenWidgets();
return FALSE;
}
if (!nextLock.IsLocked())
{
nextLock.Lock();
@ -389,6 +389,8 @@ BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam)
if (curWidget->numOfOptDesc > 0)
SetDescription(curWidget);
}
break;
}
@ -547,18 +549,18 @@ void CWizardUI::UpdateScreenWidget(WIDGET *curWidget)
if (widg)
widg->control->EnableWindow(TRUE);
}
else if ((strcmp(curWidget->value,"Linux")==0) && (direxist != -1))
{
WIDGET *widg = findWidget("LinuxPath");
if (widg)
widg->control->EnableWindow(FALSE);
widg = findWidget("Text7888");
if (widg)
widg->control->EnableWindow(FALSE);
widg = findWidget("Button9888");
if (widg)
widg->control->EnableWindow(FALSE);
}
else if ((strcmp(curWidget->value,"Linux")==0) && (direxist != -1))
{
WIDGET *widg = findWidget("LinuxPath");
if (widg)
widg->control->EnableWindow(FALSE);
widg = findWidget("Text7888");
if (widg)
widg->control->EnableWindow(FALSE);
widg = findWidget("Button9888");
if (widg)
widg->control->EnableWindow(FALSE);
}
}
if (selRv == CB_ERR)

View File

@ -143,9 +143,9 @@ BOOL CInterpret::BrowseFile(WIDGET *curWidget)
// if ((fullFileName.Right(fileLength - dotPlace -1) == fileExt) && (tmpWidget && (CEdit*)tmpWidget->control))
if (tmpWidget && (CEdit*)tmpWidget->control)
{
tmpWidget->value = fullFileName;
if (tmpWidget->name == "LinuxPath")
tmpWidget->display = fullFileName;
tmpWidget->value = fullFileName;
if (tmpWidget->name == "LinuxPath")
tmpWidget->display = fullFileName;
else
tmpWidget->display = GetTrimFile(fullFileName);
}
@ -292,6 +292,59 @@ BOOL CInterpret::IterateListBox(char *parms)
return TRUE;
}
// The function goes through all widgets with a showinsection attribute set, and hides
// those which don't match the selected name from this listbox and unhides those
// which do match.
BOOL CInterpret::ShowSection(WIDGET *curWidget)
{
if (!curWidget)
return FALSE;
if (curWidget->type != "ListBox")
return FALSE;
if (!curWidget->control)
return FALSE;
// Get the selected text from the list box.
int sel = ((CListBox*)curWidget->control)->GetCurSel();
if (sel < 0)
return FALSE;
CString Section;
((CListBox*)curWidget->control)->GetText(sel, Section);
if (Section.IsEmpty())
return FALSE;
// Search all widgets for ones with ShowInSection tags, which means they
// belong in some section.
for (int i = 0; i < GlobalArrayIndex; i++)
{
// If the control is created and the ShowInSection tag exists, hide or unhide the control.
if (GlobalWidgetArray[i].control && !GlobalWidgetArray[i].showinsection.IsEmpty())
{
// Belongs in this section.
if (GlobalWidgetArray[i].showinsection.Compare(Section) == 0)
{
if (!GlobalWidgetArray[i].control->IsWindowVisible())
GlobalWidgetArray[i].control->ShowWindow(SW_SHOW);
}
else // Belongs in another section.
{
if (GlobalWidgetArray[i].control->IsWindowVisible())
GlobalWidgetArray[i].control->ShowWindow(SW_HIDE);
}
// Cause a repaint so the show/hide takes effect.
curWidget->control->GetParent()->GetParent()->Invalidate();
}
}
return TRUE;
}
BOOL CInterpret::GetRegistryKey( HKEY key, const char *subkey, char *retdata )
{
long retval;
@ -606,84 +659,84 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
{
if (!IterateListBox(parms))
return FALSE;
}
else if(strcmp(pcmd, "IsMailfieldempty") ==0)
{
CString ispDomainName = GetGlobal("DomainName");
CString ispPrettyName = GetGlobal("PrettyName");
CString ispLongName = GetGlobal("LongName");
CString ispInServer = GetGlobal("IncomingServer");
CString ispOutServer = GetGlobal("OutgoingServer");
CString ispPortNumber = GetGlobal("PortNumber");
if ((ispDomainName.IsEmpty()) ||
(ispPrettyName.IsEmpty()) ||
(ispLongName.IsEmpty()) ||
(ispInServer.IsEmpty()) ||
(ispOutServer.IsEmpty()) ||
(ispPortNumber.IsEmpty()))
{
if (!((ispDomainName.IsEmpty()) &&
(ispPrettyName.IsEmpty()) &&
(ispLongName.IsEmpty()) &&
(ispInServer.IsEmpty()) &&
(ispOutServer.IsEmpty()) &&
(ispPortNumber.IsEmpty())))
{
AfxMessageBox("All fields must be filled to create a customized mail account", MB_OK);
return FALSE;
}
}
}
else if(strcmp(pcmd, "IsNewsfieldempty") ==0)
{
CString newsDomainName = GetGlobal("nDomainName");
CString newsPrettyName = GetGlobal("nPrettyName");
CString newsLongName = GetGlobal("nLongName");
CString newsServer = GetGlobal("nServer");
CString newsPortNumber = GetGlobal("nPortNumber");
if ((newsDomainName.IsEmpty()) ||
(newsPrettyName.IsEmpty()) ||
(newsLongName.IsEmpty()) ||
(newsServer.IsEmpty()) ||
(newsPortNumber.IsEmpty()))
{
if (!((newsDomainName.IsEmpty()) &&
(newsPrettyName.IsEmpty()) &&
(newsLongName.IsEmpty()) &&
(newsServer.IsEmpty()) &&
(newsPortNumber.IsEmpty())))
{
AfxMessageBox("All fields must be filled to create a customized news account", MB_OK);
return FALSE;
}
}
}
else if (strcmp(pcmd, "IsAutourlempty") == 0)
{
CString proxyConfigoption = GetGlobal("radioGroup2");
if (proxyConfigoption == "3")
{
WIDGET *wid;
wid = findWidget("autoproxyurl");
CString autourl = CWizardUI::GetScreenValue(wid);
if (autourl == "")
{
AfxMessageBox("Please enter a URL for automatic proxy configuration", MB_OK);
return FALSE;
}
}
}
else if (strcmp(pcmd, "IsSamedomain") == 0)
{
CString ispDomainName = GetGlobal("DomainName");
CString newsDomainName;
newsDomainName = CWizardUI::GetScreenValue(curWidget);
if (newsDomainName == ispDomainName)
{
AfxMessageBox("The domain name for News must be different from the domain name used for Mail", MB_OK);
return FALSE;
}
}
else if(strcmp(pcmd, "IsMailfieldempty") ==0)
{
CString ispDomainName = GetGlobal("DomainName");
CString ispPrettyName = GetGlobal("PrettyName");
CString ispLongName = GetGlobal("LongName");
CString ispInServer = GetGlobal("IncomingServer");
CString ispOutServer = GetGlobal("OutgoingServer");
CString ispPortNumber = GetGlobal("PortNumber");
if ((ispDomainName.IsEmpty()) ||
(ispPrettyName.IsEmpty()) ||
(ispLongName.IsEmpty()) ||
(ispInServer.IsEmpty()) ||
(ispOutServer.IsEmpty()) ||
(ispPortNumber.IsEmpty()))
{
if (!((ispDomainName.IsEmpty()) &&
(ispPrettyName.IsEmpty()) &&
(ispLongName.IsEmpty()) &&
(ispInServer.IsEmpty()) &&
(ispOutServer.IsEmpty()) &&
(ispPortNumber.IsEmpty())))
{
AfxMessageBox("All fields must be filled to create a customized mail account", MB_OK);
return FALSE;
}
}
}
else if(strcmp(pcmd, "IsNewsfieldempty") ==0)
{
CString newsDomainName = GetGlobal("nDomainName");
CString newsPrettyName = GetGlobal("nPrettyName");
CString newsLongName = GetGlobal("nLongName");
CString newsServer = GetGlobal("nServer");
CString newsPortNumber = GetGlobal("nPortNumber");
if ((newsDomainName.IsEmpty()) ||
(newsPrettyName.IsEmpty()) ||
(newsLongName.IsEmpty()) ||
(newsServer.IsEmpty()) ||
(newsPortNumber.IsEmpty()))
{
if (!((newsDomainName.IsEmpty()) &&
(newsPrettyName.IsEmpty()) &&
(newsLongName.IsEmpty()) &&
(newsServer.IsEmpty()) &&
(newsPortNumber.IsEmpty())))
{
AfxMessageBox("All fields must be filled to create a customized news account", MB_OK);
return FALSE;
}
}
}
else if (strcmp(pcmd, "IsAutourlempty") == 0)
{
CString proxyConfigoption = GetGlobal("radioGroup2");
if (proxyConfigoption == "3")
{
WIDGET *wid;
wid = findWidget("autoproxyurl");
CString autourl = CWizardUI::GetScreenValue(wid);
if (autourl == "")
{
AfxMessageBox("Please enter a URL for automatic proxy configuration", MB_OK);
return FALSE;
}
}
}
else if (strcmp(pcmd, "IsSamedomain") == 0)
{
CString ispDomainName = GetGlobal("DomainName");
CString newsDomainName;
newsDomainName = CWizardUI::GetScreenValue(curWidget);
if (newsDomainName == ispDomainName)
{
AfxMessageBox("The domain name for News must be different from the domain name used for Mail", MB_OK);
return FALSE;
}
}
else if(strcmp(pcmd, "IsNumeric") ==0)
{
WIDGET *wid;
@ -715,20 +768,20 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
}
}
else if(strcmp(pcmd, "IsPortnumEmpty") ==0)
{
WIDGET *wid;
wid = curWidget;
if (wid)
{
CString retval = CWizardUI::GetScreenValue(curWidget);
if (retval == "")
{
SetGlobal(curWidget->value,"0");
((CEdit*)wid->control)->SetWindowText("0");
}
}
}
else if(strcmp(pcmd, "IsPortnumEmpty") ==0)
{
WIDGET *wid;
wid = curWidget;
if (wid)
{
CString retval = CWizardUI::GetScreenValue(curWidget);
if (retval == "")
{
SetGlobal(curWidget->value,"0");
((CEdit*)wid->control)->SetWindowText("0");
}
}
}
else if (strcmp(pcmd, "VerifySet") == 0)
{
// VerifySet checks to see if the first parameter has any value
@ -795,7 +848,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
theApp.FillGlobalWidgetArray(CachePath); // Ignore failure, we'll write one out later
IsSameCache = FALSE;
}
// Switch pre-set target platform and create working installer
// Switch pre-set target platform and create working installer
else if (strcmp(pcmd, "ChangePlatform") ==0)
{
WIDGET *w = findWidget(parms);
@ -809,20 +862,20 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
strcpy(deletePath, outputPath);
CallDLL("IBEngine", "EraseDirectory", deletePath, w);
}
}
// change pre-set CD autorun option
else if (strcmp(pcmd, "ChangeCDScreen") ==0)
{
WIDGET *w = findWidget(parms);
if (w)
{
CString rootPath = GetGlobal("Root");
CString configName = GetGlobal("CustomizationList");
CString outputPath = rootPath + "Configs\\" + configName + "\\Output";
char deletePath[MAX_SIZE];
strcpy(deletePath, outputPath);
CallDLL("IBEngine", "EraseDirectory", deletePath, w);
}
}
// change pre-set CD autorun option
else if (strcmp(pcmd, "ChangeCDScreen") ==0)
{
WIDGET *w = findWidget(parms);
if (w)
{
CString rootPath = GetGlobal("Root");
CString configName = GetGlobal("CustomizationList");
CString outputPath = rootPath + "Configs\\" + configName + "\\Output";
char deletePath[MAX_SIZE];
strcpy(deletePath, outputPath);
CallDLL("IBEngine", "EraseDirectory", deletePath, w);
}
}
else if (strcmp(pcmd, "WriteCache") ==0)
{
@ -1141,6 +1194,18 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
}
}
}
else if (strcmp(pcmd, "ShowSection") == 0)
{
// ShowSection is a way to use a listbox to choose a subset of widgets to display.
// To use, create a listbox widget, and fill it will sectionnames.
// Set its onCommand=ShowSection.
// Then give the widgets you want in each section a "ShowInSection=sectionname".
// When "sectionname" is selected in the listbox, all widgets with matching ShowInSection
// are shown, and all widgets with some other sectiion are hidden. Widgets without
// the ShowInSection attribute are left alone.
ShowSection(curWidget);
}
}
// This is an extra free...
//free(pcmd);

View File

@ -42,6 +42,7 @@ public:
CString BrowseDir(WIDGET *curWidget);
void GenerateList(CString action, WIDGET* curWidget, CString ext);
BOOL Progress(); // Not actually used right now
BOOL ShowSection(WIDGET *curWidget);
BOOL IterateListBox(char *parms);
CString replaceVars(CString str, char *listval);
CString replaceVars(char *str, char *listval);

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,7 @@ typedef struct WIDGET
CString group;
CString target;
CString description;
CString showinsection; // Used in the ShowSection command to show and hide widgets based on selection in a listbox.
POINT location;
DIMENSION size;
FIELDLEN fieldlen;