Fixes crash when selecting text during URL load, adds undo/redo to url bar,

reduces the number of times we load about:blank to 1 per window, fixes
unicode characters in bookmarks. (bug 149198, 153263, 155710)
This commit is contained in:
pinkerton%netscape.com 2002-07-26 18:50:01 +00:00
Родитель f95e458789
Коммит 3e601834c0
70 изменённых файлов: 616 добавлений и 496 удалений

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

@ -206,8 +206,8 @@
isGroup = YES;
}
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
nsAutoString title; title.AssignWithConversion(titleC);
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
nsAutoString tagName;
if (mCachedHref)
@ -224,7 +224,8 @@
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
if (mCachedHref) {
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

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

@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

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

@ -4,7 +4,6 @@
@interface BrowserWindow : NSWindow
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;

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

@ -1,25 +1,8 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@implementation BrowserWindow
- (void)sendEvent:(NSEvent *)theEvent
{
// We need this hack because NSWindow::sendEvent will eat the escape key
// and won't pass it down to the key handler of responders in the window.
// We have to override sendEvent for all of our escape key needs.
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
if (fieldEditor && [self firstResponder] == fieldEditor) {
[mAutoCompleteTextField revertText];
}
} else
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];

47
camino/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -50,34 +50,34 @@
CLASS = BrowserWindowController;
LANGUAGE = ObjC;
OUTLETS = {
mAddBookmarkCheckbox = id;
mAddBookmarkFolderField = id;
mAddBookmarkSheetWindow = id;
mAddBookmarkTitleField = id;
mBackItem = id;
mAddBookmarkCheckbox = NSButton;
mAddBookmarkFolderField = NSPopUpButton;
mAddBookmarkSheetWindow = NSWindow;
mAddBookmarkTitleField = NSTextField;
mBackItem = NSMenuItem;
mCachedBMDS = id;
mForwardItem = id;
mHistoryDataSource = id;
mImageLinkMenu = id;
mImageMenu = id;
mInputMenu = id;
mLinkMenu = id;
mLocationSheetURLField = id;
mLocationSheetWindow = id;
mLocationToolbarView = id;
mForwardItem = NSMenuItem;
mHistoryDataSource = CHHistoryDataSource;
mImageLinkMenu = NSMenu;
mImageMenu = NSMenu;
mInputMenu = NSMenu;
mLinkMenu = NSMenu;
mLocationSheetURLField = NSTextField;
mLocationSheetWindow = NSWindow;
mLocationToolbarView = NSView;
mLock = NSImageView;
mPageMenu = id;
mPageMenu = NSMenu;
mPersonalToolbar = CHBookmarksToolbar;
mProgress = NSProgressIndicator;
mSidebarBookmarksDataSource = id;
mSidebarBookmarksDataSource = BookmarksDataSource;
mSidebarBrowserView = id;
mSidebarDrawer = NSDrawer;
mSidebarSourceTabView = id;
mSidebarTabView = id;
mSidebarSourceTabView = NSTabView;
mSidebarTabView = NSTabView;
mStatus = NSTextField;
mStatusBar = NSView;
mTabBrowser = id;
mURLBar = NSTextField;
mTabBrowser = CHExtendedTabView;
mURLBar = NSTextView;
};
SUPERCLASS = NSWindowController;
},
@ -89,6 +89,13 @@
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextField;
},
{
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
CLASS = CHAutoCompleteTextView;
LANGUAGE = ObjC;
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextView;
},
{
CLASS = CHBookmarksOutlineView;
LANGUAGE = ObjC;

9
camino/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>56 77 632 495 0 0 1152 746 </string>
<string>174 64 632 495 0 0 1152 848 </string>
<key>IBEditorPositions</key>
<dict>
<key>124</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>442 634 343 68 0 0 1280 1002 </string>
<string>403 587 360 76 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -43,10 +43,7 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>297</integer>
<integer>463</integer>
<integer>336</integer>
<integer>314</integer>
<integer>56</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
camino/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -86,7 +86,7 @@ class nsIDOMNode;
IBOutlet NSTabView* mSidebarTabView;
IBOutlet NSTabView* mSidebarSourceTabView;
IBOutlet NSView* mLocationToolbarView;
IBOutlet NSTextField* mURLBar;
IBOutlet NSTextView* mURLBar;
IBOutlet NSTextField* mStatus;
IBOutlet NSProgressIndicator* mProgress;
IBOutlet NSImageView* mLock;
@ -166,7 +166,6 @@ class nsIDOMNode;
- (void)performAppropriateLocationAction;
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
- (void)focusURLBar;
- (void)beginLocationSheet;
- (IBAction)endLocationSheet:(id)sender;
- (IBAction)cancelLocationSheet:(id)sender;
@ -175,6 +174,8 @@ class nsIDOMNode;
- (IBAction)endAddBookmarkSheet:(id)sender;
- (void)cacheBookmarkDS: (id)aDS;
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
- (IBAction)viewSource:(id)aSender;
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;

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

@ -271,9 +271,7 @@ static NSArray* sToolbarDefaults = nil;
// worry about retaining and releasing it.
[mProgress retain];
}
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
// Get our saved dimensions.
[[self window] setFrameUsingName: @"NavigatorWindow"];
@ -321,13 +319,20 @@ static NSArray* sToolbarDefaults = nil;
[mPersonalToolbar removeFromSuperview];
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
mPersonalToolbar = nil;
mPersonalToolbar = nil;
}
else if (![self shouldShowBookmarkToolbar]) {
[mPersonalToolbar showBookmarksToolbar:NO];
}
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
{
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
// return [[self window] frame].size;
return proposedFrameSize;
}
- (void)drawerWillOpen: (NSNotification*)aNotification
{
[mSidebarBookmarksDataSource ensureBookmarks];
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
- (void)focusURLBar
{
[mURLBar selectText: self];
[[self window] makeFirstResponder:mURLBar];
[mURLBar selectAll: self];
}
- (void)beginLocationSheet
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
- (IBAction)goToLocationFromToolbarURLField:(id)sender
{
// trim off any whitespace around url
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
CFStringTrimWhitespace((CFMutableStringRef)theURL);
[self loadURL:theURL referrer:nil];
[theURL release];
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
// Get the users preferred search engine from IC
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
if (!searchEngine || ([searchEngine length] == 0))
searchEngine = @"http://dmoz.org/";
}
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
}
*/
[mURLBar setStringValue:locationString];
[mURLBar setString:locationString];
[mLocationSheetURLField setStringValue:locationString];
[[self window] update];
[[self window] display];
// don't call [window display] here, no matter how much you might want
// to, because it forces a redraw of every view in the window and with a lot
// of tabs, it's dog slow.
// [[self window] display];
}
-(void)newTab:(BOOL)allowHomepage

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

