mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Whack string usage. Converted category on NSString to use references, added PRUnichar* method, and changed all uses to use these new methods.
This commit is contained in:
parent
b26f28e997
commit
22d2e7ef3c
@ -169,23 +169,23 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
NSString* bookmarkName = [NSString stringWith_nsAString: value];
|
||||||
[mNameField setStringValue: bookmarkName];
|
[mNameField setStringValue: bookmarkName];
|
||||||
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
||||||
[[self window] setTitle: infoForString];
|
[[self window] setTitle: infoForString];
|
||||||
|
|
||||||
if (!isGroup && !isFolder) {
|
if (!isGroup && !isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mLocationField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFolder) {
|
if (!isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mKeywordField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mDescriptionField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
|
|
||||||
mBookmarkItem = aBookmark;
|
mBookmarkItem = aBookmark;
|
||||||
}
|
}
|
||||||
|
@ -148,14 +148,14 @@
|
|||||||
|
|
||||||
// If no URL and title were specified, get them from the current page.
|
// If no URL and title were specified, get them from the current page.
|
||||||
if (aURL && aTitle) {
|
if (aURL && aTitle) {
|
||||||
[aURL assignTo_nsString:&href];
|
[aURL assignTo_nsAString:href];
|
||||||
[aTitle assignTo_nsString:&title];
|
[aTitle assignTo_nsAString:title];
|
||||||
} else {
|
} else {
|
||||||
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
||||||
title, href);
|
title, href);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCachedHref = [NSString stringWithCharacters: href.get() length: href.Length()];
|
mCachedHref = [NSString stringWith_nsAString: href];
|
||||||
[mCachedHref retain];
|
[mCachedHref retain];
|
||||||
|
|
||||||
} else { // Folder
|
} else { // Folder
|
||||||
@ -164,7 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
||||||
NSString* bookmarkTitle = [NSString stringWithCharacters: title.get() length: title.Length()];
|
NSString* bookmarkTitle = [NSString stringWith_nsAString: title];
|
||||||
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
[textField setStringValue: cleanedTitle];
|
[textField setStringValue: cleanedTitle];
|
||||||
@ -214,7 +214,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString title;
|
nsAutoString title;
|
||||||
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
|
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsAString:title];
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
@ -232,7 +232,7 @@
|
|||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
[mCachedHref assignTo_nsString:&href];
|
[mCachedHref assignTo_nsAString:href];
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
@ -521,7 +521,7 @@
|
|||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: nameAttr.get() length: nameAttr.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString: nameAttr]];
|
||||||
|
|
||||||
//Create an attributed string to hold the empty attachment, then release the components.
|
//Create an attributed string to hold the empty attachment, then release the components.
|
||||||
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
||||||
@ -682,7 +682,7 @@
|
|||||||
|
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
descStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
descStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
// Only description for folders
|
// Only description for folders
|
||||||
if ([item isFolder])
|
if ([item isFolder])
|
||||||
@ -691,7 +691,7 @@
|
|||||||
// Extract the URL from the item
|
// Extract the URL from the item
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
hrefStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
hrefStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
if (!hrefStr)
|
if (!hrefStr)
|
||||||
return descStr;
|
return descStr;
|
||||||
@ -735,7 +735,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -759,7 +759,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -865,7 +865,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
||||||
NSString* info = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* info = [NSString stringWith_nsAString: href];
|
||||||
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +875,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
return [NSString stringWithCharacters: href.get() length: href.Length()];
|
return [NSString stringWith_nsAString: href];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setContentNode: (nsIContent*)aContentNode
|
-(void)setContentNode: (nsIContent*)aContentNode
|
||||||
|
@ -287,8 +287,7 @@ BookmarksService::BookmarkChanged(nsIContent* aItem, bool shouldFlush = true)
|
|||||||
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
[childItem setTitle: [NSString stringWith_nsAString: name]];
|
||||||
[childItem setTitle: title];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -741,7 +740,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||||||
{
|
{
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
NSString* title = [NSString stringWith_nsAString: name];
|
||||||
|
|
||||||
// Create a menu or menu item for the child.
|
// Create a menu or menu item for the child.
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
@ -806,7 +805,7 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[aController loadURL:url referrer:nil];
|
[aController loadURL:url referrer:nil];
|
||||||
@ -1023,7 +1022,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
NSTabViewItem* tabViewItem = nil;
|
NSTabViewItem* tabViewItem = nil;
|
||||||
if (currentIndex >= total) {
|
if (currentIndex >= total) {
|
||||||
// We need to make a new tab.
|
// We need to make a new tab.
|
||||||
@ -1055,7 +1054,7 @@ NSString*
|
|||||||
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
||||||
{
|
{
|
||||||
nsAutoString keyword;
|
nsAutoString keyword;
|
||||||
[aKeyword assignTo_nsString:&keyword];
|
[aKeyword assignTo_nsAString:keyword];
|
||||||
|
|
||||||
if (keyword.IsEmpty())
|
if (keyword.IsEmpty())
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
@ -1072,7 +1071,7 @@ BookmarksService::ResolveKeyword(NSString* aKeyword)
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
if (content) {
|
if (content) {
|
||||||
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
||||||
return [NSString stringWithCharacters: url.get() length: url.Length()];
|
return [NSString stringWith_nsAString: url];
|
||||||
}
|
}
|
||||||
return [NSString stringWithCString:""];
|
return [NSString stringWithCString:""];
|
||||||
}
|
}
|
||||||
@ -1217,8 +1216,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
|||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
|
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsAString:url];
|
||||||
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
|
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsAString:title];
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -866,12 +866,11 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMElement> linkContent;
|
nsCOMPtr<nsIDOMElement> linkContent;
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs\
|
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs(linkContent), href);
|
||||||
(linkContent), href);
|
|
||||||
nsAutoString linkText;
|
nsAutoString linkText;
|
||||||
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
||||||
NSString* urlStr = [NSString stringWithCharacters:href.get() length:href.Length()];
|
NSString* urlStr = [NSString stringWith_nsAString:href];
|
||||||
NSString* titleStr = [NSString stringWithCharacters:linkText.get() length:linkText.Length()];
|
NSString* titleStr = [NSString stringWith_nsAString:linkText];
|
||||||
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1294,7 +1293,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!pref)
|
if (!pref)
|
||||||
return; // Something bad happened if we can't get prefs.
|
return; // Something bad happened if we can't get prefs.
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString:&href];
|
NSString* hrefStr = [NSString stringWith_nsAString:href];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -1323,14 +1322,14 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!linkContent || href.IsEmpty())
|
if (!linkContent || href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &href];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// The user wants to save this link.
|
// The user wants to save this link.
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)saveImageAs:(id)aSender
|
- (IBAction)saveImageAs:(id)aSender
|
||||||
@ -1342,10 +1341,10 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &url];
|
NSString* hrefStr = [NSString stringWith_nsAString: url];
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,7 +1370,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* urlStr = [NSString stringWith_nsString: &url];
|
NSString* urlStr = [NSString stringWith_nsAString: url];
|
||||||
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
||||||
|
|
||||||
[self loadURL: urlStr referrer:referrer];
|
[self loadURL: urlStr referrer:referrer];
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#import "NSString+Utils.h"
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
@ -101,11 +103,11 @@
|
|||||||
} else if ([aColumn isEqualToString:@"col1"]) {
|
} else if ([aColumn isEqualToString:@"col1"]) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
item->GetValue(value);
|
item->GetValue(value);
|
||||||
result = [NSString stringWithCharacters:value.get() length:value.Length()];
|
result = [NSString stringWith_nsAString:value];
|
||||||
} else if ([aColumn isEqualToString:@"col2"]) {
|
} else if ([aColumn isEqualToString:@"col2"]) {
|
||||||
PRUnichar *comment;
|
nsXPIDLString commentStr;
|
||||||
item->GetComment(&comment);
|
item->GetComment(getter_Copies(commentStr));
|
||||||
result = [NSString stringWithCharacters:comment length:nsCRT::strlen(comment)];
|
result = [NSString stringWith_nsAString:commentStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
@ -85,7 +85,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -102,7 +102,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -218,13 +218,13 @@
|
|||||||
[self setTarget: self];
|
[self setTarget: self];
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
NSString* helpText = [NSString stringWith_nsString:&href];
|
NSString* helpText = [NSString stringWith_nsAString:href];
|
||||||
[self setToolTip: helpText];
|
[self setToolTip: helpText];
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
||||||
[self setTitle: [NSString stringWith_nsString: &name]];
|
[self setTitle: [NSString stringWith_nsAString: name]];
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
||||||
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
||||||
|
@ -224,7 +224,7 @@ nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const
|
|||||||
{
|
{
|
||||||
NSPoint where;
|
NSPoint where;
|
||||||
where.x = aXCoords; where.y = aYCoords;
|
where.x = aXCoords; where.y = aYCoords;
|
||||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
[mContainer onShowTooltip:where withText:[NSString stringWithPRUnichars:aTipText]];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ nsCocoaBrowserListener::SetStatus(PRUint32 statusType, const PRUnichar *status)
|
|||||||
|
|
||||||
NSString* str = nsnull;
|
NSString* str = nsnull;
|
||||||
if (status && (*status != PRUnichar(0))) {
|
if (status && (*status != PRUnichar(0))) {
|
||||||
str = [NSString stringWithCharacters:status length:nsCRT::strlen(status)];
|
str = [NSString stringWithPRUnichars:status];
|
||||||
}
|
}
|
||||||
|
|
||||||
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
||||||
@ -537,7 +537,7 @@ nsCocoaBrowserListener::SetTitle(const PRUnichar * aTitle)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* str = [NSString stringWithCharacters:aTitle length:nsCRT::strlen(aTitle)];
|
NSString* str = [NSString stringWithPRUnichars:aTitle];
|
||||||
[mContainer setTitle:str];
|
[mContainer setTitle:str];
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -629,7 +629,7 @@ NS_IMETHODIMP
|
|||||||
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
||||||
const PRUnichar *aMessage)
|
const PRUnichar *aMessage)
|
||||||
{
|
{
|
||||||
NSString* str = [NSString stringWithCharacters:aMessage length:nsCRT::strlen(aMessage)];
|
NSString* str = [NSString stringWithPRUnichars:aMessage];
|
||||||
|
|
||||||
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
||||||
id<NSBrowserListener> obj;
|
id<NSBrowserListener> obj;
|
||||||
@ -1079,7 +1079,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
return @"";
|
return @"";
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
||||||
@ -1270,11 +1270,10 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
nsDoc->GetLocation(getter_AddRefs(location));
|
nsDoc->GetLocation(getter_AddRefs(location));
|
||||||
if (!location)
|
if (!location)
|
||||||
return empty;
|
return empty;
|
||||||
|
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
|
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
|
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
bookmarkElt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
bookmarkElt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
NSString* url = [NSString stringWith_nsString: &href];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
nsAutoString group;
|
nsAutoString group;
|
||||||
bookmarkElt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
bookmarkElt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||||
|
@ -129,9 +129,9 @@ static const NSString *kEllipsis = @"...";
|
|||||||
nsCOMPtr<nsIHistoryEntry> entry;
|
nsCOMPtr<nsIHistoryEntry> entry;
|
||||||
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
||||||
|
|
||||||
PRUnichar *text;
|
nsXPIDLString textStr;
|
||||||
entry->GetTitle(&text);
|
entry->GetTitle(getter_Copies(textStr));
|
||||||
NSString* title = [NSString stringWithCharacters: text length: nsCRT::strlen(text)];
|
NSString* title = [NSString stringWith_nsAString: textStr];
|
||||||
|
|
||||||
// if the title is too long, crop it in the middle
|
// if the title is too long, crop it in the middle
|
||||||
if ([title length] > kMaxTitleLength) {
|
if ([title length] > kMaxTitleLength) {
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: literalValue.get() length:literalValue.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString:literalValue]];
|
||||||
|
|
||||||
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: literalValue.get() length: literalValue.Length()];
|
NSString* url = [NSString stringWith_nsAString: literalValue];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
|
@ -57,8 +57,8 @@
|
|||||||
BookmarksService::GetTitleAndHrefForBrowserView(
|
BookmarksService::GetTitleAndHrefForBrowserView(
|
||||||
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
||||||
|
|
||||||
NSString *url = [NSString stringWith_nsString: &hrefStr];
|
NSString *url = [NSString stringWith_nsAString: hrefStr];
|
||||||
NSString *title = [NSString stringWith_nsString: &titleStr];
|
NSString *title = [NSString stringWith_nsAString: titleStr];
|
||||||
|
|
||||||
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
return [NSString stringWithCharacters: literalValue.get() length:literalValue.Length()];
|
return [NSString stringWith_nsAString: literalValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
||||||
|
@ -70,8 +70,8 @@ CocoaPromptService::Alert(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
if (!window)
|
if (!window)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -94,9 +94,9 @@ CocoaPromptService::AlertCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -125,8 +125,8 @@ CocoaPromptService::Confirm(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
||||||
@ -147,9 +147,9 @@ CocoaPromptService::ConfirmCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -190,9 +190,9 @@ CocoaPromptService::ConfirmEx(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
||||||
@ -233,10 +233,11 @@ CocoaPromptService::Prompt(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* valueStr = [NSMutableString stringWithCharacters:*value length:(*value ? nsCRT::strlen(*value) : 0)];
|
|
||||||
|
NSMutableString* valueStr = [NSMutableString stringWithPRUnichars:*value];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -274,11 +275,11 @@ CocoaPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* userNameStr = [NSMutableString stringWithCharacters:*username length:(*username ? nsCRT::strlen(*username) : 0)];
|
NSMutableString* userNameStr = [NSMutableString stringWithPRUnichars:*username];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -322,10 +323,10 @@ CocoaPromptService::PromptPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -412,7 +413,7 @@ CocoaPromptService::GetCommonDialogLocaleString(const char *key)
|
|||||||
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
||||||
if (NS_FAILED(rv)) return returnValue;
|
if (NS_FAILED(rv)) return returnValue;
|
||||||
|
|
||||||
returnValue = [NSString stringWithCharacters:string length:(string ? nsCRT::strlen(string) : 0)];
|
returnValue = [NSString stringWithPRUnichars:string];
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ CocoaPromptService::GetButtonStringFromFlags(PRUint32 btnFlags,
|
|||||||
btnStr = GetCommonDialogLocaleString("Revert");
|
btnStr = GetCommonDialogLocaleString("Revert");
|
||||||
break;
|
break;
|
||||||
case BUTTON_TITLE_IS_STRING:
|
case BUTTON_TITLE_IS_STRING:
|
||||||
btnStr = [NSString stringWithCharacters:btnTitle length:(btnTitle ? nsCRT::strlen(btnTitle) : 0)];
|
btnStr = [NSString stringWithPRUnichars:btnTitle];
|
||||||
}
|
}
|
||||||
|
|
||||||
return btnStr;
|
return btnStr;
|
||||||
|
@ -175,12 +175,12 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||||||
PRUint32 contentID;
|
PRUint32 contentID;
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||||
content->GetContentID(&contentID);
|
content->GetContentID(&contentID);
|
||||||
nsAutoString text;
|
|
||||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
||||||
|
nsAutoString text;
|
||||||
option->GetLabel(text);
|
option->GetLabel(text);
|
||||||
if (text.IsEmpty())
|
if (text.IsEmpty())
|
||||||
option->GetText(text);
|
option->GetText(text);
|
||||||
NSString* title = [NSString stringWith_nsString: &text];
|
NSString* title = [NSString stringWith_nsAString: text];
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
[menu addItem: menuItem];
|
[menu addItem: menuItem];
|
||||||
[menuItem setTag: contentID];
|
[menuItem setTag: contentID];
|
||||||
@ -281,7 +281,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
mouseEvent->GetShiftKey(&shiftKey);
|
mouseEvent->GetShiftKey(&shiftKey);
|
||||||
mouseEvent->GetAltKey(&altKey);
|
mouseEvent->GetAltKey(&altKey);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Hack to determine specific protocols handled by Chimera in the frontend
|
// Hack to determine specific protocols handled by Chimera in the frontend
|
||||||
// until I can determine why the general unknown protocol handler handoff
|
// until I can determine why the general unknown protocol handler handoff
|
||||||
@ -317,8 +317,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
CHGeckoUtils::GatherTextUnder(content, text);
|
CHGeckoUtils::GatherTextUnder(content, text);
|
||||||
|
|
||||||
[mBrowserController saveURL: nil filterList: nil
|
[mBrowserController saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
length: nsCRT::strlen(text.get())]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -36,14 +36,16 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "nscore.h"
|
||||||
|
|
||||||
class nsAString;
|
class nsAString;
|
||||||
|
|
||||||
// a category to extend NSString
|
// a category to extend NSString
|
||||||
@interface NSString (ChimeraStringUtils)
|
@interface NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString*)inString;
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString;
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString;
|
+ (id)stringWith_nsAString:(const nsAString&)inString;
|
||||||
|
- (void)assignTo_nsAString:(nsAString&)ioString;
|
||||||
|
|
||||||
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
||||||
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
||||||
|
@ -43,26 +43,29 @@
|
|||||||
|
|
||||||
@implementation NSString (ChimeraStringUtils)
|
@implementation NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString *)inString
|
|
||||||
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString
|
||||||
{
|
{
|
||||||
if (inString)
|
if (inString)
|
||||||
{
|
return [NSString stringWithCharacters:inString length:nsCRT::strlen(inString)];
|
||||||
nsPromiseFlatString flatString = PromiseFlatString(*inString);
|
|
||||||
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (id)stringWith_nsAString:(const nsAString&)inString
|
||||||
|
{
|
||||||
|
nsPromiseFlatString flatString = PromiseFlatString(inString);
|
||||||
|
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
||||||
|
}
|
||||||
|
|
||||||
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
||||||
|
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString
|
- (void)assignTo_nsAString:(nsAString&)ioString
|
||||||
{
|
{
|
||||||
if (!ioString) return;
|
|
||||||
|
|
||||||
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
||||||
PRUnichar* buffer = stackBuffer;
|
PRUnichar* buffer = stackBuffer;
|
||||||
|
|
||||||
|
// XXX maybe fix this to use SetLength(0), SetLength(len), and a writing iterator.
|
||||||
unsigned int len = [self length];
|
unsigned int len = [self length];
|
||||||
|
|
||||||
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
||||||
@ -73,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self getCharacters: buffer]; // does not null terminate
|
[self getCharacters: buffer]; // does not null terminate
|
||||||
ioString->Assign(buffer, len);
|
ioString.Assign(buffer, len);
|
||||||
|
|
||||||
if (buffer != stackBuffer)
|
if (buffer != stackBuffer)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
@ -247,7 +247,7 @@ nsCocoaBrowserService::Show(nsIHelperAppLauncher* inLauncher, nsISupports* inCon
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
||||||
{
|
{
|
||||||
NSString* filename = [NSString stringWithCharacters:aDefaultFile length:nsCRT::strlen(aDefaultFile)];
|
NSString* filename = [NSString stringWithPRUnichars:aDefaultFile];
|
||||||
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
||||||
|
|
||||||
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
||||||
|
@ -263,7 +263,7 @@ nsDownloadListener::InitDialog()
|
|||||||
|
|
||||||
nsAutoString pathStr;
|
nsAutoString pathStr;
|
||||||
mDestination->GetPath(pathStr);
|
mDestination->GetPath(pathStr);
|
||||||
[mDownloadDisplay setDestinationPath: [NSString stringWithCharacters:pathStr.get() length:pathStr.Length()]];
|
[mDownloadDisplay setDestinationPath: [NSString stringWith_nsAString:pathStr]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -169,23 +169,23 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
NSString* bookmarkName = [NSString stringWith_nsAString: value];
|
||||||
[mNameField setStringValue: bookmarkName];
|
[mNameField setStringValue: bookmarkName];
|
||||||
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
||||||
[[self window] setTitle: infoForString];
|
[[self window] setTitle: infoForString];
|
||||||
|
|
||||||
if (!isGroup && !isFolder) {
|
if (!isGroup && !isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mLocationField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFolder) {
|
if (!isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mKeywordField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mDescriptionField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
|
|
||||||
mBookmarkItem = aBookmark;
|
mBookmarkItem = aBookmark;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
@ -85,7 +85,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -102,7 +102,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -218,13 +218,13 @@
|
|||||||
[self setTarget: self];
|
[self setTarget: self];
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
NSString* helpText = [NSString stringWith_nsString:&href];
|
NSString* helpText = [NSString stringWith_nsAString:href];
|
||||||
[self setToolTip: helpText];
|
[self setToolTip: helpText];
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
||||||
[self setTitle: [NSString stringWith_nsString: &name]];
|
[self setTitle: [NSString stringWith_nsAString: name]];
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
||||||
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
||||||
|
@ -148,14 +148,14 @@
|
|||||||
|
|
||||||
// If no URL and title were specified, get them from the current page.
|
// If no URL and title were specified, get them from the current page.
|
||||||
if (aURL && aTitle) {
|
if (aURL && aTitle) {
|
||||||
[aURL assignTo_nsString:&href];
|
[aURL assignTo_nsAString:href];
|
||||||
[aTitle assignTo_nsString:&title];
|
[aTitle assignTo_nsAString:title];
|
||||||
} else {
|
} else {
|
||||||
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
||||||
title, href);
|
title, href);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCachedHref = [NSString stringWithCharacters: href.get() length: href.Length()];
|
mCachedHref = [NSString stringWith_nsAString: href];
|
||||||
[mCachedHref retain];
|
[mCachedHref retain];
|
||||||
|
|
||||||
} else { // Folder
|
} else { // Folder
|
||||||
@ -164,7 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
||||||
NSString* bookmarkTitle = [NSString stringWithCharacters: title.get() length: title.Length()];
|
NSString* bookmarkTitle = [NSString stringWith_nsAString: title];
|
||||||
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
[textField setStringValue: cleanedTitle];
|
[textField setStringValue: cleanedTitle];
|
||||||
@ -214,7 +214,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString title;
|
nsAutoString title;
|
||||||
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
|
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsAString:title];
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
@ -232,7 +232,7 @@
|
|||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
[mCachedHref assignTo_nsString:&href];
|
[mCachedHref assignTo_nsAString:href];
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
@ -521,7 +521,7 @@
|
|||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: nameAttr.get() length: nameAttr.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString: nameAttr]];
|
||||||
|
|
||||||
//Create an attributed string to hold the empty attachment, then release the components.
|
//Create an attributed string to hold the empty attachment, then release the components.
|
||||||
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
||||||
@ -682,7 +682,7 @@
|
|||||||
|
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
descStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
descStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
// Only description for folders
|
// Only description for folders
|
||||||
if ([item isFolder])
|
if ([item isFolder])
|
||||||
@ -691,7 +691,7 @@
|
|||||||
// Extract the URL from the item
|
// Extract the URL from the item
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
hrefStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
hrefStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
if (!hrefStr)
|
if (!hrefStr)
|
||||||
return descStr;
|
return descStr;
|
||||||
@ -735,7 +735,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -759,7 +759,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -865,7 +865,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
||||||
NSString* info = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* info = [NSString stringWith_nsAString: href];
|
||||||
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +875,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
return [NSString stringWithCharacters: href.get() length: href.Length()];
|
return [NSString stringWith_nsAString: href];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setContentNode: (nsIContent*)aContentNode
|
-(void)setContentNode: (nsIContent*)aContentNode
|
||||||
|
@ -287,8 +287,7 @@ BookmarksService::BookmarkChanged(nsIContent* aItem, bool shouldFlush = true)
|
|||||||
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
[childItem setTitle: [NSString stringWith_nsAString: name]];
|
||||||
[childItem setTitle: title];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -741,7 +740,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||||||
{
|
{
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
NSString* title = [NSString stringWith_nsAString: name];
|
||||||
|
|
||||||
// Create a menu or menu item for the child.
|
// Create a menu or menu item for the child.
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
@ -806,7 +805,7 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[aController loadURL:url referrer:nil];
|
[aController loadURL:url referrer:nil];
|
||||||
@ -1023,7 +1022,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
NSTabViewItem* tabViewItem = nil;
|
NSTabViewItem* tabViewItem = nil;
|
||||||
if (currentIndex >= total) {
|
if (currentIndex >= total) {
|
||||||
// We need to make a new tab.
|
// We need to make a new tab.
|
||||||
@ -1055,7 +1054,7 @@ NSString*
|
|||||||
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
||||||
{
|
{
|
||||||
nsAutoString keyword;
|
nsAutoString keyword;
|
||||||
[aKeyword assignTo_nsString:&keyword];
|
[aKeyword assignTo_nsAString:keyword];
|
||||||
|
|
||||||
if (keyword.IsEmpty())
|
if (keyword.IsEmpty())
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
@ -1072,7 +1071,7 @@ BookmarksService::ResolveKeyword(NSString* aKeyword)
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
if (content) {
|
if (content) {
|
||||||
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
||||||
return [NSString stringWithCharacters: url.get() length: url.Length()];
|
return [NSString stringWith_nsAString: url];
|
||||||
}
|
}
|
||||||
return [NSString stringWithCString:""];
|
return [NSString stringWithCString:""];
|
||||||
}
|
}
|
||||||
@ -1217,8 +1216,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
|||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
|
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsAString:url];
|
||||||
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
|
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsAString:title];
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#import "NSString+Utils.h"
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
@ -101,11 +103,11 @@
|
|||||||
} else if ([aColumn isEqualToString:@"col1"]) {
|
} else if ([aColumn isEqualToString:@"col1"]) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
item->GetValue(value);
|
item->GetValue(value);
|
||||||
result = [NSString stringWithCharacters:value.get() length:value.Length()];
|
result = [NSString stringWith_nsAString:value];
|
||||||
} else if ([aColumn isEqualToString:@"col2"]) {
|
} else if ([aColumn isEqualToString:@"col2"]) {
|
||||||
PRUnichar *comment;
|
nsXPIDLString commentStr;
|
||||||
item->GetComment(&comment);
|
item->GetComment(getter_Copies(commentStr));
|
||||||
result = [NSString stringWithCharacters:comment length:nsCRT::strlen(comment)];
|
result = [NSString stringWith_nsAString:commentStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -866,12 +866,11 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMElement> linkContent;
|
nsCOMPtr<nsIDOMElement> linkContent;
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs\
|
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs(linkContent), href);
|
||||||
(linkContent), href);
|
|
||||||
nsAutoString linkText;
|
nsAutoString linkText;
|
||||||
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
||||||
NSString* urlStr = [NSString stringWithCharacters:href.get() length:href.Length()];
|
NSString* urlStr = [NSString stringWith_nsAString:href];
|
||||||
NSString* titleStr = [NSString stringWithCharacters:linkText.get() length:linkText.Length()];
|
NSString* titleStr = [NSString stringWith_nsAString:linkText];
|
||||||
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1294,7 +1293,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!pref)
|
if (!pref)
|
||||||
return; // Something bad happened if we can't get prefs.
|
return; // Something bad happened if we can't get prefs.
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString:&href];
|
NSString* hrefStr = [NSString stringWith_nsAString:href];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -1323,14 +1322,14 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!linkContent || href.IsEmpty())
|
if (!linkContent || href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &href];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// The user wants to save this link.
|
// The user wants to save this link.
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)saveImageAs:(id)aSender
|
- (IBAction)saveImageAs:(id)aSender
|
||||||
@ -1342,10 +1341,10 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &url];
|
NSString* hrefStr = [NSString stringWith_nsAString: url];
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,7 +1370,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* urlStr = [NSString stringWith_nsString: &url];
|
NSString* urlStr = [NSString stringWith_nsAString: url];
|
||||||
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
||||||
|
|
||||||
[self loadURL: urlStr referrer:referrer];
|
[self loadURL: urlStr referrer:referrer];
|
||||||
|
@ -70,8 +70,8 @@ CocoaPromptService::Alert(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
if (!window)
|
if (!window)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -94,9 +94,9 @@ CocoaPromptService::AlertCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -125,8 +125,8 @@ CocoaPromptService::Confirm(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
||||||
@ -147,9 +147,9 @@ CocoaPromptService::ConfirmCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -190,9 +190,9 @@ CocoaPromptService::ConfirmEx(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
||||||
@ -233,10 +233,11 @@ CocoaPromptService::Prompt(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* valueStr = [NSMutableString stringWithCharacters:*value length:(*value ? nsCRT::strlen(*value) : 0)];
|
|
||||||
|
NSMutableString* valueStr = [NSMutableString stringWithPRUnichars:*value];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -274,11 +275,11 @@ CocoaPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* userNameStr = [NSMutableString stringWithCharacters:*username length:(*username ? nsCRT::strlen(*username) : 0)];
|
NSMutableString* userNameStr = [NSMutableString stringWithPRUnichars:*username];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -322,10 +323,10 @@ CocoaPromptService::PromptPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -412,7 +413,7 @@ CocoaPromptService::GetCommonDialogLocaleString(const char *key)
|
|||||||
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
||||||
if (NS_FAILED(rv)) return returnValue;
|
if (NS_FAILED(rv)) return returnValue;
|
||||||
|
|
||||||
returnValue = [NSString stringWithCharacters:string length:(string ? nsCRT::strlen(string) : 0)];
|
returnValue = [NSString stringWithPRUnichars:string];
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ CocoaPromptService::GetButtonStringFromFlags(PRUint32 btnFlags,
|
|||||||
btnStr = GetCommonDialogLocaleString("Revert");
|
btnStr = GetCommonDialogLocaleString("Revert");
|
||||||
break;
|
break;
|
||||||
case BUTTON_TITLE_IS_STRING:
|
case BUTTON_TITLE_IS_STRING:
|
||||||
btnStr = [NSString stringWithCharacters:btnTitle length:(btnTitle ? nsCRT::strlen(btnTitle) : 0)];
|
btnStr = [NSString stringWithPRUnichars:btnTitle];
|
||||||
}
|
}
|
||||||
|
|
||||||
return btnStr;
|
return btnStr;
|
||||||
|
@ -175,12 +175,12 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||||||
PRUint32 contentID;
|
PRUint32 contentID;
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||||
content->GetContentID(&contentID);
|
content->GetContentID(&contentID);
|
||||||
nsAutoString text;
|
|
||||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
||||||
|
nsAutoString text;
|
||||||
option->GetLabel(text);
|
option->GetLabel(text);
|
||||||
if (text.IsEmpty())
|
if (text.IsEmpty())
|
||||||
option->GetText(text);
|
option->GetText(text);
|
||||||
NSString* title = [NSString stringWith_nsString: &text];
|
NSString* title = [NSString stringWith_nsAString: text];
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
[menu addItem: menuItem];
|
[menu addItem: menuItem];
|
||||||
[menuItem setTag: contentID];
|
[menuItem setTag: contentID];
|
||||||
@ -281,7 +281,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
mouseEvent->GetShiftKey(&shiftKey);
|
mouseEvent->GetShiftKey(&shiftKey);
|
||||||
mouseEvent->GetAltKey(&altKey);
|
mouseEvent->GetAltKey(&altKey);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Hack to determine specific protocols handled by Chimera in the frontend
|
// Hack to determine specific protocols handled by Chimera in the frontend
|
||||||
// until I can determine why the general unknown protocol handler handoff
|
// until I can determine why the general unknown protocol handler handoff
|
||||||
@ -317,8 +317,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
CHGeckoUtils::GatherTextUnder(content, text);
|
CHGeckoUtils::GatherTextUnder(content, text);
|
||||||
|
|
||||||
[mBrowserController saveURL: nil filterList: nil
|
[mBrowserController saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
length: nsCRT::strlen(text.get())]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -129,9 +129,9 @@ static const NSString *kEllipsis = @"...";
|
|||||||
nsCOMPtr<nsIHistoryEntry> entry;
|
nsCOMPtr<nsIHistoryEntry> entry;
|
||||||
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
||||||
|
|
||||||
PRUnichar *text;
|
nsXPIDLString textStr;
|
||||||
entry->GetTitle(&text);
|
entry->GetTitle(getter_Copies(textStr));
|
||||||
NSString* title = [NSString stringWithCharacters: text length: nsCRT::strlen(text)];
|
NSString* title = [NSString stringWith_nsAString: textStr];
|
||||||
|
|
||||||
// if the title is too long, crop it in the middle
|
// if the title is too long, crop it in the middle
|
||||||
if ([title length] > kMaxTitleLength) {
|
if ([title length] > kMaxTitleLength) {
|
||||||
|
@ -57,8 +57,8 @@
|
|||||||
BookmarksService::GetTitleAndHrefForBrowserView(
|
BookmarksService::GetTitleAndHrefForBrowserView(
|
||||||
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
||||||
|
|
||||||
NSString *url = [NSString stringWith_nsString: &hrefStr];
|
NSString *url = [NSString stringWith_nsAString: hrefStr];
|
||||||
NSString *title = [NSString stringWith_nsString: &titleStr];
|
NSString *title = [NSString stringWith_nsAString: titleStr];
|
||||||
|
|
||||||
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ nsDownloadListener::InitDialog()
|
|||||||
|
|
||||||
nsAutoString pathStr;
|
nsAutoString pathStr;
|
||||||
mDestination->GetPath(pathStr);
|
mDestination->GetPath(pathStr);
|
||||||
[mDownloadDisplay setDestinationPath: [NSString stringWithCharacters:pathStr.get() length:pathStr.Length()]];
|
[mDownloadDisplay setDestinationPath: [NSString stringWith_nsAString:pathStr]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -247,7 +247,7 @@ nsCocoaBrowserService::Show(nsIHelperAppLauncher* inLauncher, nsISupports* inCon
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
||||||
{
|
{
|
||||||
NSString* filename = [NSString stringWithCharacters:aDefaultFile length:nsCRT::strlen(aDefaultFile)];
|
NSString* filename = [NSString stringWithPRUnichars:aDefaultFile];
|
||||||
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
||||||
|
|
||||||
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
||||||
|
@ -224,7 +224,7 @@ nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const
|
|||||||
{
|
{
|
||||||
NSPoint where;
|
NSPoint where;
|
||||||
where.x = aXCoords; where.y = aYCoords;
|
where.x = aXCoords; where.y = aYCoords;
|
||||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
[mContainer onShowTooltip:where withText:[NSString stringWithPRUnichars:aTipText]];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ nsCocoaBrowserListener::SetStatus(PRUint32 statusType, const PRUnichar *status)
|
|||||||
|
|
||||||
NSString* str = nsnull;
|
NSString* str = nsnull;
|
||||||
if (status && (*status != PRUnichar(0))) {
|
if (status && (*status != PRUnichar(0))) {
|
||||||
str = [NSString stringWithCharacters:status length:nsCRT::strlen(status)];
|
str = [NSString stringWithPRUnichars:status];
|
||||||
}
|
}
|
||||||
|
|
||||||
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
||||||
@ -537,7 +537,7 @@ nsCocoaBrowserListener::SetTitle(const PRUnichar * aTitle)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* str = [NSString stringWithCharacters:aTitle length:nsCRT::strlen(aTitle)];
|
NSString* str = [NSString stringWithPRUnichars:aTitle];
|
||||||
[mContainer setTitle:str];
|
[mContainer setTitle:str];
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -629,7 +629,7 @@ NS_IMETHODIMP
|
|||||||
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
||||||
const PRUnichar *aMessage)
|
const PRUnichar *aMessage)
|
||||||
{
|
{
|
||||||
NSString* str = [NSString stringWithCharacters:aMessage length:nsCRT::strlen(aMessage)];
|
NSString* str = [NSString stringWithPRUnichars:aMessage];
|
||||||
|
|
||||||
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
||||||
id<NSBrowserListener> obj;
|
id<NSBrowserListener> obj;
|
||||||
@ -1079,7 +1079,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
return @"";
|
return @"";
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
||||||
@ -1270,11 +1270,10 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
nsDoc->GetLocation(getter_AddRefs(location));
|
nsDoc->GetLocation(getter_AddRefs(location));
|
||||||
if (!location)
|
if (!location)
|
||||||
return empty;
|
return empty;
|
||||||
|
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
|
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
@ -36,14 +36,16 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "nscore.h"
|
||||||
|
|
||||||
class nsAString;
|
class nsAString;
|
||||||
|
|
||||||
// a category to extend NSString
|
// a category to extend NSString
|
||||||
@interface NSString (ChimeraStringUtils)
|
@interface NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString*)inString;
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString;
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString;
|
+ (id)stringWith_nsAString:(const nsAString&)inString;
|
||||||
|
- (void)assignTo_nsAString:(nsAString&)ioString;
|
||||||
|
|
||||||
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
||||||
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
||||||
|
@ -43,26 +43,29 @@
|
|||||||
|
|
||||||
@implementation NSString (ChimeraStringUtils)
|
@implementation NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString *)inString
|
|
||||||
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString
|
||||||
{
|
{
|
||||||
if (inString)
|
if (inString)
|
||||||
{
|
return [NSString stringWithCharacters:inString length:nsCRT::strlen(inString)];
|
||||||
nsPromiseFlatString flatString = PromiseFlatString(*inString);
|
|
||||||
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (id)stringWith_nsAString:(const nsAString&)inString
|
||||||
|
{
|
||||||
|
nsPromiseFlatString flatString = PromiseFlatString(inString);
|
||||||
|
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
||||||
|
}
|
||||||
|
|
||||||
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
||||||
|
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString
|
- (void)assignTo_nsAString:(nsAString&)ioString
|
||||||
{
|
{
|
||||||
if (!ioString) return;
|
|
||||||
|
|
||||||
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
||||||
PRUnichar* buffer = stackBuffer;
|
PRUnichar* buffer = stackBuffer;
|
||||||
|
|
||||||
|
// XXX maybe fix this to use SetLength(0), SetLength(len), and a writing iterator.
|
||||||
unsigned int len = [self length];
|
unsigned int len = [self length];
|
||||||
|
|
||||||
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
||||||
@ -73,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self getCharacters: buffer]; // does not null terminate
|
[self getCharacters: buffer]; // does not null terminate
|
||||||
ioString->Assign(buffer, len);
|
ioString.Assign(buffer, len);
|
||||||
|
|
||||||
if (buffer != stackBuffer)
|
if (buffer != stackBuffer)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
@ -263,7 +263,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
return [NSString stringWithCharacters: literalValue.get() length:literalValue.Length()];
|
return [NSString stringWith_nsAString: literalValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: literalValue.get() length:literalValue.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString:literalValue]];
|
||||||
|
|
||||||
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: literalValue.get() length: literalValue.Length()];
|
NSString* url = [NSString stringWith_nsAString: literalValue];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
|
@ -169,23 +169,23 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
NSString* bookmarkName = [NSString stringWith_nsAString: value];
|
||||||
[mNameField setStringValue: bookmarkName];
|
[mNameField setStringValue: bookmarkName];
|
||||||
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
||||||
[[self window] setTitle: infoForString];
|
[[self window] setTitle: infoForString];
|
||||||
|
|
||||||
if (!isGroup && !isFolder) {
|
if (!isGroup && !isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mLocationField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFolder) {
|
if (!isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mKeywordField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mDescriptionField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
|
|
||||||
mBookmarkItem = aBookmark;
|
mBookmarkItem = aBookmark;
|
||||||
}
|
}
|
||||||
|
@ -148,14 +148,14 @@
|
|||||||
|
|
||||||
// If no URL and title were specified, get them from the current page.
|
// If no URL and title were specified, get them from the current page.
|
||||||
if (aURL && aTitle) {
|
if (aURL && aTitle) {
|
||||||
[aURL assignTo_nsString:&href];
|
[aURL assignTo_nsAString:href];
|
||||||
[aTitle assignTo_nsString:&title];
|
[aTitle assignTo_nsAString:title];
|
||||||
} else {
|
} else {
|
||||||
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
||||||
title, href);
|
title, href);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCachedHref = [NSString stringWithCharacters: href.get() length: href.Length()];
|
mCachedHref = [NSString stringWith_nsAString: href];
|
||||||
[mCachedHref retain];
|
[mCachedHref retain];
|
||||||
|
|
||||||
} else { // Folder
|
} else { // Folder
|
||||||
@ -164,7 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
||||||
NSString* bookmarkTitle = [NSString stringWithCharacters: title.get() length: title.Length()];
|
NSString* bookmarkTitle = [NSString stringWith_nsAString: title];
|
||||||
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
[textField setStringValue: cleanedTitle];
|
[textField setStringValue: cleanedTitle];
|
||||||
@ -214,7 +214,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString title;
|
nsAutoString title;
|
||||||
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
|
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsAString:title];
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
@ -232,7 +232,7 @@
|
|||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
[mCachedHref assignTo_nsString:&href];
|
[mCachedHref assignTo_nsAString:href];
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
@ -521,7 +521,7 @@
|
|||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: nameAttr.get() length: nameAttr.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString: nameAttr]];
|
||||||
|
|
||||||
//Create an attributed string to hold the empty attachment, then release the components.
|
//Create an attributed string to hold the empty attachment, then release the components.
|
||||||
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
||||||
@ -682,7 +682,7 @@
|
|||||||
|
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
descStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
descStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
// Only description for folders
|
// Only description for folders
|
||||||
if ([item isFolder])
|
if ([item isFolder])
|
||||||
@ -691,7 +691,7 @@
|
|||||||
// Extract the URL from the item
|
// Extract the URL from the item
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
hrefStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
hrefStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
if (!hrefStr)
|
if (!hrefStr)
|
||||||
return descStr;
|
return descStr;
|
||||||
@ -735,7 +735,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -759,7 +759,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -865,7 +865,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
||||||
NSString* info = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* info = [NSString stringWith_nsAString: href];
|
||||||
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +875,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
return [NSString stringWithCharacters: href.get() length: href.Length()];
|
return [NSString stringWith_nsAString: href];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setContentNode: (nsIContent*)aContentNode
|
-(void)setContentNode: (nsIContent*)aContentNode
|
||||||
|
@ -287,8 +287,7 @@ BookmarksService::BookmarkChanged(nsIContent* aItem, bool shouldFlush = true)
|
|||||||
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
[childItem setTitle: [NSString stringWith_nsAString: name]];
|
||||||
[childItem setTitle: title];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -741,7 +740,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||||||
{
|
{
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
NSString* title = [NSString stringWith_nsAString: name];
|
||||||
|
|
||||||
// Create a menu or menu item for the child.
|
// Create a menu or menu item for the child.
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
@ -806,7 +805,7 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[aController loadURL:url referrer:nil];
|
[aController loadURL:url referrer:nil];
|
||||||
@ -1023,7 +1022,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
NSTabViewItem* tabViewItem = nil;
|
NSTabViewItem* tabViewItem = nil;
|
||||||
if (currentIndex >= total) {
|
if (currentIndex >= total) {
|
||||||
// We need to make a new tab.
|
// We need to make a new tab.
|
||||||
@ -1055,7 +1054,7 @@ NSString*
|
|||||||
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
||||||
{
|
{
|
||||||
nsAutoString keyword;
|
nsAutoString keyword;
|
||||||
[aKeyword assignTo_nsString:&keyword];
|
[aKeyword assignTo_nsAString:keyword];
|
||||||
|
|
||||||
if (keyword.IsEmpty())
|
if (keyword.IsEmpty())
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
@ -1072,7 +1071,7 @@ BookmarksService::ResolveKeyword(NSString* aKeyword)
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
if (content) {
|
if (content) {
|
||||||
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
||||||
return [NSString stringWithCharacters: url.get() length: url.Length()];
|
return [NSString stringWith_nsAString: url];
|
||||||
}
|
}
|
||||||
return [NSString stringWithCString:""];
|
return [NSString stringWithCString:""];
|
||||||
}
|
}
|
||||||
@ -1217,8 +1216,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
|||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
|
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsAString:url];
|
||||||
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
|
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsAString:title];
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -866,12 +866,11 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMElement> linkContent;
|
nsCOMPtr<nsIDOMElement> linkContent;
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs\
|
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs(linkContent), href);
|
||||||
(linkContent), href);
|
|
||||||
nsAutoString linkText;
|
nsAutoString linkText;
|
||||||
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
||||||
NSString* urlStr = [NSString stringWithCharacters:href.get() length:href.Length()];
|
NSString* urlStr = [NSString stringWith_nsAString:href];
|
||||||
NSString* titleStr = [NSString stringWithCharacters:linkText.get() length:linkText.Length()];
|
NSString* titleStr = [NSString stringWith_nsAString:linkText];
|
||||||
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1294,7 +1293,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!pref)
|
if (!pref)
|
||||||
return; // Something bad happened if we can't get prefs.
|
return; // Something bad happened if we can't get prefs.
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString:&href];
|
NSString* hrefStr = [NSString stringWith_nsAString:href];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -1323,14 +1322,14 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!linkContent || href.IsEmpty())
|
if (!linkContent || href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &href];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// The user wants to save this link.
|
// The user wants to save this link.
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)saveImageAs:(id)aSender
|
- (IBAction)saveImageAs:(id)aSender
|
||||||
@ -1342,10 +1341,10 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &url];
|
NSString* hrefStr = [NSString stringWith_nsAString: url];
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,7 +1370,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* urlStr = [NSString stringWith_nsString: &url];
|
NSString* urlStr = [NSString stringWith_nsAString: url];
|
||||||
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
||||||
|
|
||||||
[self loadURL: urlStr referrer:referrer];
|
[self loadURL: urlStr referrer:referrer];
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#import "NSString+Utils.h"
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
@ -101,11 +103,11 @@
|
|||||||
} else if ([aColumn isEqualToString:@"col1"]) {
|
} else if ([aColumn isEqualToString:@"col1"]) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
item->GetValue(value);
|
item->GetValue(value);
|
||||||
result = [NSString stringWithCharacters:value.get() length:value.Length()];
|
result = [NSString stringWith_nsAString:value];
|
||||||
} else if ([aColumn isEqualToString:@"col2"]) {
|
} else if ([aColumn isEqualToString:@"col2"]) {
|
||||||
PRUnichar *comment;
|
nsXPIDLString commentStr;
|
||||||
item->GetComment(&comment);
|
item->GetComment(getter_Copies(commentStr));
|
||||||
result = [NSString stringWithCharacters:comment length:nsCRT::strlen(comment)];
|
result = [NSString stringWith_nsAString:commentStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
@ -85,7 +85,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -102,7 +102,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -218,13 +218,13 @@
|
|||||||
[self setTarget: self];
|
[self setTarget: self];
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
NSString* helpText = [NSString stringWith_nsString:&href];
|
NSString* helpText = [NSString stringWith_nsAString:href];
|
||||||
[self setToolTip: helpText];
|
[self setToolTip: helpText];
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
||||||
[self setTitle: [NSString stringWith_nsString: &name]];
|
[self setTitle: [NSString stringWith_nsAString: name]];
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
||||||
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
||||||
|
@ -224,7 +224,7 @@ nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const
|
|||||||
{
|
{
|
||||||
NSPoint where;
|
NSPoint where;
|
||||||
where.x = aXCoords; where.y = aYCoords;
|
where.x = aXCoords; where.y = aYCoords;
|
||||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
[mContainer onShowTooltip:where withText:[NSString stringWithPRUnichars:aTipText]];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ nsCocoaBrowserListener::SetStatus(PRUint32 statusType, const PRUnichar *status)
|
|||||||
|
|
||||||
NSString* str = nsnull;
|
NSString* str = nsnull;
|
||||||
if (status && (*status != PRUnichar(0))) {
|
if (status && (*status != PRUnichar(0))) {
|
||||||
str = [NSString stringWithCharacters:status length:nsCRT::strlen(status)];
|
str = [NSString stringWithPRUnichars:status];
|
||||||
}
|
}
|
||||||
|
|
||||||
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
||||||
@ -537,7 +537,7 @@ nsCocoaBrowserListener::SetTitle(const PRUnichar * aTitle)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* str = [NSString stringWithCharacters:aTitle length:nsCRT::strlen(aTitle)];
|
NSString* str = [NSString stringWithPRUnichars:aTitle];
|
||||||
[mContainer setTitle:str];
|
[mContainer setTitle:str];
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -629,7 +629,7 @@ NS_IMETHODIMP
|
|||||||
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
||||||
const PRUnichar *aMessage)
|
const PRUnichar *aMessage)
|
||||||
{
|
{
|
||||||
NSString* str = [NSString stringWithCharacters:aMessage length:nsCRT::strlen(aMessage)];
|
NSString* str = [NSString stringWithPRUnichars:aMessage];
|
||||||
|
|
||||||
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
||||||
id<NSBrowserListener> obj;
|
id<NSBrowserListener> obj;
|
||||||
@ -1079,7 +1079,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
return @"";
|
return @"";
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
||||||
@ -1270,11 +1270,10 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
nsDoc->GetLocation(getter_AddRefs(location));
|
nsDoc->GetLocation(getter_AddRefs(location));
|
||||||
if (!location)
|
if (!location)
|
||||||
return empty;
|
return empty;
|
||||||
|
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
|
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
|
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
bookmarkElt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
bookmarkElt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
NSString* url = [NSString stringWith_nsString: &href];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
nsAutoString group;
|
nsAutoString group;
|
||||||
bookmarkElt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
bookmarkElt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||||
|
@ -129,9 +129,9 @@ static const NSString *kEllipsis = @"...";
|
|||||||
nsCOMPtr<nsIHistoryEntry> entry;
|
nsCOMPtr<nsIHistoryEntry> entry;
|
||||||
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
||||||
|
|
||||||
PRUnichar *text;
|
nsXPIDLString textStr;
|
||||||
entry->GetTitle(&text);
|
entry->GetTitle(getter_Copies(textStr));
|
||||||
NSString* title = [NSString stringWithCharacters: text length: nsCRT::strlen(text)];
|
NSString* title = [NSString stringWith_nsAString: textStr];
|
||||||
|
|
||||||
// if the title is too long, crop it in the middle
|
// if the title is too long, crop it in the middle
|
||||||
if ([title length] > kMaxTitleLength) {
|
if ([title length] > kMaxTitleLength) {
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: literalValue.get() length:literalValue.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString:literalValue]];
|
||||||
|
|
||||||
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: literalValue.get() length: literalValue.Length()];
|
NSString* url = [NSString stringWith_nsAString: literalValue];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
|
@ -57,8 +57,8 @@
|
|||||||
BookmarksService::GetTitleAndHrefForBrowserView(
|
BookmarksService::GetTitleAndHrefForBrowserView(
|
||||||
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
||||||
|
|
||||||
NSString *url = [NSString stringWith_nsString: &hrefStr];
|
NSString *url = [NSString stringWith_nsAString: hrefStr];
|
||||||
NSString *title = [NSString stringWith_nsString: &titleStr];
|
NSString *title = [NSString stringWith_nsAString: titleStr];
|
||||||
|
|
||||||
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
return [NSString stringWithCharacters: literalValue.get() length:literalValue.Length()];
|
return [NSString stringWith_nsAString: literalValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
||||||
|
@ -70,8 +70,8 @@ CocoaPromptService::Alert(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
if (!window)
|
if (!window)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -94,9 +94,9 @@ CocoaPromptService::AlertCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -125,8 +125,8 @@ CocoaPromptService::Confirm(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
||||||
@ -147,9 +147,9 @@ CocoaPromptService::ConfirmCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -190,9 +190,9 @@ CocoaPromptService::ConfirmEx(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
||||||
@ -233,10 +233,11 @@ CocoaPromptService::Prompt(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* valueStr = [NSMutableString stringWithCharacters:*value length:(*value ? nsCRT::strlen(*value) : 0)];
|
|
||||||
|
NSMutableString* valueStr = [NSMutableString stringWithPRUnichars:*value];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -274,11 +275,11 @@ CocoaPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* userNameStr = [NSMutableString stringWithCharacters:*username length:(*username ? nsCRT::strlen(*username) : 0)];
|
NSMutableString* userNameStr = [NSMutableString stringWithPRUnichars:*username];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -322,10 +323,10 @@ CocoaPromptService::PromptPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -412,7 +413,7 @@ CocoaPromptService::GetCommonDialogLocaleString(const char *key)
|
|||||||
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
||||||
if (NS_FAILED(rv)) return returnValue;
|
if (NS_FAILED(rv)) return returnValue;
|
||||||
|
|
||||||
returnValue = [NSString stringWithCharacters:string length:(string ? nsCRT::strlen(string) : 0)];
|
returnValue = [NSString stringWithPRUnichars:string];
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ CocoaPromptService::GetButtonStringFromFlags(PRUint32 btnFlags,
|
|||||||
btnStr = GetCommonDialogLocaleString("Revert");
|
btnStr = GetCommonDialogLocaleString("Revert");
|
||||||
break;
|
break;
|
||||||
case BUTTON_TITLE_IS_STRING:
|
case BUTTON_TITLE_IS_STRING:
|
||||||
btnStr = [NSString stringWithCharacters:btnTitle length:(btnTitle ? nsCRT::strlen(btnTitle) : 0)];
|
btnStr = [NSString stringWithPRUnichars:btnTitle];
|
||||||
}
|
}
|
||||||
|
|
||||||
return btnStr;
|
return btnStr;
|
||||||
|
@ -175,12 +175,12 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||||||
PRUint32 contentID;
|
PRUint32 contentID;
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||||
content->GetContentID(&contentID);
|
content->GetContentID(&contentID);
|
||||||
nsAutoString text;
|
|
||||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
||||||
|
nsAutoString text;
|
||||||
option->GetLabel(text);
|
option->GetLabel(text);
|
||||||
if (text.IsEmpty())
|
if (text.IsEmpty())
|
||||||
option->GetText(text);
|
option->GetText(text);
|
||||||
NSString* title = [NSString stringWith_nsString: &text];
|
NSString* title = [NSString stringWith_nsAString: text];
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
[menu addItem: menuItem];
|
[menu addItem: menuItem];
|
||||||
[menuItem setTag: contentID];
|
[menuItem setTag: contentID];
|
||||||
@ -281,7 +281,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
mouseEvent->GetShiftKey(&shiftKey);
|
mouseEvent->GetShiftKey(&shiftKey);
|
||||||
mouseEvent->GetAltKey(&altKey);
|
mouseEvent->GetAltKey(&altKey);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Hack to determine specific protocols handled by Chimera in the frontend
|
// Hack to determine specific protocols handled by Chimera in the frontend
|
||||||
// until I can determine why the general unknown protocol handler handoff
|
// until I can determine why the general unknown protocol handler handoff
|
||||||
@ -317,8 +317,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
CHGeckoUtils::GatherTextUnder(content, text);
|
CHGeckoUtils::GatherTextUnder(content, text);
|
||||||
|
|
||||||
[mBrowserController saveURL: nil filterList: nil
|
[mBrowserController saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
length: nsCRT::strlen(text.get())]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -36,14 +36,16 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "nscore.h"
|
||||||
|
|
||||||
class nsAString;
|
class nsAString;
|
||||||
|
|
||||||
// a category to extend NSString
|
// a category to extend NSString
|
||||||
@interface NSString (ChimeraStringUtils)
|
@interface NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString*)inString;
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString;
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString;
|
+ (id)stringWith_nsAString:(const nsAString&)inString;
|
||||||
|
- (void)assignTo_nsAString:(nsAString&)ioString;
|
||||||
|
|
||||||
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
||||||
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
||||||
|
@ -43,26 +43,29 @@
|
|||||||
|
|
||||||
@implementation NSString (ChimeraStringUtils)
|
@implementation NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString *)inString
|
|
||||||
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString
|
||||||
{
|
{
|
||||||
if (inString)
|
if (inString)
|
||||||
{
|
return [NSString stringWithCharacters:inString length:nsCRT::strlen(inString)];
|
||||||
nsPromiseFlatString flatString = PromiseFlatString(*inString);
|
|
||||||
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (id)stringWith_nsAString:(const nsAString&)inString
|
||||||
|
{
|
||||||
|
nsPromiseFlatString flatString = PromiseFlatString(inString);
|
||||||
|
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
||||||
|
}
|
||||||
|
|
||||||
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
||||||
|
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString
|
- (void)assignTo_nsAString:(nsAString&)ioString
|
||||||
{
|
{
|
||||||
if (!ioString) return;
|
|
||||||
|
|
||||||
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
||||||
PRUnichar* buffer = stackBuffer;
|
PRUnichar* buffer = stackBuffer;
|
||||||
|
|
||||||
|
// XXX maybe fix this to use SetLength(0), SetLength(len), and a writing iterator.
|
||||||
unsigned int len = [self length];
|
unsigned int len = [self length];
|
||||||
|
|
||||||
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
||||||
@ -73,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self getCharacters: buffer]; // does not null terminate
|
[self getCharacters: buffer]; // does not null terminate
|
||||||
ioString->Assign(buffer, len);
|
ioString.Assign(buffer, len);
|
||||||
|
|
||||||
if (buffer != stackBuffer)
|
if (buffer != stackBuffer)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
@ -247,7 +247,7 @@ nsCocoaBrowserService::Show(nsIHelperAppLauncher* inLauncher, nsISupports* inCon
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
||||||
{
|
{
|
||||||
NSString* filename = [NSString stringWithCharacters:aDefaultFile length:nsCRT::strlen(aDefaultFile)];
|
NSString* filename = [NSString stringWithPRUnichars:aDefaultFile];
|
||||||
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
||||||
|
|
||||||
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
||||||
|
@ -263,7 +263,7 @@ nsDownloadListener::InitDialog()
|
|||||||
|
|
||||||
nsAutoString pathStr;
|
nsAutoString pathStr;
|
||||||
mDestination->GetPath(pathStr);
|
mDestination->GetPath(pathStr);
|
||||||
[mDownloadDisplay setDestinationPath: [NSString stringWithCharacters:pathStr.get() length:pathStr.Length()]];
|
[mDownloadDisplay setDestinationPath: [NSString stringWith_nsAString:pathStr]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -169,23 +169,23 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
NSString* bookmarkName = [NSString stringWith_nsAString: value];
|
||||||
[mNameField setStringValue: bookmarkName];
|
[mNameField setStringValue: bookmarkName];
|
||||||
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
NSString* infoForString = [NSString stringWithFormat:NSLocalizedString(@"BookmarkInfoTitle",@"Info for "), bookmarkName];
|
||||||
[[self window] setTitle: infoForString];
|
[[self window] setTitle: infoForString];
|
||||||
|
|
||||||
if (!isGroup && !isFolder) {
|
if (!isGroup && !isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mLocationField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFolder) {
|
if (!isFolder) {
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mKeywordField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
}
|
}
|
||||||
|
|
||||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
[mDescriptionField setStringValue: [NSString stringWith_nsAString: value]];
|
||||||
|
|
||||||
mBookmarkItem = aBookmark;
|
mBookmarkItem = aBookmark;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
@ -85,7 +85,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -102,7 +102,7 @@
|
|||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString hrefAttr;
|
nsAutoString hrefAttr;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), hrefAttr);
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -218,13 +218,13 @@
|
|||||||
[self setTarget: self];
|
[self setTarget: self];
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
NSString* helpText = [NSString stringWith_nsString:&href];
|
NSString* helpText = [NSString stringWith_nsAString:href];
|
||||||
[self setToolTip: helpText];
|
[self setToolTip: helpText];
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
mElement->GetAttribute(NS_LITERAL_STRING("name"), name);
|
||||||
[self setTitle: [NSString stringWith_nsString: &name]];
|
[self setTitle: [NSString stringWith_nsAString: name]];
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
||||||
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
mBookmarkItem = BookmarksService::GetWrapperFor(content);
|
||||||
|
@ -148,14 +148,14 @@
|
|||||||
|
|
||||||
// If no URL and title were specified, get them from the current page.
|
// If no URL and title were specified, get them from the current page.
|
||||||
if (aURL && aTitle) {
|
if (aURL && aTitle) {
|
||||||
[aURL assignTo_nsString:&href];
|
[aURL assignTo_nsAString:href];
|
||||||
[aTitle assignTo_nsString:&title];
|
[aTitle assignTo_nsAString:title];
|
||||||
} else {
|
} else {
|
||||||
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
BookmarksService::GetTitleAndHrefForBrowserView([[mBrowserWindowController getBrowserWrapper] getBrowserView],
|
||||||
title, href);
|
title, href);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCachedHref = [NSString stringWithCharacters: href.get() length: href.Length()];
|
mCachedHref = [NSString stringWith_nsAString: href];
|
||||||
[mCachedHref retain];
|
[mCachedHref retain];
|
||||||
|
|
||||||
} else { // Folder
|
} else { // Folder
|
||||||
@ -164,7 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
NSTextField* textField = [mBrowserWindowController getAddBookmarkTitle];
|
||||||
NSString* bookmarkTitle = [NSString stringWithCharacters: title.get() length: title.Length()];
|
NSString* bookmarkTitle = [NSString stringWith_nsAString: title];
|
||||||
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString* cleanedTitle = [bookmarkTitle stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
[textField setStringValue: cleanedTitle];
|
[textField setStringValue: cleanedTitle];
|
||||||
@ -214,7 +214,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString title;
|
nsAutoString title;
|
||||||
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsString:&title];
|
[[[mBrowserWindowController getAddBookmarkTitle] stringValue] assignTo_nsAString:title];
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
@ -232,7 +232,7 @@
|
|||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
[mCachedHref assignTo_nsString:&href];
|
[mCachedHref assignTo_nsAString:href];
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer:nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
@ -521,7 +521,7 @@
|
|||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: nameAttr.get() length: nameAttr.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString: nameAttr]];
|
||||||
|
|
||||||
//Create an attributed string to hold the empty attachment, then release the components.
|
//Create an attributed string to hold the empty attachment, then release the components.
|
||||||
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
|
||||||
@ -682,7 +682,7 @@
|
|||||||
|
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
descStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
descStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
// Only description for folders
|
// Only description for folders
|
||||||
if ([item isFolder])
|
if ([item isFolder])
|
||||||
@ -691,7 +691,7 @@
|
|||||||
// Extract the URL from the item
|
// Extract the URL from the item
|
||||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||||
if (value.Length())
|
if (value.Length())
|
||||||
hrefStr = [NSString stringWithCharacters:value.get() length:value.Length()];
|
hrefStr = [NSString stringWith_nsAString:value];
|
||||||
|
|
||||||
if (!hrefStr)
|
if (!hrefStr)
|
||||||
return descStr;
|
return descStr;
|
||||||
@ -735,7 +735,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -759,7 +759,7 @@
|
|||||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr);
|
||||||
|
|
||||||
// stuff it into the string
|
// stuff it into the string
|
||||||
NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString:hrefAttr];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -865,7 +865,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
element->GetAttribute(NS_LITERAL_STRING("name"), href);
|
||||||
NSString* info = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* info = [NSString stringWith_nsAString: href];
|
||||||
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
return [NSString stringWithFormat:@"<BookmarkItem, name = \"%@\">", info];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +875,7 @@
|
|||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(item));
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
element->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
return [NSString stringWithCharacters: href.get() length: href.Length()];
|
return [NSString stringWith_nsAString: href];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setContentNode: (nsIContent*)aContentNode
|
-(void)setContentNode: (nsIContent*)aContentNode
|
||||||
|
@ -287,8 +287,7 @@ BookmarksService::BookmarkChanged(nsIContent* aItem, bool shouldFlush = true)
|
|||||||
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
NSMenuItem* childItem = [menu itemWithTag: contentID];
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aItem->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
[childItem setTitle: [NSString stringWith_nsAString: name]];
|
||||||
[childItem setTitle: title];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -741,7 +740,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||||||
{
|
{
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
aChild->GetAttr(kNameSpaceID_None, gNameAtom, name);
|
||||||
NSString* title = [NSString stringWithCharacters: name.get() length: name.Length()];
|
NSString* title = [NSString stringWith_nsAString: name];
|
||||||
|
|
||||||
// Create a menu or menu item for the child.
|
// Create a menu or menu item for the child.
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
@ -806,7 +805,7 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||||||
if (href.IsEmpty())
|
if (href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[aController loadURL:url referrer:nil];
|
[aController loadURL:url referrer:nil];
|
||||||
@ -1023,7 +1022,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
|
|||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
if (!href.IsEmpty()) {
|
if (!href.IsEmpty()) {
|
||||||
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* url = [NSString stringWith_nsAString: href];
|
||||||
NSTabViewItem* tabViewItem = nil;
|
NSTabViewItem* tabViewItem = nil;
|
||||||
if (currentIndex >= total) {
|
if (currentIndex >= total) {
|
||||||
// We need to make a new tab.
|
// We need to make a new tab.
|
||||||
@ -1055,7 +1054,7 @@ NSString*
|
|||||||
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
BookmarksService::ResolveKeyword(NSString* aKeyword)
|
||||||
{
|
{
|
||||||
nsAutoString keyword;
|
nsAutoString keyword;
|
||||||
[aKeyword assignTo_nsString:&keyword];
|
[aKeyword assignTo_nsAString:keyword];
|
||||||
|
|
||||||
if (keyword.IsEmpty())
|
if (keyword.IsEmpty())
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
@ -1072,7 +1071,7 @@ BookmarksService::ResolveKeyword(NSString* aKeyword)
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
if (content) {
|
if (content) {
|
||||||
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
content->GetAttr(kNameSpaceID_None, gHrefAtom, url);
|
||||||
return [NSString stringWithCharacters: url.get() length: url.Length()];
|
return [NSString stringWith_nsAString: url];
|
||||||
}
|
}
|
||||||
return [NSString stringWithCString:""];
|
return [NSString stringWithCString:""];
|
||||||
}
|
}
|
||||||
@ -1217,8 +1216,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
|||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsString:&url];
|
nsAutoString url; [[data objectForKey:@"url"] assignTo_nsAString:url];
|
||||||
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsString:&title];
|
nsAutoString title; [[data objectForKey:@"title"] assignTo_nsAString:title];
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#import "NSString+Utils.h"
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
@ -101,11 +103,11 @@
|
|||||||
} else if ([aColumn isEqualToString:@"col1"]) {
|
} else if ([aColumn isEqualToString:@"col1"]) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
item->GetValue(value);
|
item->GetValue(value);
|
||||||
result = [NSString stringWithCharacters:value.get() length:value.Length()];
|
result = [NSString stringWith_nsAString:value];
|
||||||
} else if ([aColumn isEqualToString:@"col2"]) {
|
} else if ([aColumn isEqualToString:@"col2"]) {
|
||||||
PRUnichar *comment;
|
nsXPIDLString commentStr;
|
||||||
item->GetComment(&comment);
|
item->GetComment(getter_Copies(commentStr));
|
||||||
result = [NSString stringWithCharacters:comment length:nsCRT::strlen(comment)];
|
result = [NSString stringWith_nsAString:commentStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -866,12 +866,11 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMElement> linkContent;
|
nsCOMPtr<nsIDOMElement> linkContent;
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs\
|
CHGeckoUtils::GetEnclosingLinkElementAndHref(mContextMenuNode, getter_AddRefs(linkContent), href);
|
||||||
(linkContent), href);
|
|
||||||
nsAutoString linkText;
|
nsAutoString linkText;
|
||||||
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
CHGeckoUtils::GatherTextUnder(linkContent, linkText);
|
||||||
NSString* urlStr = [NSString stringWithCharacters:href.get() length:href.Length()];
|
NSString* urlStr = [NSString stringWith_nsAString:href];
|
||||||
NSString* titleStr = [NSString stringWithCharacters:linkText.get() length:linkText.Length()];
|
NSString* titleStr = [NSString stringWith_nsAString:linkText];
|
||||||
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
[self addBookmarkExtended:YES isFolder:NO URL:urlStr title:titleStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1294,7 +1293,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!pref)
|
if (!pref)
|
||||||
return; // Something bad happened if we can't get prefs.
|
return; // Something bad happened if we can't get prefs.
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString:&href];
|
NSString* hrefStr = [NSString stringWith_nsAString:href];
|
||||||
|
|
||||||
PRBool loadInBackground;
|
PRBool loadInBackground;
|
||||||
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
|
||||||
@ -1323,14 +1322,14 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
if (!linkContent || href.IsEmpty())
|
if (!linkContent || href.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &href];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// The user wants to save this link.
|
// The user wants to save this link.
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
CHGeckoUtils::GatherTextUnder(mContextMenuNode, text);
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)saveImageAs:(id)aSender
|
- (IBAction)saveImageAs:(id)aSender
|
||||||
@ -1342,10 +1341,10 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWith_nsString: &url];
|
NSString* hrefStr = [NSString stringWith_nsAString: url];
|
||||||
|
|
||||||
[self saveURL: nil filterList: nil
|
[self saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWith_nsString: &text]];
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,7 +1370,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
imgElement->GetSrc(url);
|
imgElement->GetSrc(url);
|
||||||
|
|
||||||
NSString* urlStr = [NSString stringWith_nsString: &url];
|
NSString* urlStr = [NSString stringWith_nsAString: url];
|
||||||
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
NSString* referrer = [[mBrowserView getBrowserView] getFocusedURLString];
|
||||||
|
|
||||||
[self loadURL: urlStr referrer:referrer];
|
[self loadURL: urlStr referrer:referrer];
|
||||||
|
@ -70,8 +70,8 @@ CocoaPromptService::Alert(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
if (!window)
|
if (!window)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -94,9 +94,9 @@ CocoaPromptService::AlertCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -125,8 +125,8 @@ CocoaPromptService::Confirm(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
|
||||||
@ -147,9 +147,9 @@ CocoaPromptService::ConfirmCheck(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -190,9 +190,9 @@ CocoaPromptService::ConfirmEx(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
NSWindow* window = GetNSWindowForDOMWindow(parent);
|
||||||
|
|
||||||
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
NSString* btn1Str = GetButtonStringFromFlags(buttonFlags, kButton0, button0Title);
|
||||||
@ -233,10 +233,11 @@ CocoaPromptService::Prompt(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* valueStr = [NSMutableString stringWithCharacters:*value length:(*value ? nsCRT::strlen(*value) : 0)];
|
|
||||||
|
NSMutableString* valueStr = [NSMutableString stringWithPRUnichars:*value];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -274,11 +275,11 @@ CocoaPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* userNameStr = [NSMutableString stringWithCharacters:*username length:(*username ? nsCRT::strlen(*username) : 0)];
|
NSMutableString* userNameStr = [NSMutableString stringWithPRUnichars:*username];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -322,10 +323,10 @@ CocoaPromptService::PromptPassword(nsIDOMWindow *parent,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
|
NSString* titleStr = [NSString stringWithPRUnichars:dialogTitle];
|
||||||
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
|
NSString* textStr = [NSString stringWithPRUnichars:text];
|
||||||
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
|
NSString* msgStr = [NSString stringWithPRUnichars:checkMsg];
|
||||||
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
|
NSMutableString* passwordStr = [NSMutableString stringWithPRUnichars:*password];
|
||||||
|
|
||||||
BOOL valueBool;
|
BOOL valueBool;
|
||||||
if (checkValue) {
|
if (checkValue) {
|
||||||
@ -412,7 +413,7 @@ CocoaPromptService::GetCommonDialogLocaleString(const char *key)
|
|||||||
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
rv = mCommonDialogStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(key).get(), getter_Copies(string));
|
||||||
if (NS_FAILED(rv)) return returnValue;
|
if (NS_FAILED(rv)) return returnValue;
|
||||||
|
|
||||||
returnValue = [NSString stringWithCharacters:string length:(string ? nsCRT::strlen(string) : 0)];
|
returnValue = [NSString stringWithPRUnichars:string];
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ CocoaPromptService::GetButtonStringFromFlags(PRUint32 btnFlags,
|
|||||||
btnStr = GetCommonDialogLocaleString("Revert");
|
btnStr = GetCommonDialogLocaleString("Revert");
|
||||||
break;
|
break;
|
||||||
case BUTTON_TITLE_IS_STRING:
|
case BUTTON_TITLE_IS_STRING:
|
||||||
btnStr = [NSString stringWithCharacters:btnTitle length:(btnTitle ? nsCRT::strlen(btnTitle) : 0)];
|
btnStr = [NSString stringWithPRUnichars:btnTitle];
|
||||||
}
|
}
|
||||||
|
|
||||||
return btnStr;
|
return btnStr;
|
||||||
|
@ -175,12 +175,12 @@ ContentClickListener::MouseDown(nsIDOMEvent* aEvent)
|
|||||||
PRUint32 contentID;
|
PRUint32 contentID;
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||||
content->GetContentID(&contentID);
|
content->GetContentID(&contentID);
|
||||||
nsAutoString text;
|
|
||||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(node));
|
||||||
|
nsAutoString text;
|
||||||
option->GetLabel(text);
|
option->GetLabel(text);
|
||||||
if (text.IsEmpty())
|
if (text.IsEmpty())
|
||||||
option->GetText(text);
|
option->GetText(text);
|
||||||
NSString* title = [NSString stringWith_nsString: &text];
|
NSString* title = [NSString stringWith_nsAString: text];
|
||||||
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
NSMenuItem* menuItem = [[[NSMenuItem alloc] initWithTitle: title action: NULL keyEquivalent: @""] autorelease];
|
||||||
[menu addItem: menuItem];
|
[menu addItem: menuItem];
|
||||||
[menuItem setTag: contentID];
|
[menuItem setTag: contentID];
|
||||||
@ -281,7 +281,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
mouseEvent->GetShiftKey(&shiftKey);
|
mouseEvent->GetShiftKey(&shiftKey);
|
||||||
mouseEvent->GetAltKey(&altKey);
|
mouseEvent->GetAltKey(&altKey);
|
||||||
|
|
||||||
NSString* hrefStr = [NSString stringWithCharacters: href.get() length: href.Length()];
|
NSString* hrefStr = [NSString stringWith_nsAString: href];
|
||||||
|
|
||||||
// Hack to determine specific protocols handled by Chimera in the frontend
|
// Hack to determine specific protocols handled by Chimera in the frontend
|
||||||
// until I can determine why the general unknown protocol handler handoff
|
// until I can determine why the general unknown protocol handler handoff
|
||||||
@ -317,8 +317,7 @@ ContentClickListener::MouseClick(nsIDOMEvent* aEvent)
|
|||||||
CHGeckoUtils::GatherTextUnder(content, text);
|
CHGeckoUtils::GatherTextUnder(content, text);
|
||||||
|
|
||||||
[mBrowserController saveURL: nil filterList: nil
|
[mBrowserController saveURL: nil filterList: nil
|
||||||
url: hrefStr suggestedFilename: [NSString stringWithCharacters: text.get()
|
url: hrefStr suggestedFilename: [NSString stringWith_nsAString: text]];
|
||||||
length: nsCRT::strlen(text.get())]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -129,9 +129,9 @@ static const NSString *kEllipsis = @"...";
|
|||||||
nsCOMPtr<nsIHistoryEntry> entry;
|
nsCOMPtr<nsIHistoryEntry> entry;
|
||||||
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
sessionHistory->GetEntryAtIndex(i, PR_FALSE, getter_AddRefs(entry));
|
||||||
|
|
||||||
PRUnichar *text;
|
nsXPIDLString textStr;
|
||||||
entry->GetTitle(&text);
|
entry->GetTitle(getter_Copies(textStr));
|
||||||
NSString* title = [NSString stringWithCharacters: text length: nsCRT::strlen(text)];
|
NSString* title = [NSString stringWith_nsAString: textStr];
|
||||||
|
|
||||||
// if the title is too long, crop it in the middle
|
// if the title is too long, crop it in the middle
|
||||||
if ([title length] > kMaxTitleLength) {
|
if ([title length] > kMaxTitleLength) {
|
||||||
|
@ -57,8 +57,8 @@
|
|||||||
BookmarksService::GetTitleAndHrefForBrowserView(
|
BookmarksService::GetTitleAndHrefForBrowserView(
|
||||||
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
[[[[self window] windowController] getBrowserWrapper] getBrowserView], titleStr, hrefStr);
|
||||||
|
|
||||||
NSString *url = [NSString stringWith_nsString: &hrefStr];
|
NSString *url = [NSString stringWith_nsAString: hrefStr];
|
||||||
NSString *title = [NSString stringWith_nsString: &titleStr];
|
NSString *title = [NSString stringWith_nsAString: titleStr];
|
||||||
|
|
||||||
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ nsDownloadListener::InitDialog()
|
|||||||
|
|
||||||
nsAutoString pathStr;
|
nsAutoString pathStr;
|
||||||
mDestination->GetPath(pathStr);
|
mDestination->GetPath(pathStr);
|
||||||
[mDownloadDisplay setDestinationPath: [NSString stringWithCharacters:pathStr.get() length:pathStr.Length()]];
|
[mDownloadDisplay setDestinationPath: [NSString stringWith_nsAString:pathStr]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -247,7 +247,7 @@ nsCocoaBrowserService::Show(nsIHelperAppLauncher* inLauncher, nsISupports* inCon
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
nsCocoaBrowserService::PromptForSaveToFile(nsISupports *aWindowContext, const PRUnichar *aDefaultFile, const PRUnichar *aSuggestedFileExtension, nsILocalFile **_retval)
|
||||||
{
|
{
|
||||||
NSString* filename = [NSString stringWithCharacters:aDefaultFile length:nsCRT::strlen(aDefaultFile)];
|
NSString* filename = [NSString stringWithPRUnichars:aDefaultFile];
|
||||||
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
NSSavePanel *thePanel = [NSSavePanel savePanel];
|
||||||
|
|
||||||
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
// Note: although the docs for NSSavePanel specifically state "path and filename can be empty strings, but
|
||||||
|
@ -224,7 +224,7 @@ nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const
|
|||||||
{
|
{
|
||||||
NSPoint where;
|
NSPoint where;
|
||||||
where.x = aXCoords; where.y = aYCoords;
|
where.x = aXCoords; where.y = aYCoords;
|
||||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
[mContainer onShowTooltip:where withText:[NSString stringWithPRUnichars:aTipText]];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ nsCocoaBrowserListener::SetStatus(PRUint32 statusType, const PRUnichar *status)
|
|||||||
|
|
||||||
NSString* str = nsnull;
|
NSString* str = nsnull;
|
||||||
if (status && (*status != PRUnichar(0))) {
|
if (status && (*status != PRUnichar(0))) {
|
||||||
str = [NSString stringWithCharacters:status length:nsCRT::strlen(status)];
|
str = [NSString stringWithPRUnichars:status];
|
||||||
}
|
}
|
||||||
|
|
||||||
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
[mContainer setStatus:str ofType:(NSStatusType)statusType];
|
||||||
@ -537,7 +537,7 @@ nsCocoaBrowserListener::SetTitle(const PRUnichar * aTitle)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* str = [NSString stringWithCharacters:aTitle length:nsCRT::strlen(aTitle)];
|
NSString* str = [NSString stringWithPRUnichars:aTitle];
|
||||||
[mContainer setTitle:str];
|
[mContainer setTitle:str];
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -629,7 +629,7 @@ NS_IMETHODIMP
|
|||||||
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
nsCocoaBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
|
||||||
const PRUnichar *aMessage)
|
const PRUnichar *aMessage)
|
||||||
{
|
{
|
||||||
NSString* str = [NSString stringWithCharacters:aMessage length:nsCRT::strlen(aMessage)];
|
NSString* str = [NSString stringWithPRUnichars:aMessage];
|
||||||
|
|
||||||
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
||||||
id<NSBrowserListener> obj;
|
id<NSBrowserListener> obj;
|
||||||
@ -1079,7 +1079,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
return @"";
|
return @"";
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
|
||||||
@ -1270,11 +1270,10 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
|||||||
nsDoc->GetLocation(getter_AddRefs(location));
|
nsDoc->GetLocation(getter_AddRefs(location));
|
||||||
if (!location)
|
if (!location)
|
||||||
return empty;
|
return empty;
|
||||||
|
|
||||||
nsAutoString urlStr;
|
nsAutoString urlStr;
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
return [NSString stringWith_nsAString: urlStr];
|
||||||
|
|
||||||
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
@ -36,14 +36,16 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "nscore.h"
|
||||||
|
|
||||||
class nsAString;
|
class nsAString;
|
||||||
|
|
||||||
// a category to extend NSString
|
// a category to extend NSString
|
||||||
@interface NSString (ChimeraStringUtils)
|
@interface NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString*)inString;
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString;
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString;
|
+ (id)stringWith_nsAString:(const nsAString&)inString;
|
||||||
|
- (void)assignTo_nsAString:(nsAString&)ioString;
|
||||||
|
|
||||||
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet;
|
||||||
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string;
|
||||||
|
@ -43,26 +43,29 @@
|
|||||||
|
|
||||||
@implementation NSString (ChimeraStringUtils)
|
@implementation NSString (ChimeraStringUtils)
|
||||||
|
|
||||||
+ (id)stringWith_nsString:(const nsAString *)inString
|
|
||||||
|
+ (id)stringWithPRUnichars:(const PRUnichar*)inString
|
||||||
{
|
{
|
||||||
if (inString)
|
if (inString)
|
||||||
{
|
return [NSString stringWithCharacters:inString length:nsCRT::strlen(inString)];
|
||||||
nsPromiseFlatString flatString = PromiseFlatString(*inString);
|
|
||||||
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return [NSString string];
|
return [NSString string];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (id)stringWith_nsAString:(const nsAString&)inString
|
||||||
|
{
|
||||||
|
nsPromiseFlatString flatString = PromiseFlatString(inString);
|
||||||
|
return [NSString stringWithCharacters:flatString.get() length:flatString.Length()];
|
||||||
|
}
|
||||||
|
|
||||||
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
#define ASSIGN_STACK_BUFFER_CHARACTERS 256
|
||||||
|
|
||||||
- (void)assignTo_nsString:(nsAString*)ioString
|
- (void)assignTo_nsAString:(nsAString&)ioString
|
||||||
{
|
{
|
||||||
if (!ioString) return;
|
|
||||||
|
|
||||||
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
PRUnichar stackBuffer[ASSIGN_STACK_BUFFER_CHARACTERS];
|
||||||
PRUnichar* buffer = stackBuffer;
|
PRUnichar* buffer = stackBuffer;
|
||||||
|
|
||||||
|
// XXX maybe fix this to use SetLength(0), SetLength(len), and a writing iterator.
|
||||||
unsigned int len = [self length];
|
unsigned int len = [self length];
|
||||||
|
|
||||||
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
if (len + 1 > ASSIGN_STACK_BUFFER_CHARACTERS)
|
||||||
@ -73,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self getCharacters: buffer]; // does not null terminate
|
[self getCharacters: buffer]; // does not null terminate
|
||||||
ioString->Assign(buffer, len);
|
ioString.Assign(buffer, len);
|
||||||
|
|
||||||
if (buffer != stackBuffer)
|
if (buffer != stackBuffer)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
@ -263,7 +263,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
return [NSString stringWithCharacters: literalValue.get() length:literalValue.Length()];
|
return [NSString stringWith_nsAString: literalValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
- (void) outlineView: (NSOutlineView*) aOutlineView setObjectValue: (id) aObject
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
//Set cell's textual contents
|
//Set cell's textual contents
|
||||||
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWithCharacters: literalValue.get() length:literalValue.Length()]];
|
[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString:literalValue]];
|
||||||
|
|
||||||
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
if ([columnPropertyURI isEqualToString: @"http://home.netscape.com/NC-rdf#Name"])
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@
|
|||||||
nsXPIDLString literalValue;
|
nsXPIDLString literalValue;
|
||||||
valueLiteral->GetValue(getter_Copies(literalValue));
|
valueLiteral->GetValue(getter_Copies(literalValue));
|
||||||
|
|
||||||
NSString* url = [NSString stringWithCharacters: literalValue.get() length: literalValue.Length()];
|
NSString* url = [NSString stringWith_nsAString: literalValue];
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] loadURI: url referrer: nil flags: NSLoadFlagsNone];
|
||||||
// Focus and activate our content area.
|
// Focus and activate our content area.
|
||||||
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
[[[mBrowserWindowController getBrowserWrapper] getBrowserView] setActive: YES];
|
||||||
|
Loading…
Reference in New Issue
Block a user