Diff for /chimera/ProgressDlgController.mm between versions 1.6 and 1.7

version 1.6, 2002/02/04 00:55:49 version 1.7, 2002/02/04 01:33:00
Line 13 Line 13
 #include "nsIWebBrowserPersist.h"  #include "nsIWebBrowserPersist.h"
 #include "nsIInputStream.h"  #include "nsIInputStream.h"
 #include "nsIURL.h"  #include "nsIURL.h"
   #include "nsILocalFile.h"
 #include "nsIDOMDocument.h"  #include "nsIDOMDocument.h"
 #include "nsIWebProgressListener.h"  #include "nsIWebProgressListener.h"
   #include "nsIComponentManager.h"
   
 class nsDownloadListener : public nsIWebProgressListener  class nsDownloadListener : public nsIWebProgressListener
 {  {
Line 34  public: Line 36  public:
         mURL = do_QueryInterface(aSource);          mURL = do_QueryInterface(aSource);
         if (!mURL)          if (!mURL)
             mDocument = do_QueryInterface(aSource);              mDocument = do_QueryInterface(aSource);
        mDestination = [aDestination cString];        nsCAutoString dstStr = [aDestination cString];
         NS_NewLocalFile(dstStr.get(), PR_FALSE, getter_AddRefs(mDestination));
         mContentType = aContentType;          mContentType = aContentType;
         mPostData = aPostData;          mPostData = aPostData;
         mBypassCache = aBypassCache;          mBypassCache = aBypassCache;
Line 50  public: Line 53  public:
   
 private: // Member variables  private: // Member variables
     ProgressDlgController* mController; // Controller for our UI.      ProgressDlgController* mController; // Controller for our UI.
    nsIWebBrowserPersist* mWebPersist; // Our web persist object.    nsCOMPtr<nsIWebBrowserPersist> mWebPersist; // Our web persist object.
     nsCOMPtr<nsIURL> mURL; // The URL of our source file. Null if we're saving a complete document.      nsCOMPtr<nsIURL> mURL; // The URL of our source file. Null if we're saving a complete document.
    nsCString mDestination; // Our destination string.    nsCOMPtr<nsILocalFile> mDestination; // Our destination URL.
     nsCString mContentType; // Our content type string.      nsCString mContentType; // Our content type string.
     nsCOMPtr<nsIDOMDocument> mDocument; // A DOM document.  Null if we're only saving a simple URL.      nsCOMPtr<nsIDOMDocument> mDocument; // A DOM document.  Null if we're only saving a simple URL.
     nsCOMPtr<nsIInputStream> mPostData;  // For complete documents, this is our post data from session history.      nsCOMPtr<nsIInputStream> mPostData;  // For complete documents, this is our post data from session history.
Line 115  nsDownloadListener::OnStateChange(nsIWeb Line 118  nsDownloadListener::OnStateChange(nsIWeb
 void  void
 nsDownloadListener::BeginDownload()  nsDownloadListener::BeginDownload()
 {  {
    if (mWebPersist) {
         mWebPersist->SetProgressListener(this);
         PRInt32 flags = nsIWebBrowserPersist::PERSIST_FLAGS_NO_CONVERSION | 
                         nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES;
         if (mBypassCache)
             flags |= nsIWebBrowserPersist::PERSIST_FLAGS_BYPASS_CACHE;
         else
             flags |= nsIWebBrowserPersist::PERSIST_FLAGS_FROM_CACHE;
             
         if (mURL)
             mWebPersist->SaveURI(mURL, mPostData, mDestination);
         else {
             
         }
     }
 }  }
   
 static NSString *SaveFileToolbarIdentifier                      = @"Save File Dialog Toolbar";  static NSString *SaveFileToolbarIdentifier                      = @"Save File Dialog Toolbar";
Line 137  static NSString *LeaveOpenToolbarItemIde Line 154  static NSString *LeaveOpenToolbarItemIde
         mDownloadIsPaused = NO;  //Get this value from preferences instead of hardcoding NO.          mDownloadIsPaused = NO;  //Get this value from preferences instead of hardcoding NO.
         mSaveFileDialogShouldStayOpen = NO;          mSaveFileDialogShouldStayOpen = NO;
     }      }
       
       mDownloadListener = nsnull;
       
     return self;      return self;
 }  }
   
   - (void)dealloc
   {
       delete mDownloadListener;
       mDownloadListener = nsnull;
       [super dealloc];
   }
   
 -(void)setWebPersist:(nsIWebBrowserPersist*)aPersist   -(void)setWebPersist:(nsIWebBrowserPersist*)aPersist 
               source:(nsISupports*)aSource                source:(nsISupports*)aSource
          destination:(NSString*)aDestination           destination:(NSString*)aDestination
Line 147  static NSString *LeaveOpenToolbarItemIde Line 174  static NSString *LeaveOpenToolbarItemIde
             postData:(nsIInputStream*)aInputStream              postData:(nsIInputStream*)aInputStream
          bypassCache:(BOOL)aBypassCache           bypassCache:(BOOL)aBypassCache
 {  {
    nsDownloadListener* downloadListener = new nsDownloadListener(self, aPersist, aSource,    mDownloadListener = new nsDownloadListener(self, aPersist, aSource,
                                                                  aDestination, aContentType,                                               aDestination, aContentType,
                                                                  aInputStream, aBypassCache);                                               aInputStream, aBypassCache);
    if (!downloadListener) 
        return; 
     
    downloadListener->BeginDownload(); 
 }  }
   
 - (void)windowDidLoad  - (void)windowDidLoad
 {  {
     [self setupToolbar];      [self setupToolbar];
       if (mDownloadListener)
           mDownloadListener->BeginDownload();
 }  }
   
 - (void)setupToolbar  - (void)setupToolbar

Removed from v.1.6  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>