@ -25,11 +25,10 @@
#import "CHAutoCompleteTextField.h"
#include "nsIAutoCompleteResults.h"
@class CHAutoCompleteTextField;
@class CHAutoCompleteTextView;
@interface CHAutoCompleteDataSource : NSObject
{
CHAutoCompleteTextField *mTextField;
NSImage *mIconImage;
NSString* mErrorMessage;

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

@ -29,7 +29,7 @@
@class CHAutoCompleteDataSource, CHPageProxyIcon;
@interface CHAutoCompleteTextField : NSTextField
@interface CHAutoCompleteTextView : NSTextView
{
IBOutlet CHPageProxyIcon *mProxyIcon;
NSWindow *mPopupWin;
@ -56,6 +56,7 @@
- (void) setSession:(NSString *)aSession;
- (NSString *) session;
- (void) setPageProxyIcon:(NSImage *)aImage;
- (NSTableView *) tableView;
- (int) visibleRows;

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

@ -19,6 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -31,14 +32,15 @@
static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
{
NS_INIT_REFCNT();
mTextField = aTextField;
mTextView = aTextView;
}
NS_DECL_ISUPPORTS
@ -49,22 +51,30 @@ public:
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
{
[mTextField dataReady:aResults status:aStatus];
[mTextView dataReady:aResults status:aStatus];
return NS_OK;
}
private:
CHAutoCompleteTextField *mTextField;
CHAutoCompleteTextView *mTextView;
};
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
////////////////////////////////////////////////////////////////////////
@implementation CHAutoCompleteTextField
@implementation CHAutoCompleteTextView
- (void) awakeFromNib
{
[self setAllowsUndo:YES];
[self setFieldEditor:YES];
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setUsesFontPanel:NO];
[self setRichText:NO];
[self setVerticallyResizable:NO];
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
NSTableColumn *column;
NSScrollView *scrollView;
NSCell *dataCell;
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
}
// get the origin of the location bar in coordinates of the root view
locationFrame = [[self superview] frame];
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
toView:[[[self window] contentView] superview]];
locationFrame = [[[[self superview] superview] superview] frame];
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
// get the height of the table view
winFrame = [[self window] frame];
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) completeResult:(int)aRow
{
NSRange matchRange;
NSText *text;
NSString *result1;
if (aRow < 0 && mSearchString) {
[self setStringValue:mSearchString];
[self setString:mSearchString];
} else {
if ([mDataSource rowCount] <= 0)
return;
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
#if 1
// fill in the textfield with the matching string
[self setStringValue:result1];
[self setString:result1];
// select the text after the search string
text = [[self window] fieldEditor:NO forObject:self];
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
#endif
}
}
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) enterResult:(int)aRow
{
if (aRow >= 0 && [mDataSource rowCount] > 0) {
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectText:self];
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectAll:self];
[self closePopup];
} else if (mOpenTimer) {
// if there was a search timer going when we hit enter, cancel it
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
if (url) {
[self clearResults];
[self setStringValue:url];
[self selectText:self];
[[self undoManager] removeAllActions];
[self setString:url];
[self selectAll:self];
}
}
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) onRowClicked:(id)sender
{
[self enterResult:[mTableView clickedRow]];
[self sendAction:[self action] to:[self target]];
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (void) onBlur:(id)sender
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNotification
- (void)textDidChange:(NSNotification *)aNotification
{
NSText *text = [[self window] fieldEditor:NO forObject:self];
NSRange range = [text selectedRange];
NSRange range = [self selectedRange];
// make sure we're typing at the end of the string
if (range.location == [[self stringValue] length])
[self startSearch:[self stringValue] complete:!mBackspaced];
if (range.location == [[self string] length])
[self startSearch:[self string] complete:!mBackspaced];
else
[self clearResults];
mBackspaced = NO;
}
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
- (void)textDidEndEditing:(NSNotification *)aNotification
{
[self closePopup];
[self setSelectedRange:NSMakeRange(0,0)];
[[self undoManager] removeAllActions];
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
if (command == @selector(insertNewline:)) {
[self enterResult:[mTableView selectedRow]];
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
command == @selector(deleteForward:)) {
// if the user deletes characters, we need to know so that
// we can prevent autocompletion later when search results come in
if ([[self stringValue] length] > 1)
if ([[self string] length] > 1)
mBackspaced = YES;
}
return NO;
}
- (void)keyDown:(NSEvent *)theEvent
{
if ([theEvent keyCode] == kEscapeKeyCode)
[self revertText];
else
[super keyDown:theEvent];
}
- (void) setPageProxyIcon:(NSImage *)aImage
{
[mProxyIcon setImage:aImage];
}
@end

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

@ -56,11 +56,9 @@
// Get the href attribute. This is the URL we want to load.
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
nsCAutoString cref; cref.AssignWithConversion(href);
if (cref.IsEmpty())
if (href.IsEmpty())
return;
NSString* url = [NSString stringWithCString: cref.get()];
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
// Now load the URL in the window.
[[[self window] windowController] loadURL: url referrer:nil];

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

@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
[self saveInternal: url.get()
withDocument: nsnull
suggestedFilename: [aFilename cString]
suggestedFilename: [aFilename fileSystemRepresentation]
bypassCache: YES
filterView: aFilterView
filterList: aFilterList];
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
location->GetHref(urlStr);
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
return [NSString stringWithCString: urlCStr.get()];
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
}
- (void)setActive: (BOOL)aIsActive

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

