From cbd9bf789a8a7257e9ebc2accc5d999ebfd419a6 Mon Sep 17 00:00:00 2001 From: "depstein%netscape.com" Date: Tue, 31 Jul 2001 01:49:12 +0000 Subject: [PATCH] Removed nsIRequest methods from BrowserImplWebPrgrsLstnr.cpp, fille out history listener methods, and added in PromptService.cpp from mfcEmbed. --- .../qa/testembed/BrowserImplHistoryLstnr.cpp | 19 +++++ .../qa/testembed/BrowserImplWebPrgrsLstnr.cpp | 11 --- embedding/qa/testembed/StdAfx.h | 1 - .../qa/testembed/components/PromptService.cpp | 82 ++++++++++++++++++- 4 files changed, 98 insertions(+), 15 deletions(-) diff --git a/embedding/qa/testembed/BrowserImplHistoryLstnr.cpp b/embedding/qa/testembed/BrowserImplHistoryLstnr.cpp index 792476b419dd..b9c2ec7febd7 100644 --- a/embedding/qa/testembed/BrowserImplHistoryLstnr.cpp +++ b/embedding/qa/testembed/BrowserImplHistoryLstnr.cpp @@ -87,12 +87,27 @@ NS_IMETHODIMP CBrowserImpl::OnHistoryGoForward(nsIURI *theUri, PRBool *notify) NS_IMETHODIMP CBrowserImpl::OnHistoryReload(nsIURI *theUri, PRUint32 reloadFlags, PRBool *notify) { + char flagString[100]; + CQaUtils::QAOutput("nsIHistoryListener::OnHistoryReload()", 2); CQaUtils::GetTheUri(theUri, 1); *notify = PR_TRUE; CQaUtils::FormatAndPrintOutput("OnHistoryReload() notification = ", *notify, 1); + if (reloadFlags == 0x0000) + strcpy(flagString, "LOAD_FLAGS_NONE"); + else if (reloadFlags == 0x0100) + strcpy(flagString, "LOAD_FLAGS_BYPASS_CACHE"); + else if (reloadFlags == 0x0200) + strcpy(flagString, "LOAD_FLAGS_BYPASS_PROXY"); + else if (reloadFlags == 0x0400) + strcpy(flagString, "LOAD_FLAGS_CHARSET_CHANGE"); + else if (reloadFlags == (0x0200 | 0x0400)) + strcpy(flagString, "LOAD_RELOAD_BYPASS_PROXY_AND_CACHE"); + + CQaUtils::FormatAndPrintOutput("OnHistoryReload() flag = ", flagString, 2); + return NS_OK; } @@ -104,6 +119,8 @@ NS_IMETHODIMP CBrowserImpl::OnHistoryGotoIndex(PRInt32 theIndex, nsIURI *theUri, *notify = PR_TRUE; CQaUtils::FormatAndPrintOutput("OnHistoryGotoIndex() notification = ", *notify, 1); + CQaUtils::FormatAndPrintOutput("OnHistoryGotoIndex() index = ", theIndex, 2); + return NS_OK; } @@ -114,6 +131,8 @@ NS_IMETHODIMP CBrowserImpl::OnHistoryPurge(PRInt32 theNumEntries, PRBool *notify *notify = PR_TRUE; CQaUtils::FormatAndPrintOutput("OnHistoryPurge() notification = ", *notify, 1); + CQaUtils::FormatAndPrintOutput("OnHistoryGotoIndex() theNumEntries = ", theNumEntries, 2); + return NS_OK; } diff --git a/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp b/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp index 3754579b83e8..fb3718da7968 100644 --- a/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp +++ b/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp @@ -150,18 +150,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * displayMode = 1; strcpy(theDocType, "REQUEST"); if (progressStateFlags & STATE_START) - { strcpy(theStateType, "STATE_START"); - - // a few nsIRequest tests - CQaUtils::QAOutput("Some nsIRequest tests thru web prog lstnr: "); - CTests::IsPendingReqTest(request); - CTests::GetStatusReqTest(request); - - CTests::SuspendReqTest(request); - CQaUtils::QAOutput("Between Suspend and Resume."); - CTests::ResumeReqTest(request); - } else if (progressStateFlags & STATE_REDIRECTING) strcpy(theStateType, "STATE_REDIRECTING"); diff --git a/embedding/qa/testembed/StdAfx.h b/embedding/qa/testembed/StdAfx.h index cac392bd3950..c3a2068edf06 100644 --- a/embedding/qa/testembed/StdAfx.h +++ b/embedding/qa/testembed/StdAfx.h @@ -102,7 +102,6 @@ #include "nsIHelperAppLauncherDialog.h" //#include "nsIStreamObserver.h" - //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/embedding/qa/testembed/components/PromptService.cpp b/embedding/qa/testembed/components/PromptService.cpp index 75199912442f..f98a71ebaede 100644 --- a/embedding/qa/testembed/components/PromptService.cpp +++ b/embedding/qa/testembed/components/PromptService.cpp @@ -136,7 +136,18 @@ NS_IMETHODIMP CPromptService::AlertCheck(nsIDOMWindow *parent, const PRUnichar *checkboxMsg, PRBool *checkValue) { - return NS_ERROR_NOT_IMPLEMENTED; + ResourceState setState; + USES_CONVERSION; + + CWnd *wnd = CWndForDOMWindow(parent); + CAlertCheckDialog dlg(wnd, W2T(dialogTitle), W2T(text), + W2T(checkboxMsg), checkValue ? *checkValue : 0); + + dlg.DoModal(); + + *checkValue = dlg.m_bCheckBoxValue; + + return NS_OK; } NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent, @@ -167,7 +178,21 @@ NS_IMETHODIMP CPromptService::ConfirmCheck(nsIDOMWindow *parent, PRBool *checkValue, PRBool *_retval) { - return NS_ERROR_NOT_IMPLEMENTED; + ResourceState setState; + USES_CONVERSION; + + CWnd *wnd = CWndForDOMWindow(parent); + CConfirmCheckDialog dlg(wnd, W2T(dialogTitle), W2T(text), + W2T(checkboxMsg), checkValue ? *checkValue : 0, + "Yes", "No", NULL); + + int iBtnClicked = dlg.DoModal(); + + *checkValue = dlg.m_bCheckBoxValue; + + *_retval = iBtnClicked == 0 ? PR_TRUE : PR_FALSE; + + return NS_OK; } NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent, @@ -309,7 +334,58 @@ NS_IMETHODIMP CPromptService::ConfirmEx(nsIDOMWindow *parent, PRBool *checkValue, PRInt32 *buttonPressed) { - return NS_ERROR_NOT_IMPLEMENTED; + ResourceState setState; + USES_CONVERSION; + + // First, determine the button titles based on buttonFlags + const PRUnichar* buttonStrings[] = { button0Title, button1Title, button2Title }; + CString csBtnTitles[3]; + + for(int i=0; i<3; i++) + { + switch(buttonFlags & 0xff) { + case BUTTON_TITLE_OK: + csBtnTitles[i] = "Ok"; + break; + case BUTTON_TITLE_CANCEL: + csBtnTitles[i] = "Cancel"; + break; + case BUTTON_TITLE_YES: + csBtnTitles[i] = "Yes"; + break; + case BUTTON_TITLE_NO: + csBtnTitles[i] = "No"; + break; + case BUTTON_TITLE_SAVE: + csBtnTitles[i] = "Save"; + break; + case BUTTON_TITLE_DONT_SAVE: + csBtnTitles[i] = "DontSave"; + break; + case BUTTON_TITLE_REVERT: + csBtnTitles[i] = "Revert"; + break; + case BUTTON_TITLE_IS_STRING: + csBtnTitles[i] = W2T(buttonStrings[i]); + break; + } + + buttonFlags >>= 8; + } + + CWnd *wnd = CWndForDOMWindow(parent); + CConfirmCheckDialog dlg(wnd, W2T(dialogTitle), W2T(text), + checkMsg ? W2T(checkMsg) : NULL, checkValue ? *checkValue : 0, + csBtnTitles[0].IsEmpty() ? NULL : (LPCTSTR)csBtnTitles[0], + csBtnTitles[1].IsEmpty() ? NULL : (LPCTSTR)csBtnTitles[1], + csBtnTitles[2].IsEmpty() ? NULL : (LPCTSTR)csBtnTitles[2]); + + *buttonPressed = dlg.DoModal(); + + if(checkValue) + *checkValue = dlg.m_bCheckBoxValue; + + return NS_OK; } //*****************************************************************************