Fix to use new category on NSString for going to and from nsAStrings

This commit is contained in:
sfraser%netscape.com 2002-07-29 19:52:09 +00:00
Родитель 9c7daf5e57
Коммит b7ffac66f0
42 изменённых файлов: 426 добавлений и 90 удалений

Просмотреть файл

@ -148,8 +148,8 @@
// If no URL and title were specified, get them from the current page.
if (aURL && aTitle) {
NSStringTo_nsString(aURL, href);
NSStringTo_nsString(aTitle, title);
[aURL assignTo_nsString:&href];
[aTitle assignTo_nsString:&title];
} else {
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
title, href);
@ -214,7 +214,7 @@
}
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
nsAutoString tagName;
if (mCachedHref)
@ -232,7 +232,7 @@
if (mCachedHref) {
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref assignTo_nsString:&href];
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "BookmarksService.h"
#import "BookmarksDataSource.h"
@ -1053,10 +1055,10 @@ NSString*
BookmarksService::ResolveKeyword(NSString* aKeyword)
{
nsAutoString keyword;
NSStringTo_nsString(aKeyword, keyword);
[aKeyword assignTo_nsString:&keyword];
if (keyword.IsEmpty())
return [NSString stringWithCString:""];
return [NSString string];
#if DEBUG
NSLog(@"str = %s", keyword.get());
@ -1215,8 +1217,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

Просмотреть файл

@ -1,4 +1,39 @@
/* BrowserWindow */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import <Cocoa/Cocoa.h>

Просмотреть файл

@ -1,3 +1,40 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "BrowserWindow.h"
#import "BrowserWindowController.h"

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "BrowserWindowController.h"
#import "CHBrowserWrapper.h"
@ -1292,7 +1294,7 @@ static NSArray* sToolbarDefaults = nil;
if (!pref)
return; // Something bad happened if we can't get prefs.
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString:&href];
PRBool loadInBackground;
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
@ -1321,15 +1323,14 @@ static NSArray* sToolbarDefaults = nil;
if (!linkContent || href.IsEmpty())
return;
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString: &href];
// The user wants to save this link.
nsAutoString text;
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
- (IBAction)saveImageAs:(id)aSender
@ -1341,11 +1342,10 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* hrefStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* hrefStr = [NSString stringWith_nsString: &url];
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
}
@ -1371,7 +1371,7 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* urlStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* urlStr = [NSString stringWith_nsString: &url];
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
[self loadURL: urlStr referrer:referrer];

Просмотреть файл

@ -21,7 +21,9 @@
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
#import "NSString+Utils.h"
#import "CHBookmarksButton.h"
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
@ -30,6 +32,7 @@
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsCRT.h"
#import "BookmarkInfoController.h"
#import "BookmarksDataSource.h"
#import "BookmarksService.h"
@ -215,13 +218,13 @@
[self setTarget: self];
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
NSString* helpText = [NSString stringWithCharacters: href.get() length: nsCRT::strlen(href.get())];
NSString* helpText = [NSString stringWith_nsString:&href];
[self setToolTip: helpText];
}
nsAutoString name;
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
[self setTitle: [NSString stringWithCharacters: name.get() length: nsCRT::strlen(name.get())]];
[self setTitle: [NSString stringWith_nsString: &name]];
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
mBookmarkItem = BookmarksService::GetWrapperFor(content);

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "FindDlgController.h"
#import "nsCocoaBrowserService.h"

Просмотреть файл

@ -15,6 +15,8 @@
* The Initial Developer of the Original Code is Matt Judy.
*/
#import "NSString+Utils.h"
#import "CHExtendedTabView.h"
#import "BookmarksService.h"
#import "BookmarksDataSource.h"
@ -182,7 +184,7 @@
nsAutoString href;
bookmarkElt->GetAttribute(NS_LITERAL_STRING("href"), href);
NSString* url = [NSString stringWithCharacters: href.get() length: nsCRT::strlen(href.get())];
NSString* url = [NSString stringWith_nsString: &href];
nsAutoString group;
bookmarkElt->GetAttribute(NS_LITERAL_STRING("group"), group);

Просмотреть файл