@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
- (IBAction)load:(id)sender
{
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
}
-(void)disconnectView
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
}
//
// sizeBrowserTo
//
// Sizes window so that browser has dimensions given by |dimensions|
//
- (void)sizeBrowserTo:(NSSize)dimensions
{
NSRect bounds = [self bounds];

47
camino/English.lproj/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -50,34 +50,34 @@
CLASS = BrowserWindowController;
LANGUAGE = ObjC;
OUTLETS = {
mAddBookmarkCheckbox = id;
mAddBookmarkFolderField = id;
mAddBookmarkSheetWindow = id;
mAddBookmarkTitleField = id;
mBackItem = id;
mAddBookmarkCheckbox = NSButton;
mAddBookmarkFolderField = NSPopUpButton;
mAddBookmarkSheetWindow = NSWindow;
mAddBookmarkTitleField = NSTextField;
mBackItem = NSMenuItem;
mCachedBMDS = id;
mForwardItem = id;
mHistoryDataSource = id;
mImageLinkMenu = id;
mImageMenu = id;
mInputMenu = id;
mLinkMenu = id;
mLocationSheetURLField = id;
mLocationSheetWindow = id;
mLocationToolbarView = id;
mForwardItem = NSMenuItem;
mHistoryDataSource = CHHistoryDataSource;
mImageLinkMenu = NSMenu;
mImageMenu = NSMenu;
mInputMenu = NSMenu;
mLinkMenu = NSMenu;
mLocationSheetURLField = NSTextField;
mLocationSheetWindow = NSWindow;
mLocationToolbarView = NSView;
mLock = NSImageView;
mPageMenu = id;
mPageMenu = NSMenu;
mPersonalToolbar = CHBookmarksToolbar;
mProgress = NSProgressIndicator;
mSidebarBookmarksDataSource = id;
mSidebarBookmarksDataSource = BookmarksDataSource;
mSidebarBrowserView = id;
mSidebarDrawer = NSDrawer;
mSidebarSourceTabView = id;
mSidebarTabView = id;
mSidebarSourceTabView = NSTabView;
mSidebarTabView = NSTabView;
mStatus = NSTextField;
mStatusBar = NSView;
mTabBrowser = id;
mURLBar = NSTextField;
mTabBrowser = CHExtendedTabView;
mURLBar = NSTextView;
};
SUPERCLASS = NSWindowController;
},
@ -89,6 +89,13 @@
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextField;
},
{
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
CLASS = CHAutoCompleteTextView;
LANGUAGE = ObjC;
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextView;
},
{
CLASS = CHBookmarksOutlineView;
LANGUAGE = ObjC;

9
camino/English.lproj/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>56 77 632 495 0 0 1152 746 </string>
<string>174 64 632 495 0 0 1152 848 </string>
<key>IBEditorPositions</key>
<dict>
<key>124</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>442 634 343 68 0 0 1280 1002 </string>
<string>403 587 360 76 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -43,10 +43,7 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>297</integer>
<integer>463</integer>
<integer>336</integer>
<integer>314</integer>
<integer>56</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
camino/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
{
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
// The process of creating a new tab in this brand new window loads about:blank for us as a
// side effect of calling GetDocument(). We don't need to do it again.
if ( [aURL isEqualToString:@"about:blank"] )
[browser disableLoadPage];
[browser loadURL: aURL referrer:aReferrer];
[browser showWindow: self];
return browser;
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction) toggleBookmarksToolbar:(id)aSender
{
NSWindow* mainWindow = [mApplication mainWindow];
if (!mainWindow) {
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
mainWindow = [mApplication mainWindow];
// do nothing if there is no window. we shouldn't get here in that case anyway, but
// just to be safe. If there is a browser window, toggle it's personal toolbar.
if ( [self isMainWindowABrowserWindow] ) {
NSWindow* mainWindow = [mApplication mainWindow];
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
-(IBAction) infoLink:(id)aSender

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

@ -50,34 +50,34 @@
CLASS = BrowserWindowController;
LANGUAGE = ObjC;
OUTLETS = {
mAddBookmarkCheckbox = id;
mAddBookmarkFolderField = id;
mAddBookmarkSheetWindow = id;
mAddBookmarkTitleField = id;
mBackItem = id;
mAddBookmarkCheckbox = NSButton;
mAddBookmarkFolderField = NSPopUpButton;
mAddBookmarkSheetWindow = NSWindow;
mAddBookmarkTitleField = NSTextField;
mBackItem = NSMenuItem;
mCachedBMDS = id;
mForwardItem = id;
mHistoryDataSource = id;
mImageLinkMenu = id;
mImageMenu = id;
mInputMenu = id;
mLinkMenu = id;
mLocationSheetURLField = id;
mLocationSheetWindow = id;
mLocationToolbarView = id;
mForwardItem = NSMenuItem;
mHistoryDataSource = CHHistoryDataSource;
mImageLinkMenu = NSMenu;
mImageMenu = NSMenu;
mInputMenu = NSMenu;
mLinkMenu = NSMenu;
mLocationSheetURLField = NSTextField;
mLocationSheetWindow = NSWindow;
mLocationToolbarView = NSView;
mLock = NSImageView;
mPageMenu = id;
mPageMenu = NSMenu;
mPersonalToolbar = CHBookmarksToolbar;
mProgress = NSProgressIndicator;
mSidebarBookmarksDataSource = id;
mSidebarBookmarksDataSource = BookmarksDataSource;
mSidebarBrowserView = id;
mSidebarDrawer = NSDrawer;
mSidebarSourceTabView = id;
mSidebarTabView = id;
mSidebarSourceTabView = NSTabView;
mSidebarTabView = NSTabView;
mStatus = NSTextField;
mStatusBar = NSView;
mTabBrowser = id;
mURLBar = NSTextField;
mTabBrowser = CHExtendedTabView;
mURLBar = NSTextView;
};
SUPERCLASS = NSWindowController;
},
@ -89,6 +89,13 @@
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextField;
},
{
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
CLASS = CHAutoCompleteTextView;
LANGUAGE = ObjC;
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextView;
},
{
CLASS = CHBookmarksOutlineView;
LANGUAGE = ObjC;

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

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>56 77 632 495 0 0 1152 746 </string>
<string>174 64 632 495 0 0 1152 848 </string>
<key>IBEditorPositions</key>
<dict>
<key>124</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>442 634 343 68 0 0 1280 1002 </string>
<string>403 587 360 76 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -43,10 +43,7 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>297</integer>
<integer>463</integer>
<integer>336</integer>
<integer>314</integer>
<integer>56</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
{
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
// The process of creating a new tab in this brand new window loads about:blank for us as a
// side effect of calling GetDocument(). We don't need to do it again.
if ( [aURL isEqualToString:@"about:blank"] )
[browser disableLoadPage];
[browser loadURL: aURL referrer:aReferrer];
[browser showWindow: self];
return browser;
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction) toggleBookmarksToolbar:(id)aSender
{
NSWindow* mainWindow = [mApplication mainWindow];
if (!mainWindow) {
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
mainWindow = [mApplication mainWindow];
// do nothing if there is no window. we shouldn't get here in that case anyway, but
// just to be safe. If there is a browser window, toggle it's personal toolbar.
if ( [self isMainWindowABrowserWindow] ) {
NSWindow* mainWindow = [mApplication mainWindow];
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
-(IBAction) infoLink:(id)aSender

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

@ -56,11 +56,9 @@
// Get the href attribute. This is the URL we want to load.
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
nsCAutoString cref; cref.AssignWithConversion(href);
if (cref.IsEmpty())
if (href.IsEmpty())
return;
NSString* url = [NSString stringWithCString: cref.get()];
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
// Now load the URL in the window.
[[[self window] windowController] loadURL: url referrer:nil];

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

@ -206,8 +206,8 @@
isGroup = YES;
}
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
nsAutoString title; title.AssignWithConversion(titleC);
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
nsAutoString tagName;
if (mCachedHref)
@ -224,7 +224,8 @@
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
if (mCachedHref) {
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

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

@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

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

@ -25,11 +25,10 @@
#import "CHAutoCompleteTextField.h"
#include "nsIAutoCompleteResults.h"
@class CHAutoCompleteTextField;
@class CHAutoCompleteTextView;
@interface CHAutoCompleteDataSource : NSObject
{
CHAutoCompleteTextField *mTextField;
NSImage *mIconImage;
NSString* mErrorMessage;

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

@ -29,7 +29,7 @@
@class CHAutoCompleteDataSource, CHPageProxyIcon;
@interface CHAutoCompleteTextField : NSTextField
@interface CHAutoCompleteTextView : NSTextView
{
IBOutlet CHPageProxyIcon *mProxyIcon;
NSWindow *mPopupWin;
@ -56,6 +56,7 @@
- (void) setSession:(NSString *)aSession;
- (NSString *) session;
- (void) setPageProxyIcon:(NSImage *)aImage;
- (NSTableView *) tableView;
- (int) visibleRows;

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

@ -19,6 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -31,14 +32,15 @@
static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
{
NS_INIT_REFCNT();
mTextField = aTextField;
mTextView = aTextView;
}
NS_DECL_ISUPPORTS
@ -49,22 +51,30 @@ public:
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
{
[mTextField dataReady:aResults status:aStatus];
[mTextView dataReady:aResults status:aStatus];
return NS_OK;
}
private:
CHAutoCompleteTextField *mTextField;
CHAutoCompleteTextView *mTextView;
};
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
////////////////////////////////////////////////////////////////////////
@implementation CHAutoCompleteTextField
@implementation CHAutoCompleteTextView
- (void) awakeFromNib
{
[self setAllowsUndo:YES];
[self setFieldEditor:YES];
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setUsesFontPanel:NO];
[self setRichText:NO];
[self setVerticallyResizable:NO];
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
NSTableColumn *column;
NSScrollView *scrollView;
NSCell *dataCell;
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
}
// get the origin of the location bar in coordinates of the root view
locationFrame = [[self superview] frame];
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
toView:[[[self window] contentView] superview]];
locationFrame = [[[[self superview] superview] superview] frame];
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
// get the height of the table view
winFrame = [[self window] frame];
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) completeResult:(int)aRow
{
NSRange matchRange;
NSText *text;
NSString *result1;
if (aRow < 0 && mSearchString) {
[self setStringValue:mSearchString];
[self setString:mSearchString];
} else {
if ([mDataSource rowCount] <= 0)
return;
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
#if 1
// fill in the textfield with the matching string
[self setStringValue:result1];
[self setString:result1];
// select the text after the search string
text = [[self window] fieldEditor:NO forObject:self];
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
#endif
}
}
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) enterResult:(int)aRow
{
if (aRow >= 0 && [mDataSource rowCount] > 0) {
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectText:self];
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectAll:self];
[self closePopup];
} else if (mOpenTimer) {
// if there was a search timer going when we hit enter, cancel it
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
if (url) {
[self clearResults];
[self setStringValue:url];
[self selectText:self];
[[self undoManager] removeAllActions];
[self setString:url];
[self selectAll:self];
}
}
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) onRowClicked:(id)sender
{
[self enterResult:[mTableView clickedRow]];
[self sendAction:[self action] to:[self target]];
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (void) onBlur:(id)sender
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNotification
- (void)textDidChange:(NSNotification *)aNotification
{
NSText *text = [[self window] fieldEditor:NO forObject:self];
NSRange range = [text selectedRange];
NSRange range = [self selectedRange];
// make sure we're typing at the end of the string
if (range.location == [[self stringValue] length])
[self startSearch:[self stringValue] complete:!mBackspaced];
if (range.location == [[self string] length])
[self startSearch:[self string] complete:!mBackspaced];
else
[self clearResults];
mBackspaced = NO;
}
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
- (void)textDidEndEditing:(NSNotification *)aNotification
{
[self closePopup];
[self setSelectedRange:NSMakeRange(0,0)];
[[self undoManager] removeAllActions];
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
if (command == @selector(insertNewline:)) {
[self enterResult:[mTableView selectedRow]];
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
command == @selector(deleteForward:)) {
// if the user deletes characters, we need to know so that
// we can prevent autocompletion later when search results come in
if ([[self stringValue] length] > 1)
if ([[self string] length] > 1)
mBackspaced = YES;
}
return NO;
}
- (void)keyDown:(NSEvent *)theEvent
{
if ([theEvent keyCode] == kEscapeKeyCode)
[self revertText];
else
[super keyDown:theEvent];
}
- (void) setPageProxyIcon:(NSImage *)aImage
{
[mProxyIcon setImage:aImage];
}
@end

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

@ -4,7 +4,6 @@
@interface BrowserWindow : NSWindow
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;

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

@ -1,25 +1,8 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@implementation BrowserWindow
- (void)sendEvent:(NSEvent *)theEvent
{
// We need this hack because NSWindow::sendEvent will eat the escape key
// and won't pass it down to the key handler of responders in the window.
// We have to override sendEvent for all of our escape key needs.
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
if (fieldEditor && [self firstResponder] == fieldEditor) {
[mAutoCompleteTextField revertText];
}
} else
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];

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

@ -86,7 +86,7 @@ class nsIDOMNode;
IBOutlet NSTabView* mSidebarTabView;
IBOutlet NSTabView* mSidebarSourceTabView;
IBOutlet NSView* mLocationToolbarView;
IBOutlet NSTextField* mURLBar;
IBOutlet NSTextView* mURLBar;
IBOutlet NSTextField* mStatus;
IBOutlet NSProgressIndicator* mProgress;
IBOutlet NSImageView* mLock;
@ -166,7 +166,6 @@ class nsIDOMNode;
- (void)performAppropriateLocationAction;
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
- (void)focusURLBar;
- (void)beginLocationSheet;
- (IBAction)endLocationSheet:(id)sender;
- (IBAction)cancelLocationSheet:(id)sender;
@ -175,6 +174,8 @@ class nsIDOMNode;
- (IBAction)endAddBookmarkSheet:(id)sender;
- (void)cacheBookmarkDS: (id)aDS;
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
- (IBAction)viewSource:(id)aSender;
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;

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

@ -271,9 +271,7 @@ static NSArray* sToolbarDefaults = nil;
// worry about retaining and releasing it.
[mProgress retain];
}
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
// Get our saved dimensions.
[[self window] setFrameUsingName: @"NavigatorWindow"];
@ -321,13 +319,20 @@ static NSArray* sToolbarDefaults = nil;
[mPersonalToolbar removeFromSuperview];
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
mPersonalToolbar = nil;
mPersonalToolbar = nil;
}
else if (![self shouldShowBookmarkToolbar]) {
[mPersonalToolbar showBookmarksToolbar:NO];
}
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
{
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
// return [[self window] frame].size;
return proposedFrameSize;
}
- (void)drawerWillOpen: (NSNotification*)aNotification
{
[mSidebarBookmarksDataSource ensureBookmarks];
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
- (void)focusURLBar
{
[mURLBar selectText: self];
[[self window] makeFirstResponder:mURLBar];
[mURLBar selectAll: self];
}
- (void)beginLocationSheet
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
- (IBAction)goToLocationFromToolbarURLField:(id)sender
{
// trim off any whitespace around url
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
CFStringTrimWhitespace((CFMutableStringRef)theURL);
[self loadURL:theURL referrer:nil];
[theURL release];
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
// Get the users preferred search engine from IC
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
if (!searchEngine || ([searchEngine length] == 0))
searchEngine = @"http://dmoz.org/";
}
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
}
*/
[mURLBar setStringValue:locationString];
[mURLBar setString:locationString];
[mLocationSheetURLField setStringValue:locationString];
[[self window] update];
[[self window] display];
// don't call [window display] here, no matter how much you might want
// to, because it forces a redraw of every view in the window and with a lot
// of tabs, it's dog slow.
// [[self window] display];
}
-(void)newTab:(BOOL)allowHomepage

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

