checkbox->Hide();  theDialog->SetLatentSub(pwdText); theDialog->Show(); theDialog->Select();  while (true) { MessageT	hitMessage = theHandler.DoDialog();  if (hitMessage == msg_OK) { nsAutoString    ucStr;  if (password && *password) { nsMemory::Free(*password); *password = nsnull; } pwdText->GetDescriptor(pStr); CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, ucStr); *password = ToNewUnicode(ucStr); if (*password == nsnull) resultErr = NS_ERROR_OUT_OF_MEMORY;
{ *_retval = FALSE; }
NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent, const PRUnichar *dialogTitle,                                             const PRUnichar *text,                                             PRUnichar **password,                                             const PRUnichar *checkMsg, PRBool *checkValue,                                             PRBool *_retval){    NS_ENSURE_ARG_POINTER(_retval);        nsresult resultErr = NS_OK;    StDialogHandler	 theHandler(dlog_PromptPassword, CBrowserChrome::GetLWindowForDOMWindow(parent));    LWindow			 *theDialog = theHandler.GetDialog();    LCheckBox        *checkbox = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID('Chck'));    nsCAutoString    cStr;    Str255           pStr;    if (dialogTitle) {        CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);        theDialog->SetDescriptor(pStr);    }    LStaticText	*msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));    CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);    cStr.ReplaceChar('\n', '\r');    msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());        LEditText *pwdText = dynamic_cast<LEditText*>(theDialog->FindPaneByID('Pass'));    if (password && *password) {        CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(*password), pStr);        pwdText->SetDescriptor(pStr);    }        if (checkValue) {        checkbox->SetValue(*checkValue);        if (checkMsg) {            CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(checkMsg), pStr);            checkbox->SetDescriptor(pStr);        }    }    else        checkbox->Hide();     theDialog->SetLatentSub(pwdText);       theDialog->Show();    theDialog->Select();		while (true)  // This is our modal dialog event loop	{						MessageT	hitMessage = theHandler.DoDialog();				if (hitMessage == msg_OK)		{		    nsAutoString    ucStr;		    		    		    if (password && *password) {		        nsMemory::Free(*password);		        *password = nsnull;		    }		    pwdText->GetDescriptor(pStr);		    CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, ucStr);		    *password = ToNewUnicode(ucStr);		    if (*password == nsnull)		        resultErr = NS_ERROR_OUT_OF_MEMORY;   		    if (checkValue)   		        *checkValue = checkbox->GetValue();		    *_retval = PR_TRUE;           		    break;   		}   		else if (hitMessage == msg_Cancel)   		{   		    *_retval = PR_FALSE;   		    break;   		}	}    return resultErr;}