@ -57,8 +57,8 @@
BookmarksService::GetTitleAndHrefForBrowserView(
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
NSString *url = [NSString stringWithCharacters: hrefStr.get() length: nsCRT::strlen(hrefStr.get())];
NSString *title = [NSString stringWithCharacters: titleStr.get() length: nsCRT::strlen(titleStr.get())];
NSString *url = [NSString stringWith_nsString: &hrefStr];
NSString *title = [NSString stringWith_nsString: &titleStr];
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "nsCocoaBrowserService.h"
#import "CocoaPromptService.h"

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#include "nsCOMPtr.h"
#include "ContentClickListener.h"
#include "nsIDOMEventTarget.h"
@ -178,7 +180,7 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
option->GetLabel(text);
if (text.IsEmpty())
option->GetText(text);
NSString* title = [NSString stringWithCharacters: text.get() length: nsCRT::strlen(text.get())];
NSString* title = [NSString stringWith_nsString: &text];
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
[menu addItem: menuItem];
[menuItem setTag: contentID];

Просмотреть файл

@ -21,7 +21,9 @@
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
#import "NSString+Utils.h"
#import "CHBookmarksButton.h"
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
@ -30,6 +32,7 @@
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsCRT.h"
#import "BookmarkInfoController.h"
#import "BookmarksDataSource.h"
#import "BookmarksService.h"
@ -215,13 +218,13 @@
[self setTarget: self];
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
NSString* helpText = [NSString stringWithCharacters: href.get() length: nsCRT::strlen(href.get())];
NSString* helpText = [NSString stringWith_nsString:&href];
[self setToolTip: helpText];
}
nsAutoString name;
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
[self setTitle: [NSString stringWithCharacters: name.get() length: nsCRT::strlen(name.get())]];
[self setTitle: [NSString stringWith_nsString: &name]];
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
mBookmarkItem = BookmarksService::GetWrapperFor(content);

Просмотреть файл

@ -148,8 +148,8 @@
// If no URL and title were specified, get them from the current page.
if (aURL && aTitle) {
NSStringTo_nsString(aURL, href);
NSStringTo_nsString(aTitle, title);
[aURL assignTo_nsString:&href];
[aTitle assignTo_nsString:&title];
} else {
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
title, href);
@ -214,7 +214,7 @@
}
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
nsAutoString tagName;
if (mCachedHref)
@ -232,7 +232,7 @@
if (mCachedHref) {
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref assignTo_nsString:&href];
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "BookmarksService.h"
#import "BookmarksDataSource.h"
@ -1053,10 +1055,10 @@ NSString*
BookmarksService::ResolveKeyword(NSString* aKeyword)
{
nsAutoString keyword;
NSStringTo_nsString(aKeyword, keyword);
[aKeyword assignTo_nsString:&keyword];
if (keyword.IsEmpty())
return [NSString stringWithCString:""];
return [NSString string];
#if DEBUG
NSLog(@"str = %s", keyword.get());
@ -1215,8 +1217,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

Просмотреть файл

@ -1,4 +1,39 @@
/* BrowserWindow */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import <Cocoa/Cocoa.h>

Просмотреть файл

@ -1,3 +1,40 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "BrowserWindow.h"
#import "BrowserWindowController.h"

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "BrowserWindowController.h"
#import "CHBrowserWrapper.h"
@ -1292,7 +1294,7 @@ static NSArray* sToolbarDefaults = nil;
if (!pref)
return; // Something bad happened if we can't get prefs.
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString:&href];
PRBool loadInBackground;
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
@ -1321,15 +1323,14 @@ static NSArray* sToolbarDefaults = nil;
if (!linkContent || href.IsEmpty())
return;
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString: &href];
// The user wants to save this link.
nsAutoString text;
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
- (IBAction)saveImageAs:(id)aSender
@ -1341,11 +1342,10 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* hrefStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* hrefStr = [NSString stringWith_nsString: &url];
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
}
@ -1371,7 +1371,7 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* urlStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* urlStr = [NSString stringWith_nsString: &url];
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
[self loadURL: urlStr referrer:referrer];

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "nsCocoaBrowserService.h"
#import "CocoaPromptService.h"

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#include "nsCOMPtr.h"
#include "ContentClickListener.h"
#include "nsIDOMEventTarget.h"
@ -178,7 +180,7 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
option->GetLabel(text);
if (text.IsEmpty())
option->GetText(text);
NSString* title = [NSString stringWithCharacters: text.get() length: nsCRT::strlen(text.get())];
NSString* title = [NSString stringWith_nsString: &text];
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
[menu addItem: menuItem];
[menuItem setTag: contentID];

Просмотреть файл