@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
- (IBAction)load:(id)sender
{
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
}
-(void)disconnectView
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
}
//
// sizeBrowserTo
//
// Sizes window so that browser has dimensions given by |dimensions|
//
- (void)sizeBrowserTo:(NSSize)dimensions
{
NSRect bounds = [self bounds];

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

@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
[self saveInternal: url.get()
withDocument: nsnull
suggestedFilename: [aFilename cString]
suggestedFilename: [aFilename fileSystemRepresentation]
bypassCache: YES
filterView: aFilterView
filterList: aFilterList];
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
location->GetHref(urlStr);
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
return [NSString stringWithCString: urlCStr.get()];
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
}
- (void)setActive: (BOOL)aIsActive

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

@ -206,8 +206,8 @@
isGroup = YES;
}
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
nsAutoString title; title.AssignWithConversion(titleC);
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
nsAutoString tagName;
if (mCachedHref)
@ -224,7 +224,8 @@
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
if (mCachedHref) {
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

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

@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

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

@ -4,7 +4,6 @@
@interface BrowserWindow : NSWindow
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;

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

@ -1,25 +1,8 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@implementation BrowserWindow
- (void)sendEvent:(NSEvent *)theEvent
{
// We need this hack because NSWindow::sendEvent will eat the escape key
// and won't pass it down to the key handler of responders in the window.
// We have to override sendEvent for all of our escape key needs.
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
if (fieldEditor && [self firstResponder] == fieldEditor) {
[mAutoCompleteTextField revertText];
}
} else
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];

