From 6d0f3eb8060b24e6fe9a1e535dbb04bc2549127e Mon Sep 17 00:00:00 2001 From: "shrutiv%netscape.com" Date: Sat, 10 Aug 2002 00:31:59 +0000 Subject: [PATCH] Fix for bugscape 16908: Reorder additional components (r=mitchf) --- cck/driver/WizardUI.cpp | 43 ++++++++++++++++++++++++++++++++++++++--- cck/globals/comp.cpp | 4 ++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/cck/driver/WizardUI.cpp b/cck/driver/WizardUI.cpp index e4d3e982e60..8fde30fcff7 100644 --- a/cck/driver/WizardUI.cpp +++ b/cck/driver/WizardUI.cpp @@ -490,13 +490,50 @@ void CWizardUI::UpdateScreenWidget(WIDGET *curWidget) ((CCheckListBox*)curWidget->control)->ResetContent(); + int mailindex, calendarindex; + BOOL foundcalendar = FALSE; for (int i = 0; i < curWidget->numOfOptions; i++) + { if (curWidget->options.value[i]) ((CCheckListBox*)curWidget->control)->AddString(curWidget->options.value[i]); - if (strcmp(curWidget->options.value[--i], "Calendar") == 0) + if (strcmp(curWidget->options.value[i], "Calendar") == 0) + { + calendarindex = i; + foundcalendar = TRUE; + } + if (strcmp(curWidget->options.value[i], "Mail & Instant Messaging") == 0) + mailindex = i; + } + + if (foundcalendar == TRUE) + // Place Calendar component after MailNews { - ((CCheckListBox*)curWidget->control)->DeleteString(i); - ((CCheckListBox*)curWidget->control)->InsertString(3,curWidget->options.value[i]); + typedef struct TEMPOPTIONS + { + char name[MIN_SIZE]; + char value[MIN_SIZE]; + }TEMPOPTIONS; + TEMPOPTIONS tempOptions[100]; + int i,j; + + ((CCheckListBox*)curWidget->control)->DeleteString(calendarindex); + ((CCheckListBox*)curWidget->control)->InsertString(mailindex, curWidget->options.value[calendarindex]); + + for(i=mailindex,j=0; ioptDesc.name[i]); + strcpy(tempOptions[j].value, curWidget->optDesc.value[i]); + } + int jcnt = j; + strcpy(curWidget->optDesc.name[mailindex], curWidget->optDesc.name[calendarindex]); + strcpy(curWidget->optDesc.value[mailindex], curWidget->optDesc.value[calendarindex]); + + for (j=0,i=mailindex+1; joptDesc.name[i], tempOptions[j].name); + strcpy(curWidget->optDesc.value[i], tempOptions[j].value); + } + } if (curWidget->value && curWidget->value != "") diff --git a/cck/globals/comp.cpp b/cck/globals/comp.cpp index 18b3843c844..60b613a913d 100644 --- a/cck/globals/comp.cpp +++ b/cck/globals/comp.cpp @@ -230,10 +230,10 @@ int GenerateComponentList(CString parms, WIDGET *curWidget) curWidget->options.value[i] = new char[strlen(Components[i].name)+1]; strcpy(curWidget->options.value[i], Components[i].name); - curWidget->optDesc.name[i] = new char[strlen(Components[i].compname)+1]; + curWidget->optDesc.name[i] = new char[MIN_SIZE]; strcpy(curWidget->optDesc.name[i], Components[i].compname); - curWidget->optDesc.value[i] = new char[strlen(Components[i].desc)+1]; + curWidget->optDesc.value[i] = new char[MIN_SIZE]; strcpy(curWidget->optDesc.value[i], Components[i].desc); // INVISIBLE just means not selected, let user decide whether to