@ -57,8 +57,8 @@
BookmarksService::GetTitleAndHrefForBrowserView(
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
NSString *url = [NSString stringWithCharacters: hrefStr.get() length: nsCRT::strlen(hrefStr.get())];
NSString *title = [NSString stringWithCharacters: titleStr.get() length: nsCRT::strlen(titleStr.get())];
NSString *url = [NSString stringWith_nsString: &hrefStr];
NSString *title = [NSString stringWith_nsString: &titleStr];
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "FindDlgController.h"
#import "nsCocoaBrowserService.h"

Просмотреть файл

@ -148,8 +148,8 @@
// If no URL and title were specified, get them from the current page.
if (aURL && aTitle) {
NSStringTo_nsString(aURL, href);
NSStringTo_nsString(aTitle, title);
[aURL assignTo_nsString:&href];
[aTitle assignTo_nsString:&title];
} else {
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
title, href);
@ -214,7 +214,7 @@
}
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
nsAutoString tagName;
if (mCachedHref)
@ -232,7 +232,7 @@
if (mCachedHref) {
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref assignTo_nsString:&href];
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "BookmarksService.h"
#import "BookmarksDataSource.h"
@ -1053,10 +1055,10 @@ NSString*
BookmarksService::ResolveKeyword(NSString* aKeyword)
{
nsAutoString keyword;
NSStringTo_nsString(aKeyword, keyword);
[aKeyword assignTo_nsString:&keyword];
if (keyword.IsEmpty())
return [NSString stringWithCString:""];
return [NSString string];
#if DEBUG
NSLog(@"str = %s", keyword.get());
@ -1215,8 +1217,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

Просмотреть файл

@ -1,4 +1,39 @@
/* BrowserWindow */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import <Cocoa/Cocoa.h>

Просмотреть файл

@ -1,3 +1,40 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "BrowserWindow.h"
#import "BrowserWindowController.h"

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "BrowserWindowController.h"
#import "CHBrowserWrapper.h"
@ -1292,7 +1294,7 @@ static NSArray* sToolbarDefaults = nil;
if (!pref)
return; // Something bad happened if we can't get prefs.
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString:&href];
PRBool loadInBackground;
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
@ -1321,15 +1323,14 @@ static NSArray* sToolbarDefaults = nil;
if (!linkContent || href.IsEmpty())
return;
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString: &href];
// The user wants to save this link.
nsAutoString text;
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
- (IBAction)saveImageAs:(id)aSender
@ -1341,11 +1342,10 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* hrefStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* hrefStr = [NSString stringWith_nsString: &url];
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
}
@ -1371,7 +1371,7 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* urlStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* urlStr = [NSString stringWith_nsString: &url];
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
[self loadURL: urlStr referrer:referrer];

Просмотреть файл

@ -21,7 +21,9 @@
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
#import "NSString+Utils.h"
#import "CHBookmarksButton.h"
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
@ -30,6 +32,7 @@
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsCRT.h"
#import "BookmarkInfoController.h"
#import "BookmarksDataSource.h"
#import "BookmarksService.h"
@ -215,13 +218,13 @@
[self setTarget: self];
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
NSString* helpText = [NSString stringWithCharacters: href.get() length: nsCRT::strlen(href.get())];
NSString* helpText = [NSString stringWith_nsString:&href];
[self setToolTip: helpText];
}
nsAutoString name;
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
[self setTitle: [NSString stringWithCharacters: name.get() length: nsCRT::strlen(name.get())]];
[self setTitle: [NSString stringWith_nsString: &name]];
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
mBookmarkItem = BookmarksService::GetWrapperFor(content);

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "FindDlgController.h"
#import "nsCocoaBrowserService.h"

Просмотреть файл

@ -15,6 +15,8 @@
* The Initial Developer of the Original Code is Matt Judy.
*/
#import "NSString+Utils.h"
#import "CHExtendedTabView.h"
#import "BookmarksService.h"
#import "BookmarksDataSource.h"
@ -182,7 +184,7 @@
nsAutoString href;
bookmarkElt->GetAttribute(NS_LITERAL_STRING("href"), href);
NSString* url = [NSString stringWithCharacters: href.get() length: nsCRT::strlen(href.get())];
NSString* url = [NSString stringWith_nsString: &href];
nsAutoString group;
bookmarkElt->GetAttribute(NS_LITERAL_STRING("group"), group);

Просмотреть файл

@ -57,8 +57,8 @@
BookmarksService::GetTitleAndHrefForBrowserView(
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
NSString *url = [NSString stringWithCharacters: hrefStr.get() length: nsCRT::strlen(hrefStr.get())];
NSString *title = [NSString stringWithCharacters: titleStr.get() length: nsCRT::strlen(titleStr.get())];
NSString *url = [NSString stringWith_nsString: &hrefStr];
NSString *title = [NSString stringWith_nsString: &titleStr];
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "nsCocoaBrowserService.h"
#import "CocoaPromptService.h"

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#include "nsCOMPtr.h"
#include "ContentClickListener.h"
#include "nsIDOMEventTarget.h"
@ -178,7 +180,7 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
option->GetLabel(text);
if (text.IsEmpty())
option->GetText(text);
NSString* title = [NSString stringWithCharacters: text.get() length: nsCRT::strlen(text.get())];
NSString* title = [NSString stringWith_nsString: &text];
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
[menu addItem: menuItem];
[menuItem setTag: contentID];

Просмотреть файл

@ -21,7 +21,9 @@
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
#import "NSString+Utils.h"
#import "CHBookmarksButton.h"
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
@ -30,6 +32,7 @@
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsCRT.h"
#import "BookmarkInfoController.h"
#import "BookmarksDataSource.h"
#import "BookmarksService.h"
@ -215,13 +218,13 @@
[self setTarget: self];
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
NSString* helpText = [NSString stringWithCharacters: href.get() length: nsCRT::strlen(href.get())];
NSString* helpText = [NSString stringWith_nsString:&href];
[self setToolTip: helpText];
}
nsAutoString name;
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
[self setTitle: [NSString stringWithCharacters: name.get() length: nsCRT::strlen(name.get())]];
[self setTitle: [NSString stringWith_nsString: &name]];
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
mBookmarkItem = BookmarksService::GetWrapperFor(content);