47
chimera/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -50,34 +50,34 @@
CLASS = BrowserWindowController;
LANGUAGE = ObjC;
OUTLETS = {
mAddBookmarkCheckbox = id;
mAddBookmarkFolderField = id;
mAddBookmarkSheetWindow = id;
mAddBookmarkTitleField = id;
mBackItem = id;
mAddBookmarkCheckbox = NSButton;
mAddBookmarkFolderField = NSPopUpButton;
mAddBookmarkSheetWindow = NSWindow;
mAddBookmarkTitleField = NSTextField;
mBackItem = NSMenuItem;
mCachedBMDS = id;
mForwardItem = id;
mHistoryDataSource = id;
mImageLinkMenu = id;
mImageMenu = id;
mInputMenu = id;
mLinkMenu = id;
mLocationSheetURLField = id;
mLocationSheetWindow = id;
mLocationToolbarView = id;
mForwardItem = NSMenuItem;
mHistoryDataSource = CHHistoryDataSource;
mImageLinkMenu = NSMenu;
mImageMenu = NSMenu;
mInputMenu = NSMenu;
mLinkMenu = NSMenu;
mLocationSheetURLField = NSTextField;
mLocationSheetWindow = NSWindow;
mLocationToolbarView = NSView;
mLock = NSImageView;
mPageMenu = id;
mPageMenu = NSMenu;
mPersonalToolbar = CHBookmarksToolbar;
mProgress = NSProgressIndicator;
mSidebarBookmarksDataSource = id;
mSidebarBookmarksDataSource = BookmarksDataSource;
mSidebarBrowserView = id;
mSidebarDrawer = NSDrawer;
mSidebarSourceTabView = id;
mSidebarTabView = id;
mSidebarSourceTabView = NSTabView;
mSidebarTabView = NSTabView;
mStatus = NSTextField;
mStatusBar = NSView;
mTabBrowser = id;
mURLBar = NSTextField;
mTabBrowser = CHExtendedTabView;
mURLBar = NSTextView;
};
SUPERCLASS = NSWindowController;
},
@ -89,6 +89,13 @@
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextField;
},
{
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
CLASS = CHAutoCompleteTextView;
LANGUAGE = ObjC;
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextView;
},
{
CLASS = CHBookmarksOutlineView;
LANGUAGE = ObjC;

9
chimera/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>56 77 632 495 0 0 1152 746 </string>
<string>174 64 632 495 0 0 1152 848 </string>
<key>IBEditorPositions</key>
<dict>
<key>124</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>442 634 343 68 0 0 1280 1002 </string>
<string>403 587 360 76 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -43,10 +43,7 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>297</integer>
<integer>463</integer>
<integer>336</integer>
<integer>314</integer>
<integer>56</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
chimera/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -86,7 +86,7 @@ class nsIDOMNode;
IBOutlet NSTabView* mSidebarTabView;
IBOutlet NSTabView* mSidebarSourceTabView;
IBOutlet NSView* mLocationToolbarView;
IBOutlet NSTextField* mURLBar;
IBOutlet NSTextView* mURLBar;
IBOutlet NSTextField* mStatus;
IBOutlet NSProgressIndicator* mProgress;
IBOutlet NSImageView* mLock;
@ -166,7 +166,6 @@ class nsIDOMNode;
- (void)performAppropriateLocationAction;
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
- (void)focusURLBar;
- (void)beginLocationSheet;
- (IBAction)endLocationSheet:(id)sender;
- (IBAction)cancelLocationSheet:(id)sender;
@ -175,6 +174,8 @@ class nsIDOMNode;
- (IBAction)endAddBookmarkSheet:(id)sender;
- (void)cacheBookmarkDS: (id)aDS;
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
- (IBAction)viewSource:(id)aSender;
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;

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

@ -271,9 +271,7 @@ static NSArray* sToolbarDefaults = nil;
// worry about retaining and releasing it.
[mProgress retain];
}
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
// Get our saved dimensions.
[[self window] setFrameUsingName: @"NavigatorWindow"];
@ -321,13 +319,20 @@ static NSArray* sToolbarDefaults = nil;
[mPersonalToolbar removeFromSuperview];
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
mPersonalToolbar = nil;
mPersonalToolbar = nil;
}
else if (![self shouldShowBookmarkToolbar]) {
[mPersonalToolbar showBookmarksToolbar:NO];
}
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
{
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
// return [[self window] frame].size;
return proposedFrameSize;
}
- (void)drawerWillOpen: (NSNotification*)aNotification
{
[mSidebarBookmarksDataSource ensureBookmarks];
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
- (void)focusURLBar
{
[mURLBar selectText: self];
[[self window] makeFirstResponder:mURLBar];
[mURLBar selectAll: self];
}
- (void)beginLocationSheet
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
- (IBAction)goToLocationFromToolbarURLField:(id)sender
{
// trim off any whitespace around url
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
CFStringTrimWhitespace((CFMutableStringRef)theURL);
[self loadURL:theURL referrer:nil];
[theURL release];
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
// Get the users preferred search engine from IC
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
if (!searchEngine || ([searchEngine length] == 0))
searchEngine = @"http://dmoz.org/";
}
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
}
*/
[mURLBar setStringValue:locationString];
[mURLBar setString:locationString];
[mLocationSheetURLField setStringValue:locationString];
[[self window] update];
[[self window] display];
// don't call [window display] here, no matter how much you might want
// to, because it forces a redraw of every view in the window and with a lot
// of tabs, it's dog slow.
// [[self window] display];
}
-(void)newTab:(BOOL)allowHomepage

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

