Bug 253926 Print to file doesn't cancel properly

Patch by leon.sha@sun.com
darin.moz: review+
benjamin: superreview+


git-svn-id: svn://10.0.0.236/trunk@227953 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
leon.sha%sun.com
2007-06-13 05:48:17 +00:00
parent 7c093b866e
commit 777506588a
3 changed files with 8 additions and 3 deletions

View File

@@ -56,12 +56,13 @@ NS_INTERFACE_MAP_BEGIN(nsPrintProgress)
NS_INTERFACE_MAP_END_THREADSAFE
nsPrintProgress::nsPrintProgress()
nsPrintProgress::nsPrintProgress(nsIPrintSettings* aPrintSettings)
{
m_closeProgress = PR_FALSE;
m_processCanceled = PR_FALSE;
m_pendingStateFlags = -1;
m_pendingStateValue = 0;
m_PrintSetting = aPrintSettings;
}
nsPrintProgress::~nsPrintProgress()
@@ -143,6 +144,8 @@ NS_IMETHODIMP nsPrintProgress::GetProcessCanceledByUser(PRBool *aProcessCanceled
}
NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(PRBool aProcessCanceledByUser)
{
if(m_PrintSetting)
m_PrintSetting->SetIsCancelled(PR_TRUE);
m_processCanceled = aProcessCanceledByUser;
OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, PR_FALSE);
return NS_OK;

View File

@@ -41,6 +41,7 @@
#define __nsPrintProgress_h
#include "nsIPrintProgress.h"
#include "nsIPrintingPromptService.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
@@ -57,7 +58,7 @@ public:
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIPRINTSTATUSFEEDBACK
nsPrintProgress();
nsPrintProgress(nsIPrintSettings* aPrintSettings);
virtual ~nsPrintProgress();
private:
@@ -71,6 +72,7 @@ private:
nsCOMPtr<nsIDOMWindowInternal> m_dialog;
nsCOMPtr<nsISupportsArray> m_listenerList;
nsCOMPtr<nsIObserver> m_observer;
nsCOMPtr<nsIPrintSettings> m_PrintSetting;
};
#endif

View File

@@ -135,7 +135,7 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
*notifyOnOpen = PR_FALSE;
nsPrintProgress* prtProgress = new nsPrintProgress();
nsPrintProgress* prtProgress = new nsPrintProgress(printSettings);
nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrintProgress));
NS_ENSURE_SUCCESS(rv, rv);