Просмотреть файл

@ -148,8 +148,8 @@
// If no URL and title were specified, get them from the current page.
if (aURL && aTitle) {
NSStringTo_nsString(aURL, href);
NSStringTo_nsString(aTitle, title);
[aURL assignTo_nsString:&href];
[aTitle assignTo_nsString:&title];
} else {
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
title, href);
@ -214,7 +214,7 @@
}
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
nsAutoString tagName;
if (mCachedHref)
@ -232,7 +232,7 @@
if (mCachedHref) {
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref assignTo_nsString:&href];
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "BookmarksService.h"
#import "BookmarksDataSource.h"
@ -1053,10 +1055,10 @@ NSString*
BookmarksService::ResolveKeyword(NSString* aKeyword)
{
nsAutoString keyword;
NSStringTo_nsString(aKeyword, keyword);
[aKeyword assignTo_nsString:&keyword];
if (keyword.IsEmpty())
return [NSString stringWithCString:""];
return [NSString string];
#if DEBUG
NSLog(@"str = %s", keyword.get());
@ -1215,8 +1217,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

Просмотреть файл

@ -1,4 +1,39 @@
/* BrowserWindow */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import <Cocoa/Cocoa.h>

Просмотреть файл

@ -1,3 +1,40 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Chimera 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):
* Simon Fraser <sfraser@netscape.com>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "BrowserWindow.h"
#import "BrowserWindowController.h"

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "BrowserWindowController.h"
#import "CHBrowserWrapper.h"
@ -1292,7 +1294,7 @@ static NSArray* sToolbarDefaults = nil;
if (!pref)
return; // Something bad happened if we can't get prefs.
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString:&href];
PRBool loadInBackground;
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
@ -1321,15 +1323,14 @@ static NSArray* sToolbarDefaults = nil;
if (!linkContent || href.IsEmpty())
return;
NSString* hrefStr = [NSString stringWithCharacters: href.get() length:nsCRT::strlen(href.get())];
NSString* hrefStr = [NSString stringWith_nsString: &href];
// The user wants to save this link.
nsAutoString text;
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
- (IBAction)saveImageAs:(id)aSender
@ -1341,11 +1342,10 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* hrefStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* hrefStr = [NSString stringWith_nsString: &url];
[self saveURL: nil filterList: nil
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
length:nsCRT::strlen(text.get())]];
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
}
}
@ -1371,7 +1371,7 @@ static NSArray* sToolbarDefaults = nil;
nsAutoString url;
imgElement->GetSrc(url);
NSString* urlStr = [NSString stringWithCharacters: url.get() length:nsCRT::strlen(url.get())];
NSString* urlStr = [NSString stringWith_nsString: &url];
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
[self loadURL: urlStr referrer:referrer];

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "nsCocoaBrowserService.h"
#import "CocoaPromptService.h"

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#include "nsCOMPtr.h"
#include "ContentClickListener.h"
#include "nsIDOMEventTarget.h"
@ -178,7 +180,7 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
option->GetLabel(text);
if (text.IsEmpty())
option->GetText(text);
NSString* title = [NSString stringWithCharacters: text.get() length: nsCRT::strlen(text.get())];
NSString* title = [NSString stringWith_nsString: &text];
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
[menu addItem: menuItem];
[menuItem setTag: contentID];

Просмотреть файл

@ -57,8 +57,8 @@
BookmarksService::GetTitleAndHrefForBrowserView(
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
NSString *url = [NSString stringWithCharacters: hrefStr.get() length: nsCRT::strlen(hrefStr.get())];
NSString *title = [NSString stringWithCharacters: titleStr.get() length: nsCRT::strlen(titleStr.get())];
NSString *url = [NSString stringWith_nsString: &hrefStr];
NSString *title = [NSString stringWith_nsString: &titleStr];
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];

Просмотреть файл

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#import "NSString+Utils.h"
#import "CHBrowserView.h"
#import "FindDlgController.h"
#import "nsCocoaBrowserService.h"