@ -25,11 +25,10 @@
#import "CHAutoCompleteTextField.h"
#include "nsIAutoCompleteResults.h"
@class CHAutoCompleteTextField;
@class CHAutoCompleteTextView;
@interface CHAutoCompleteDataSource : NSObject
{
CHAutoCompleteTextField *mTextField;
NSImage *mIconImage;
NSString* mErrorMessage;

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

@ -29,7 +29,7 @@
@class CHAutoCompleteDataSource, CHPageProxyIcon;
@interface CHAutoCompleteTextField : NSTextField
@interface CHAutoCompleteTextView : NSTextView
{
IBOutlet CHPageProxyIcon *mProxyIcon;
NSWindow *mPopupWin;
@ -56,6 +56,7 @@
- (void) setSession:(NSString *)aSession;
- (NSString *) session;
- (void) setPageProxyIcon:(NSImage *)aImage;
- (NSTableView *) tableView;
- (int) visibleRows;

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

@ -19,6 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -31,14 +32,15 @@
static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
{
NS_INIT_REFCNT();
mTextField = aTextField;
mTextView = aTextView;
}
NS_DECL_ISUPPORTS
@ -49,22 +51,30 @@ public:
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
{
[mTextField dataReady:aResults status:aStatus];
[mTextView dataReady:aResults status:aStatus];
return NS_OK;
}
private:
CHAutoCompleteTextField *mTextField;
CHAutoCompleteTextView *mTextView;
};
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
////////////////////////////////////////////////////////////////////////
@implementation CHAutoCompleteTextField
@implementation CHAutoCompleteTextView
- (void) awakeFromNib
{
[self setAllowsUndo:YES];
[self setFieldEditor:YES];
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setUsesFontPanel:NO];
[self setRichText:NO];
[self setVerticallyResizable:NO];
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
NSTableColumn *column;
NSScrollView *scrollView;
NSCell *dataCell;
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
}
// get the origin of the location bar in coordinates of the root view
locationFrame = [[self superview] frame];
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
toView:[[[self window] contentView] superview]];
locationFrame = [[[[self superview] superview] superview] frame];
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
// get the height of the table view
winFrame = [[self window] frame];
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) completeResult:(int)aRow
{
NSRange matchRange;
NSText *text;
NSString *result1;
if (aRow < 0 && mSearchString) {
[self setStringValue:mSearchString];
[self setString:mSearchString];
} else {
if ([mDataSource rowCount] <= 0)
return;
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
#if 1
// fill in the textfield with the matching string
[self setStringValue:result1];
[self setString:result1];
// select the text after the search string
text = [[self window] fieldEditor:NO forObject:self];
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
#endif
}
}
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) enterResult:(int)aRow
{
if (aRow >= 0 && [mDataSource rowCount] > 0) {
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectText:self];
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectAll:self];
[self closePopup];
} else if (mOpenTimer) {
// if there was a search timer going when we hit enter, cancel it
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
if (url) {
[self clearResults];
[self setStringValue:url];
[self selectText:self];
[[self undoManager] removeAllActions];
[self setString:url];
[self selectAll:self];
}
}
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) onRowClicked:(id)sender
{
[self enterResult:[mTableView clickedRow]];
[self sendAction:[self action] to:[self target]];
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (void) onBlur:(id)sender
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNotification
- (void)textDidChange:(NSNotification *)aNotification
{
NSText *text = [[self window] fieldEditor:NO forObject:self];
NSRange range = [text selectedRange];
NSRange range = [self selectedRange];
// make sure we're typing at the end of the string
if (range.location == [[self stringValue] length])
[self startSearch:[self stringValue] complete:!mBackspaced];
if (range.location == [[self string] length])
[self startSearch:[self string] complete:!mBackspaced];
else
[self clearResults];
mBackspaced = NO;
}
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
- (void)textDidEndEditing:(NSNotification *)aNotification
{
[self closePopup];
[self setSelectedRange:NSMakeRange(0,0)];
[[self undoManager] removeAllActions];
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
if (command == @selector(insertNewline:)) {
[self enterResult:[mTableView selectedRow]];
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
command == @selector(deleteForward:)) {
// if the user deletes characters, we need to know so that
// we can prevent autocompletion later when search results come in
if ([[self stringValue] length] > 1)
if ([[self string] length] > 1)
mBackspaced = YES;
}
return NO;
}
- (void)keyDown:(NSEvent *)theEvent
{
if ([theEvent keyCode] == kEscapeKeyCode)
[self revertText];
else
[super keyDown:theEvent];
}
- (void) setPageProxyIcon:(NSImage *)aImage
{
[mProxyIcon setImage:aImage];
}
@end

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

@ -56,11 +56,9 @@
// Get the href attribute. This is the URL we want to load.
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
nsCAutoString cref; cref.AssignWithConversion(href);
if (cref.IsEmpty())
if (href.IsEmpty())
return;
NSString* url = [NSString stringWithCString: cref.get()];
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
// Now load the URL in the window.
[[[self window] windowController] loadURL: url referrer:nil];

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

@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
[self saveInternal: url.get()
withDocument: nsnull
suggestedFilename: [aFilename cString]
suggestedFilename: [aFilename fileSystemRepresentation]
bypassCache: YES
filterView: aFilterView
filterList: aFilterList];
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
location->GetHref(urlStr);
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
return [NSString stringWithCString: urlCStr.get()];
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
}
- (void)setActive: (BOOL)aIsActive

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

