Fix for nsIFile now being unicode apis instead of UTF8
This commit is contained in:
Родитель
f6b7ba4d82
Коммит
edb2285408
|
@ -779,7 +779,7 @@ BookmarksService::AddObserver()
|
|||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
|
||||
profileDir->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
profileDir->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCAutoString bookmarksFileURL;
|
||||
NS_GetURLSpecFromFile(profileDir, bookmarksFileURL);
|
||||
|
@ -890,7 +890,7 @@ BookmarksService::FlushBookmarks()
|
|||
{
|
||||
nsCOMPtr<nsIFile> bookmarksFile;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(bookmarksFile));
|
||||
bookmarksFile->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
bookmarksFile->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCOMPtr<nsIOutputStream> outputStream;
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), bookmarksFile);
|
||||
|
|
|
@ -1205,10 +1205,10 @@ nsHeaderSniffer::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|||
nsCOMPtr<nsIFile> tmpFile;
|
||||
dirService->Get("TmpD", NS_GET_IID(nsIFile), getter_AddRefs(tmpFile));
|
||||
static short unsigned int tmpRandom = 0;
|
||||
nsCAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsCAutoString saveFile("-sav");
|
||||
nsAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsAutoString saveFile(NS_LITERAL_STRING("-sav"));
|
||||
saveFile += tmpNo;
|
||||
saveFile += "tmp";
|
||||
saveFile += NS_LITERAL_STRING("tmp");
|
||||
tmpFile->Append(saveFile);
|
||||
|
||||
// Get the post data if we're an HTML doc.
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __ContentClickListener_h__
|
||||
#define __ContentClickListener_h__
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include "nsIDOMMouseListener.h"
|
||||
|
||||
class ContentClickListener : public nsIDOMMouseListener
|
||||
{
|
||||
public:
|
||||
ContentClickListener(id aBrowserController);
|
||||
virtual ~ContentClickListener();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// The DOM mouse listener interface. We only care about clicks.
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
|
||||
private:
|
||||
id mBrowserController; // Our browser controller (weakly held)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "nscore.h"
|
||||
|
||||
class nsIWebBrowserPersist;
|
||||
class nsISupports;
|
||||
|
@ -71,7 +72,7 @@ class nsDownloadListener;
|
|||
postData: (nsIInputStream*)aInputStream
|
||||
bypassCache: (BOOL)aBypassCache;
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource;
|
||||
-(void) setDestination: (const char*)aDestination;
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource;
|
||||
-(void) setDestination: (const PRUnichar*)aDestination;
|
||||
|
||||
@end
|
||||
|
|
|
@ -68,7 +68,12 @@ public:
|
|||
mURL = do_QueryInterface(aSource);
|
||||
if (!mURL)
|
||||
mDocument = do_QueryInterface(aSource);
|
||||
nsCAutoString dstStr = [aDestination cString];
|
||||
PRUint32 dstLen = [aDestination length];
|
||||
PRUnichar* tmp = new PRUnichar[dstLen + sizeof(PRUnichar)];
|
||||
tmp[dstLen] = (PRUnichar)'\0';
|
||||
[aDestination getCharacters:tmp];
|
||||
nsAutoString dstStr ( tmp );
|
||||
delete tmp;
|
||||
NS_NewLocalFile(dstStr, PR_FALSE, getter_AddRefs(mDestination));
|
||||
mContentType = aContentType;
|
||||
mPostData = aPostData;
|
||||
|
@ -174,17 +179,17 @@ nsDownloadListener::BeginDownload()
|
|||
// Create a local directory in the same dir as our file. It
|
||||
// will hold our associated files.
|
||||
filesFolder = do_CreateInstance("@mozilla.org/file/local;1");
|
||||
nsCAutoString unicodePath;
|
||||
nsAutoString unicodePath;
|
||||
mDestination->GetPath(unicodePath);
|
||||
filesFolder->InitWithPath(unicodePath);
|
||||
|
||||
nsCAutoString leafName;
|
||||
nsAutoString leafName;
|
||||
filesFolder->GetLeafName(leafName);
|
||||
nsCAutoString nameMinusExt(leafName);
|
||||
nsAutoString nameMinusExt(leafName);
|
||||
PRInt32 index = nameMinusExt.RFind(".");
|
||||
if (index >= 0)
|
||||
nameMinusExt.Left(nameMinusExt, index);
|
||||
nameMinusExt += " Files"; // XXXdwh needs to be localizable!
|
||||
nameMinusExt += NS_LITERAL_STRING(" Files"); // XXXdwh needs to be localizable!
|
||||
filesFolder->SetLeafName(nameMinusExt);
|
||||
PRBool exists = PR_FALSE;
|
||||
filesFolder->Exists(&exists);
|
||||
|
@ -214,17 +219,17 @@ nsDownloadListener::InitDialog()
|
|||
if (mURL) {
|
||||
nsCAutoString spec;
|
||||
mURL->GetSpec(spec);
|
||||
[mController setSourceURL: spec.get()];
|
||||
nsAutoString spec2; spec2.AssignWithConversion(spec.get());
|
||||
[mController setSourceURL: spec2.get()];
|
||||
}
|
||||
else {
|
||||
nsAutoString spec;
|
||||
mDocument->GetURL(spec);
|
||||
nsCAutoString spec2; spec2.AssignWithConversion(spec);
|
||||
[mController setSourceURL: spec2.get()];
|
||||
[mController setSourceURL: spec.get()];
|
||||
}
|
||||
}
|
||||
|
||||
nsCAutoString pathStr;
|
||||
nsAutoString pathStr;
|
||||
mDestination->GetPath(pathStr);
|
||||
[mController setDestination: pathStr.get()];
|
||||
|
||||
|
@ -261,14 +266,14 @@ static NSString *LeaveOpenToolbarItemIdentifier = @"Leave Open Toggle Toolbar I
|
|||
return mProgressBar;
|
||||
}
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource
|
||||
{
|
||||
[mFromField setStringValue: [NSString stringWithCString: aSource]];
|
||||
[mFromField setStringValue: [NSString stringWithCharacters:aSource length:nsCRT::strlen(aSource)]];
|
||||
}
|
||||
|
||||
-(void) setDestination: (const char*)aDestination
|
||||
-(void) setDestination: (const PRUnichar*)aDestination
|
||||
{
|
||||
[mToField setStringValue: [NSString stringWithCString: aDestination]];
|
||||
[mToField setStringValue: [NSString stringWithCharacters:aDestination length:nsCRT::strlen(aDestination)]];
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
|
|
|
@ -779,7 +779,7 @@ BookmarksService::AddObserver()
|
|||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
|
||||
profileDir->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
profileDir->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCAutoString bookmarksFileURL;
|
||||
NS_GetURLSpecFromFile(profileDir, bookmarksFileURL);
|
||||
|
@ -890,7 +890,7 @@ BookmarksService::FlushBookmarks()
|
|||
{
|
||||
nsCOMPtr<nsIFile> bookmarksFile;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(bookmarksFile));
|
||||
bookmarksFile->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
bookmarksFile->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCOMPtr<nsIOutputStream> outputStream;
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), bookmarksFile);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#import "BrowserWindowController.h"
|
||||
|
||||
class ContentClickListener : public nsIDOMMouseListener
|
||||
{
|
||||
|
@ -61,7 +62,7 @@ public:
|
|||
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
|
||||
private:
|
||||
id mBrowserController; // Our browser controller (weakly held)
|
||||
BrowserWindowController* mBrowserController; // Our browser controller (weakly held)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "nscore.h"
|
||||
|
||||
class nsIWebBrowserPersist;
|
||||
class nsISupports;
|
||||
|
@ -71,7 +72,7 @@ class nsDownloadListener;
|
|||
postData: (nsIInputStream*)aInputStream
|
||||
bypassCache: (BOOL)aBypassCache;
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource;
|
||||
-(void) setDestination: (const char*)aDestination;
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource;
|
||||
-(void) setDestination: (const PRUnichar*)aDestination;
|
||||
|
||||
@end
|
||||
|
|
|
@ -68,7 +68,12 @@ public:
|
|||
mURL = do_QueryInterface(aSource);
|
||||
if (!mURL)
|
||||
mDocument = do_QueryInterface(aSource);
|
||||
nsCAutoString dstStr = [aDestination cString];
|
||||
PRUint32 dstLen = [aDestination length];
|
||||
PRUnichar* tmp = new PRUnichar[dstLen + sizeof(PRUnichar)];
|
||||
tmp[dstLen] = (PRUnichar)'\0';
|
||||
[aDestination getCharacters:tmp];
|
||||
nsAutoString dstStr ( tmp );
|
||||
delete tmp;
|
||||
NS_NewLocalFile(dstStr, PR_FALSE, getter_AddRefs(mDestination));
|
||||
mContentType = aContentType;
|
||||
mPostData = aPostData;
|
||||
|
@ -174,17 +179,17 @@ nsDownloadListener::BeginDownload()
|
|||
// Create a local directory in the same dir as our file. It
|
||||
// will hold our associated files.
|
||||
filesFolder = do_CreateInstance("@mozilla.org/file/local;1");
|
||||
nsCAutoString unicodePath;
|
||||
nsAutoString unicodePath;
|
||||
mDestination->GetPath(unicodePath);
|
||||
filesFolder->InitWithPath(unicodePath);
|
||||
|
||||
nsCAutoString leafName;
|
||||
nsAutoString leafName;
|
||||
filesFolder->GetLeafName(leafName);
|
||||
nsCAutoString nameMinusExt(leafName);
|
||||
nsAutoString nameMinusExt(leafName);
|
||||
PRInt32 index = nameMinusExt.RFind(".");
|
||||
if (index >= 0)
|
||||
nameMinusExt.Left(nameMinusExt, index);
|
||||
nameMinusExt += " Files"; // XXXdwh needs to be localizable!
|
||||
nameMinusExt += NS_LITERAL_STRING(" Files"); // XXXdwh needs to be localizable!
|
||||
filesFolder->SetLeafName(nameMinusExt);
|
||||
PRBool exists = PR_FALSE;
|
||||
filesFolder->Exists(&exists);
|
||||
|
@ -214,17 +219,17 @@ nsDownloadListener::InitDialog()
|
|||
if (mURL) {
|
||||
nsCAutoString spec;
|
||||
mURL->GetSpec(spec);
|
||||
[mController setSourceURL: spec.get()];
|
||||
nsAutoString spec2; spec2.AssignWithConversion(spec.get());
|
||||
[mController setSourceURL: spec2.get()];
|
||||
}
|
||||
else {
|
||||
nsAutoString spec;
|
||||
mDocument->GetURL(spec);
|
||||
nsCAutoString spec2; spec2.AssignWithConversion(spec);
|
||||
[mController setSourceURL: spec2.get()];
|
||||
[mController setSourceURL: spec.get()];
|
||||
}
|
||||
}
|
||||
|
||||
nsCAutoString pathStr;
|
||||
nsAutoString pathStr;
|
||||
mDestination->GetPath(pathStr);
|
||||
[mController setDestination: pathStr.get()];
|
||||
|
||||
|
@ -261,14 +266,14 @@ static NSString *LeaveOpenToolbarItemIdentifier = @"Leave Open Toggle Toolbar I
|
|||
return mProgressBar;
|
||||
}
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource
|
||||
{
|
||||
[mFromField setStringValue: [NSString stringWithCString: aSource]];
|
||||
[mFromField setStringValue: [NSString stringWithCharacters:aSource length:nsCRT::strlen(aSource)]];
|
||||
}
|
||||
|
||||
-(void) setDestination: (const char*)aDestination
|
||||
-(void) setDestination: (const PRUnichar*)aDestination
|
||||
{
|
||||
[mToField setStringValue: [NSString stringWithCString: aDestination]];
|
||||
[mToField setStringValue: [NSString stringWithCharacters:aDestination length:nsCRT::strlen(aDestination)]];
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
|
|
|
@ -1205,10 +1205,10 @@ nsHeaderSniffer::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|||
nsCOMPtr<nsIFile> tmpFile;
|
||||
dirService->Get("TmpD", NS_GET_IID(nsIFile), getter_AddRefs(tmpFile));
|
||||
static short unsigned int tmpRandom = 0;
|
||||
nsCAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsCAutoString saveFile("-sav");
|
||||
nsAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsAutoString saveFile(NS_LITERAL_STRING("-sav"));
|
||||
saveFile += tmpNo;
|
||||
saveFile += "tmp";
|
||||
saveFile += NS_LITERAL_STRING("tmp");
|
||||
tmpFile->Append(saveFile);
|
||||
|
||||
// Get the post data if we're an HTML doc.
|
||||
|
|
|
@ -779,7 +779,7 @@ BookmarksService::AddObserver()
|
|||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
|
||||
profileDir->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
profileDir->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCAutoString bookmarksFileURL;
|
||||
NS_GetURLSpecFromFile(profileDir, bookmarksFileURL);
|
||||
|
@ -890,7 +890,7 @@ BookmarksService::FlushBookmarks()
|
|||
{
|
||||
nsCOMPtr<nsIFile> bookmarksFile;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(bookmarksFile));
|
||||
bookmarksFile->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
bookmarksFile->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCOMPtr<nsIOutputStream> outputStream;
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), bookmarksFile);
|
||||
|
|
|
@ -1205,10 +1205,10 @@ nsHeaderSniffer::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|||
nsCOMPtr<nsIFile> tmpFile;
|
||||
dirService->Get("TmpD", NS_GET_IID(nsIFile), getter_AddRefs(tmpFile));
|
||||
static short unsigned int tmpRandom = 0;
|
||||
nsCAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsCAutoString saveFile("-sav");
|
||||
nsAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsAutoString saveFile(NS_LITERAL_STRING("-sav"));
|
||||
saveFile += tmpNo;
|
||||
saveFile += "tmp";
|
||||
saveFile += NS_LITERAL_STRING("tmp");
|
||||
tmpFile->Append(saveFile);
|
||||
|
||||
// Get the post data if we're an HTML doc.
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __ContentClickListener_h__
|
||||
#define __ContentClickListener_h__
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include "nsIDOMMouseListener.h"
|
||||
|
||||
class ContentClickListener : public nsIDOMMouseListener
|
||||
{
|
||||
public:
|
||||
ContentClickListener(id aBrowserController);
|
||||
virtual ~ContentClickListener();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// The DOM mouse listener interface. We only care about clicks.
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
|
||||
private:
|
||||
id mBrowserController; // Our browser controller (weakly held)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "nscore.h"
|
||||
|
||||
class nsIWebBrowserPersist;
|
||||
class nsISupports;
|
||||
|
@ -71,7 +72,7 @@ class nsDownloadListener;
|
|||
postData: (nsIInputStream*)aInputStream
|
||||
bypassCache: (BOOL)aBypassCache;
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource;
|
||||
-(void) setDestination: (const char*)aDestination;
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource;
|
||||
-(void) setDestination: (const PRUnichar*)aDestination;
|
||||
|
||||
@end
|
||||
|
|
|
@ -68,7 +68,12 @@ public:
|
|||
mURL = do_QueryInterface(aSource);
|
||||
if (!mURL)
|
||||
mDocument = do_QueryInterface(aSource);
|
||||
nsCAutoString dstStr = [aDestination cString];
|
||||
PRUint32 dstLen = [aDestination length];
|
||||
PRUnichar* tmp = new PRUnichar[dstLen + sizeof(PRUnichar)];
|
||||
tmp[dstLen] = (PRUnichar)'\0';
|
||||
[aDestination getCharacters:tmp];
|
||||
nsAutoString dstStr ( tmp );
|
||||
delete tmp;
|
||||
NS_NewLocalFile(dstStr, PR_FALSE, getter_AddRefs(mDestination));
|
||||
mContentType = aContentType;
|
||||
mPostData = aPostData;
|
||||
|
@ -174,17 +179,17 @@ nsDownloadListener::BeginDownload()
|
|||
// Create a local directory in the same dir as our file. It
|
||||
// will hold our associated files.
|
||||
filesFolder = do_CreateInstance("@mozilla.org/file/local;1");
|
||||
nsCAutoString unicodePath;
|
||||
nsAutoString unicodePath;
|
||||
mDestination->GetPath(unicodePath);
|
||||
filesFolder->InitWithPath(unicodePath);
|
||||
|
||||
nsCAutoString leafName;
|
||||
nsAutoString leafName;
|
||||
filesFolder->GetLeafName(leafName);
|
||||
nsCAutoString nameMinusExt(leafName);
|
||||
nsAutoString nameMinusExt(leafName);
|
||||
PRInt32 index = nameMinusExt.RFind(".");
|
||||
if (index >= 0)
|
||||
nameMinusExt.Left(nameMinusExt, index);
|
||||
nameMinusExt += " Files"; // XXXdwh needs to be localizable!
|
||||
nameMinusExt += NS_LITERAL_STRING(" Files"); // XXXdwh needs to be localizable!
|
||||
filesFolder->SetLeafName(nameMinusExt);
|
||||
PRBool exists = PR_FALSE;
|
||||
filesFolder->Exists(&exists);
|
||||
|
@ -214,17 +219,17 @@ nsDownloadListener::InitDialog()
|
|||
if (mURL) {
|
||||
nsCAutoString spec;
|
||||
mURL->GetSpec(spec);
|
||||
[mController setSourceURL: spec.get()];
|
||||
nsAutoString spec2; spec2.AssignWithConversion(spec.get());
|
||||
[mController setSourceURL: spec2.get()];
|
||||
}
|
||||
else {
|
||||
nsAutoString spec;
|
||||
mDocument->GetURL(spec);
|
||||
nsCAutoString spec2; spec2.AssignWithConversion(spec);
|
||||
[mController setSourceURL: spec2.get()];
|
||||
[mController setSourceURL: spec.get()];
|
||||
}
|
||||
}
|
||||
|
||||
nsCAutoString pathStr;
|
||||
nsAutoString pathStr;
|
||||
mDestination->GetPath(pathStr);
|
||||
[mController setDestination: pathStr.get()];
|
||||
|
||||
|
@ -261,14 +266,14 @@ static NSString *LeaveOpenToolbarItemIdentifier = @"Leave Open Toggle Toolbar I
|
|||
return mProgressBar;
|
||||
}
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource
|
||||
{
|
||||
[mFromField setStringValue: [NSString stringWithCString: aSource]];
|
||||
[mFromField setStringValue: [NSString stringWithCharacters:aSource length:nsCRT::strlen(aSource)]];
|
||||
}
|
||||
|
||||
-(void) setDestination: (const char*)aDestination
|
||||
-(void) setDestination: (const PRUnichar*)aDestination
|
||||
{
|
||||
[mToField setStringValue: [NSString stringWithCString: aDestination]];
|
||||
[mToField setStringValue: [NSString stringWithCharacters:aDestination length:nsCRT::strlen(aDestination)]];
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
|
|
|
@ -779,7 +779,7 @@ BookmarksService::AddObserver()
|
|||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
|
||||
profileDir->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
profileDir->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCAutoString bookmarksFileURL;
|
||||
NS_GetURLSpecFromFile(profileDir, bookmarksFileURL);
|
||||
|
@ -890,7 +890,7 @@ BookmarksService::FlushBookmarks()
|
|||
{
|
||||
nsCOMPtr<nsIFile> bookmarksFile;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(bookmarksFile));
|
||||
bookmarksFile->Append(NS_LITERAL_CSTRING("bookmarks.xml"));
|
||||
bookmarksFile->Append(NS_LITERAL_STRING("bookmarks.xml"));
|
||||
|
||||
nsCOMPtr<nsIOutputStream> outputStream;
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), bookmarksFile);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#import "BrowserWindowController.h"
|
||||
|
||||
class ContentClickListener : public nsIDOMMouseListener
|
||||
{
|
||||
|
@ -61,7 +62,7 @@ public:
|
|||
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
|
||||
private:
|
||||
id mBrowserController; // Our browser controller (weakly held)
|
||||
BrowserWindowController* mBrowserController; // Our browser controller (weakly held)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "nscore.h"
|
||||
|
||||
class nsIWebBrowserPersist;
|
||||
class nsISupports;
|
||||
|
@ -71,7 +72,7 @@ class nsDownloadListener;
|
|||
postData: (nsIInputStream*)aInputStream
|
||||
bypassCache: (BOOL)aBypassCache;
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource;
|
||||
-(void) setDestination: (const char*)aDestination;
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource;
|
||||
-(void) setDestination: (const PRUnichar*)aDestination;
|
||||
|
||||
@end
|
||||
|
|
|
@ -68,7 +68,12 @@ public:
|
|||
mURL = do_QueryInterface(aSource);
|
||||
if (!mURL)
|
||||
mDocument = do_QueryInterface(aSource);
|
||||
nsCAutoString dstStr = [aDestination cString];
|
||||
PRUint32 dstLen = [aDestination length];
|
||||
PRUnichar* tmp = new PRUnichar[dstLen + sizeof(PRUnichar)];
|
||||
tmp[dstLen] = (PRUnichar)'\0';
|
||||
[aDestination getCharacters:tmp];
|
||||
nsAutoString dstStr ( tmp );
|
||||
delete tmp;
|
||||
NS_NewLocalFile(dstStr, PR_FALSE, getter_AddRefs(mDestination));
|
||||
mContentType = aContentType;
|
||||
mPostData = aPostData;
|
||||
|
@ -174,17 +179,17 @@ nsDownloadListener::BeginDownload()
|
|||
// Create a local directory in the same dir as our file. It
|
||||
// will hold our associated files.
|
||||
filesFolder = do_CreateInstance("@mozilla.org/file/local;1");
|
||||
nsCAutoString unicodePath;
|
||||
nsAutoString unicodePath;
|
||||
mDestination->GetPath(unicodePath);
|
||||
filesFolder->InitWithPath(unicodePath);
|
||||
|
||||
nsCAutoString leafName;
|
||||
nsAutoString leafName;
|
||||
filesFolder->GetLeafName(leafName);
|
||||
nsCAutoString nameMinusExt(leafName);
|
||||
nsAutoString nameMinusExt(leafName);
|
||||
PRInt32 index = nameMinusExt.RFind(".");
|
||||
if (index >= 0)
|
||||
nameMinusExt.Left(nameMinusExt, index);
|
||||
nameMinusExt += " Files"; // XXXdwh needs to be localizable!
|
||||
nameMinusExt += NS_LITERAL_STRING(" Files"); // XXXdwh needs to be localizable!
|
||||
filesFolder->SetLeafName(nameMinusExt);
|
||||
PRBool exists = PR_FALSE;
|
||||
filesFolder->Exists(&exists);
|
||||
|
@ -214,17 +219,17 @@ nsDownloadListener::InitDialog()
|
|||
if (mURL) {
|
||||
nsCAutoString spec;
|
||||
mURL->GetSpec(spec);
|
||||
[mController setSourceURL: spec.get()];
|
||||
nsAutoString spec2; spec2.AssignWithConversion(spec.get());
|
||||
[mController setSourceURL: spec2.get()];
|
||||
}
|
||||
else {
|
||||
nsAutoString spec;
|
||||
mDocument->GetURL(spec);
|
||||
nsCAutoString spec2; spec2.AssignWithConversion(spec);
|
||||
[mController setSourceURL: spec2.get()];
|
||||
[mController setSourceURL: spec.get()];
|
||||
}
|
||||
}
|
||||
|
||||
nsCAutoString pathStr;
|
||||
nsAutoString pathStr;
|
||||
mDestination->GetPath(pathStr);
|
||||
[mController setDestination: pathStr.get()];
|
||||
|
||||
|
@ -261,14 +266,14 @@ static NSString *LeaveOpenToolbarItemIdentifier = @"Leave Open Toggle Toolbar I
|
|||
return mProgressBar;
|
||||
}
|
||||
|
||||
-(void) setSourceURL: (const char*)aSource
|
||||
-(void) setSourceURL: (const PRUnichar*)aSource
|
||||
{
|
||||
[mFromField setStringValue: [NSString stringWithCString: aSource]];
|
||||
[mFromField setStringValue: [NSString stringWithCharacters:aSource length:nsCRT::strlen(aSource)]];
|
||||
}
|
||||
|
||||
-(void) setDestination: (const char*)aDestination
|
||||
-(void) setDestination: (const PRUnichar*)aDestination
|
||||
{
|
||||
[mToField setStringValue: [NSString stringWithCString: aDestination]];
|
||||
[mToField setStringValue: [NSString stringWithCharacters:aDestination length:nsCRT::strlen(aDestination)]];
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
|
|
|
@ -1205,10 +1205,10 @@ nsHeaderSniffer::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|||
nsCOMPtr<nsIFile> tmpFile;
|
||||
dirService->Get("TmpD", NS_GET_IID(nsIFile), getter_AddRefs(tmpFile));
|
||||
static short unsigned int tmpRandom = 0;
|
||||
nsCAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsCAutoString saveFile("-sav");
|
||||
nsAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
|
||||
nsAutoString saveFile(NS_LITERAL_STRING("-sav"));
|
||||
saveFile += tmpNo;
|
||||
saveFile += "tmp";
|
||||
saveFile += NS_LITERAL_STRING("tmp");
|
||||
tmpFile->Append(saveFile);
|
||||
|
||||
// Get the post data if we're an HTML doc.
|
||||
|
|
Загрузка…
Ссылка в новой задаче