@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
- (IBAction)load:(id)sender
{
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
}
-(void)disconnectView
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
}
//
// sizeBrowserTo
//
// Sizes window so that browser has dimensions given by |dimensions|
//
- (void)sizeBrowserTo:(NSSize)dimensions
{
NSRect bounds = [self bounds];

47
chimera/English.lproj/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -50,34 +50,34 @@
CLASS = BrowserWindowController;
LANGUAGE = ObjC;
OUTLETS = {
mAddBookmarkCheckbox = id;
mAddBookmarkFolderField = id;
mAddBookmarkSheetWindow = id;
mAddBookmarkTitleField = id;
mBackItem = id;
mAddBookmarkCheckbox = NSButton;
mAddBookmarkFolderField = NSPopUpButton;
mAddBookmarkSheetWindow = NSWindow;
mAddBookmarkTitleField = NSTextField;
mBackItem = NSMenuItem;
mCachedBMDS = id;
mForwardItem = id;
mHistoryDataSource = id;
mImageLinkMenu = id;
mImageMenu = id;
mInputMenu = id;
mLinkMenu = id;
mLocationSheetURLField = id;
mLocationSheetWindow = id;
mLocationToolbarView = id;
mForwardItem = NSMenuItem;
mHistoryDataSource = CHHistoryDataSource;
mImageLinkMenu = NSMenu;
mImageMenu = NSMenu;
mInputMenu = NSMenu;
mLinkMenu = NSMenu;
mLocationSheetURLField = NSTextField;
mLocationSheetWindow = NSWindow;
mLocationToolbarView = NSView;
mLock = NSImageView;
mPageMenu = id;
mPageMenu = NSMenu;
mPersonalToolbar = CHBookmarksToolbar;
mProgress = NSProgressIndicator;
mSidebarBookmarksDataSource = id;
mSidebarBookmarksDataSource = BookmarksDataSource;
mSidebarBrowserView = id;
mSidebarDrawer = NSDrawer;
mSidebarSourceTabView = id;
mSidebarTabView = id;
mSidebarSourceTabView = NSTabView;
mSidebarTabView = NSTabView;
mStatus = NSTextField;
mStatusBar = NSView;
mTabBrowser = id;
mURLBar = NSTextField;
mTabBrowser = CHExtendedTabView;
mURLBar = NSTextView;
};
SUPERCLASS = NSWindowController;
},
@ -89,6 +89,13 @@
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextField;
},
{
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
CLASS = CHAutoCompleteTextView;
LANGUAGE = ObjC;
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextView;
},
{
CLASS = CHBookmarksOutlineView;
LANGUAGE = ObjC;

9
chimera/English.lproj/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>56 77 632 495 0 0 1152 746 </string>
<string>174 64 632 495 0 0 1152 848 </string>
<key>IBEditorPositions</key>
<dict>
<key>124</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>442 634 343 68 0 0 1280 1002 </string>
<string>403 587 360 76 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -43,10 +43,7 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>297</integer>
<integer>463</integer>
<integer>336</integer>
<integer>314</integer>
<integer>56</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
chimera/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
{
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
// The process of creating a new tab in this brand new window loads about:blank for us as a
// side effect of calling GetDocument(). We don't need to do it again.
if ( [aURL isEqualToString:@"about:blank"] )
[browser disableLoadPage];
[browser loadURL: aURL referrer:aReferrer];
[browser showWindow: self];
return browser;
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction) toggleBookmarksToolbar:(id)aSender
{
NSWindow* mainWindow = [mApplication mainWindow];
if (!mainWindow) {
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
mainWindow = [mApplication mainWindow];
// do nothing if there is no window. we shouldn't get here in that case anyway, but
// just to be safe. If there is a browser window, toggle it's personal toolbar.
if ( [self isMainWindowABrowserWindow] ) {
NSWindow* mainWindow = [mApplication mainWindow];
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
-(IBAction) infoLink:(id)aSender

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

@ -50,34 +50,34 @@
CLASS = BrowserWindowController;
LANGUAGE = ObjC;
OUTLETS = {
mAddBookmarkCheckbox = id;
mAddBookmarkFolderField = id;
mAddBookmarkSheetWindow = id;
mAddBookmarkTitleField = id;
mBackItem = id;
mAddBookmarkCheckbox = NSButton;
mAddBookmarkFolderField = NSPopUpButton;
mAddBookmarkSheetWindow = NSWindow;
mAddBookmarkTitleField = NSTextField;
mBackItem = NSMenuItem;
mCachedBMDS = id;
mForwardItem = id;
mHistoryDataSource = id;
mImageLinkMenu = id;
mImageMenu = id;
mInputMenu = id;
mLinkMenu = id;
mLocationSheetURLField = id;
mLocationSheetWindow = id;
mLocationToolbarView = id;
mForwardItem = NSMenuItem;
mHistoryDataSource = CHHistoryDataSource;
mImageLinkMenu = NSMenu;
mImageMenu = NSMenu;
mInputMenu = NSMenu;
mLinkMenu = NSMenu;
mLocationSheetURLField = NSTextField;
mLocationSheetWindow = NSWindow;
mLocationToolbarView = NSView;
mLock = NSImageView;
mPageMenu = id;
mPageMenu = NSMenu;
mPersonalToolbar = CHBookmarksToolbar;
mProgress = NSProgressIndicator;
mSidebarBookmarksDataSource = id;
mSidebarBookmarksDataSource = BookmarksDataSource;
mSidebarBrowserView = id;
mSidebarDrawer = NSDrawer;
mSidebarSourceTabView = id;
mSidebarTabView = id;
mSidebarSourceTabView = NSTabView;
mSidebarTabView = NSTabView;
mStatus = NSTextField;
mStatusBar = NSView;
mTabBrowser = id;
mURLBar = NSTextField;
mTabBrowser = CHExtendedTabView;
mURLBar = NSTextView;
};
SUPERCLASS = NSWindowController;
},
@ -89,6 +89,13 @@
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextField;
},
{
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
CLASS = CHAutoCompleteTextView;
LANGUAGE = ObjC;
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
SUPERCLASS = NSTextView;
},
{
CLASS = CHBookmarksOutlineView;
LANGUAGE = ObjC;

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

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>56 77 632 495 0 0 1152 746 </string>
<string>174 64 632 495 0 0 1152 848 </string>
<key>IBEditorPositions</key>
<dict>
<key>124</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>442 634 343 68 0 0 1280 1002 </string>
<string>403 587 360 76 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -43,10 +43,7 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>297</integer>
<integer>463</integer>
<integer>336</integer>
<integer>314</integer>
<integer>56</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
{
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
// The process of creating a new tab in this brand new window loads about:blank for us as a
// side effect of calling GetDocument(). We don't need to do it again.
if ( [aURL isEqualToString:@"about:blank"] )
[browser disableLoadPage];
[browser loadURL: aURL referrer:aReferrer];
[browser showWindow: self];
return browser;
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
-(IBAction) toggleBookmarksToolbar:(id)aSender
{
NSWindow* mainWindow = [mApplication mainWindow];
if (!mainWindow) {
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
mainWindow = [mApplication mainWindow];
// do nothing if there is no window. we shouldn't get here in that case anyway, but
// just to be safe. If there is a browser window, toggle it's personal toolbar.
if ( [self isMainWindowABrowserWindow] ) {
NSWindow* mainWindow = [mApplication mainWindow];
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
BOOL showToolbar = (BOOL)(!(height > 0));
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
// save prefs here
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
}
-(IBAction) infoLink:(id)aSender

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

@ -56,11 +56,9 @@
// Get the href attribute. This is the URL we want to load.
nsAutoString href;
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
nsCAutoString cref; cref.AssignWithConversion(href);
if (cref.IsEmpty())
if (href.IsEmpty())
return;
NSString* url = [NSString stringWithCString: cref.get()];
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
// Now load the URL in the window.
[[[self window] windowController] loadURL: url referrer:nil];

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

@ -206,8 +206,8 @@
isGroup = YES;
}
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
nsAutoString title; title.AssignWithConversion(titleC);
nsAutoString title;
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
nsAutoString tagName;
if (mCachedHref)
@ -224,7 +224,8 @@
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
if (mCachedHref) {
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
nsAutoString href;
NSStringTo_nsString(mCachedHref, href);
[mCachedHref release];
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
}

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

@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
nsCOMPtr<nsIDOMElement> beforeElt;
beforeElt = do_QueryInterface([beforeItem contentNode]);
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
return YES;
}

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

@ -25,11 +25,10 @@
#import "CHAutoCompleteTextField.h"
#include "nsIAutoCompleteResults.h"
@class CHAutoCompleteTextField;
@class CHAutoCompleteTextView;
@interface CHAutoCompleteDataSource : NSObject
{
CHAutoCompleteTextField *mTextField;
NSImage *mIconImage;
NSString* mErrorMessage;

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

@ -29,7 +29,7 @@
@class CHAutoCompleteDataSource, CHPageProxyIcon;
@interface CHAutoCompleteTextField : NSTextField
@interface CHAutoCompleteTextView : NSTextView
{
IBOutlet CHPageProxyIcon *mProxyIcon;
NSWindow *mPopupWin;
@ -56,6 +56,7 @@
- (void) setSession:(NSString *)aSession;
- (NSString *) session;
- (void) setPageProxyIcon:(NSImage *)aImage;
- (NSTableView *) tableView;
- (int) visibleRows;

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

@ -19,6 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -31,14 +32,15 @@
static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
{
NS_INIT_REFCNT();
mTextField = aTextField;
mTextView = aTextView;
}
NS_DECL_ISUPPORTS
@ -49,22 +51,30 @@ public:
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
{
[mTextField dataReady:aResults status:aStatus];
[mTextView dataReady:aResults status:aStatus];
return NS_OK;
}
private:
CHAutoCompleteTextField *mTextField;
CHAutoCompleteTextView *mTextView;
};
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
////////////////////////////////////////////////////////////////////////
@implementation CHAutoCompleteTextField
@implementation CHAutoCompleteTextView
- (void) awakeFromNib
{
[self setAllowsUndo:YES];
[self setFieldEditor:YES];
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setUsesFontPanel:NO];
[self setRichText:NO];
[self setVerticallyResizable:NO];
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
NSTableColumn *column;
NSScrollView *scrollView;
NSCell *dataCell;
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
}
// get the origin of the location bar in coordinates of the root view
locationFrame = [[self superview] frame];
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
toView:[[[self window] contentView] superview]];
locationFrame = [[[[self superview] superview] superview] frame];
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
// get the height of the table view
winFrame = [[self window] frame];
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) completeResult:(int)aRow
{
NSRange matchRange;
NSText *text;
NSString *result1;
if (aRow < 0 && mSearchString) {
[self setStringValue:mSearchString];
[self setString:mSearchString];
} else {
if ([mDataSource rowCount] <= 0)
return;
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
#if 1
// fill in the textfield with the matching string
[self setStringValue:result1];
[self setString:result1];
// select the text after the search string
text = [[self window] fieldEditor:NO forObject:self];
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
#endif
}
}
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) enterResult:(int)aRow
{
if (aRow >= 0 && [mDataSource rowCount] > 0) {
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectText:self];
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
[self selectAll:self];
[self closePopup];
} else if (mOpenTimer) {
// if there was a search timer going when we hit enter, cancel it
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
if (url) {
[self clearResults];
[self setStringValue:url];
[self selectText:self];
[[self undoManager] removeAllActions];
[self setString:url];
[self selectAll:self];
}
}
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
- (void) onRowClicked:(id)sender
{
[self enterResult:[mTableView clickedRow]];
[self sendAction:[self action] to:[self target]];
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (void) onBlur:(id)sender
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNotification
- (void)textDidChange:(NSNotification *)aNotification
{
NSText *text = [[self window] fieldEditor:NO forObject:self];
NSRange range = [text selectedRange];
NSRange range = [self selectedRange];
// make sure we're typing at the end of the string
if (range.location == [[self stringValue] length])
[self startSearch:[self stringValue] complete:!mBackspaced];
if (range.location == [[self string] length])
[self startSearch:[self string] complete:!mBackspaced];
else
[self clearResults];
mBackspaced = NO;
}
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
- (void)textDidEndEditing:(NSNotification *)aNotification
{
[self closePopup];
[self setSelectedRange:NSMakeRange(0,0)];
[[self undoManager] removeAllActions];
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
[[[self window] windowController] goToLocationFromToolbarURLField:self];
}
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
if (command == @selector(insertNewline:)) {
[self enterResult:[mTableView selectedRow]];
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
command == @selector(deleteForward:)) {
// if the user deletes characters, we need to know so that
// we can prevent autocompletion later when search results come in
if ([[self stringValue] length] > 1)
if ([[self string] length] > 1)
mBackspaced = YES;
}
return NO;
}
- (void)keyDown:(NSEvent *)theEvent
{
if ([theEvent keyCode] == kEscapeKeyCode)
[self revertText];
else
[super keyDown:theEvent];
}
- (void) setPageProxyIcon:(NSImage *)aImage
{
[mProxyIcon setImage:aImage];
}
@end

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

@ -4,7 +4,6 @@
@interface BrowserWindow : NSWindow
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;

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

@ -1,25 +1,8 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@implementation BrowserWindow
- (void)sendEvent:(NSEvent *)theEvent
{
// We need this hack because NSWindow::sendEvent will eat the escape key
// and won't pass it down to the key handler of responders in the window.
// We have to override sendEvent for all of our escape key needs.
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
if (fieldEditor && [self firstResponder] == fieldEditor) {
[mAutoCompleteTextField revertText];
}
} else
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];

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

@ -86,7 +86,7 @@ class nsIDOMNode;
IBOutlet NSTabView* mSidebarTabView;
IBOutlet NSTabView* mSidebarSourceTabView;
IBOutlet NSView* mLocationToolbarView;
IBOutlet NSTextField* mURLBar;
IBOutlet NSTextView* mURLBar;
IBOutlet NSTextField* mStatus;
IBOutlet NSProgressIndicator* mProgress;
IBOutlet NSImageView* mLock;
@ -166,7 +166,6 @@ class nsIDOMNode;
- (void)performAppropriateLocationAction;
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
- (void)focusURLBar;
- (void)beginLocationSheet;
- (IBAction)endLocationSheet:(id)sender;
- (IBAction)cancelLocationSheet:(id)sender;
@ -175,6 +174,8 @@ class nsIDOMNode;
- (IBAction)endAddBookmarkSheet:(id)sender;
- (void)cacheBookmarkDS: (id)aDS;
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
- (IBAction)viewSource:(id)aSender;
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;

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

@ -271,9 +271,7 @@ static NSArray* sToolbarDefaults = nil;
// worry about retaining and releasing it.
[mProgress retain];
}
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
// Get our saved dimensions.
[[self window] setFrameUsingName: @"NavigatorWindow"];
@ -321,13 +319,20 @@ static NSArray* sToolbarDefaults = nil;
[mPersonalToolbar removeFromSuperview];
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
mPersonalToolbar = nil;
mPersonalToolbar = nil;
}
else if (![self shouldShowBookmarkToolbar]) {
[mPersonalToolbar showBookmarksToolbar:NO];
}
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
{
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
// return [[self window] frame].size;
return proposedFrameSize;
}
- (void)drawerWillOpen: (NSNotification*)aNotification
{
[mSidebarBookmarksDataSource ensureBookmarks];
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
- (void)focusURLBar
{
[mURLBar selectText: self];
[[self window] makeFirstResponder:mURLBar];
[mURLBar selectAll: self];
}
- (void)beginLocationSheet
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
- (IBAction)goToLocationFromToolbarURLField:(id)sender
{
// trim off any whitespace around url
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
CFStringTrimWhitespace((CFMutableStringRef)theURL);
[self loadURL:theURL referrer:nil];
[theURL release];
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
// Get the users preferred search engine from IC
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
if (!searchEngine || ([searchEngine cStringLength] == 0))
if (!searchEngine || ([searchEngine length] == 0))
searchEngine = @"http://dmoz.org/";
}
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
}
*/
[mURLBar setStringValue:locationString];
[mURLBar setString:locationString];
[mLocationSheetURLField setStringValue:locationString];
[[self window] update];
[[self window] display];
// don't call [window display] here, no matter how much you might want
// to, because it forces a redraw of every view in the window and with a lot
// of tabs, it's dog slow.
// [[self window] display];
}
-(void)newTab:(BOOL)allowHomepage

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

@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
- (IBAction)load:(id)sender
{
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
}
-(void)disconnectView
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
}
}
//
// sizeBrowserTo
//
// Sizes window so that browser has dimensions given by |dimensions|
//
- (void)sizeBrowserTo:(NSSize)dimensions
{
NSRect bounds = [self bounds];

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

@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
[self saveInternal: url.get()
withDocument: nsnull
suggestedFilename: [aFilename cString]
suggestedFilename: [aFilename fileSystemRepresentation]
bypassCache: YES
filterView: aFilterView
filterList: aFilterList];
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
location->GetHref(urlStr);
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
return [NSString stringWithCString: urlCStr.get()];
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
}
- (void)setActive: (BOOL)aIsActive