зеркало из https://github.com/mozilla/pjs.git
Hook up Bookmarks Info Window, bug 148933
This commit is contained in:
Родитель
a3fa322097
Коммит
c30df5a78b
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "BookmarksService.h"
|
||||
|
||||
@interface BookmarkInfoController : NSWindowController {
|
||||
IBOutlet NSTextField* mNameField;
|
||||
IBOutlet NSTextField* mLocationField;
|
||||
IBOutlet NSTextField* mKeywordField;
|
||||
IBOutlet NSTextField* mDescriptionField;
|
||||
IBOutlet NSTextField* mNameLabel;
|
||||
IBOutlet NSTextField* mLocationLabel;
|
||||
IBOutlet NSTextField* mKeywordLabel;
|
||||
IBOutlet NSTextField* mDescriptionLabel;
|
||||
|
||||
BookmarkItem* mBookmarkItem;
|
||||
|
||||
NSOutlineView* mOutlineView;
|
||||
}
|
||||
|
||||
-(id)initWithOutlineView: (id)aOutlineView;
|
||||
|
||||
-(void)setBookmark:(BookmarkItem*)aBookmark;
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control: (id) aControl;
|
||||
-(void)hideUIElementPair: (id)aLabel control: (id) aControl;
|
||||
|
||||
@end
|
|
@ -0,0 +1,196 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINamespaceManager.h"
|
||||
|
||||
@implementation BookmarkInfoController
|
||||
|
||||
-(id) init
|
||||
{
|
||||
[mNameField setDelegate: self];
|
||||
[mLocationField setDelegate: self];
|
||||
[mKeywordField setDelegate: self];
|
||||
[mDescriptionField setDelegate: self];
|
||||
|
||||
[super initWithWindowNibName:@"BookmarkInfoPanel"];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithOutlineView: (id)aOutlineView
|
||||
{
|
||||
mOutlineView = aOutlineView;
|
||||
|
||||
return [self init];
|
||||
}
|
||||
|
||||
-(void)windowDidLoad
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
-(void)controlTextDidEndEditing: (NSNotification*) aNotification
|
||||
{
|
||||
if (!mBookmarkItem)
|
||||
return;
|
||||
|
||||
unsigned int len;
|
||||
PRUnichar* buffer;
|
||||
nsXPIDLString buf;
|
||||
|
||||
// Name
|
||||
len = [[mNameField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mNameField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, buf, PR_TRUE);
|
||||
|
||||
// Location
|
||||
len = [[mLocationField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mLocationField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, buf, PR_TRUE);
|
||||
|
||||
// Keyword
|
||||
len = [[mKeywordField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mKeywordField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, buf, PR_TRUE);
|
||||
|
||||
// Description
|
||||
len = [[mDescriptionField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mDescriptionField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, buf, PR_TRUE);
|
||||
|
||||
[mOutlineView reloadItem: mBookmarkItem reloadChildren: NO];
|
||||
}
|
||||
|
||||
-(void)setBookmark: (BookmarkItem*) aBookmark
|
||||
{
|
||||
if (aBookmark) {
|
||||
nsAutoString group;
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
BOOL isFolder = !isGroup && [mOutlineView isExpandable: aBookmark];
|
||||
|
||||
// First, Show/Hide the appropriate UI
|
||||
if (isGroup) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else if (isFolder) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
// Then, fill with appropriate values from Bookmarks
|
||||
nsAutoString value;
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
||||
[mNameField setStringValue: bookmarkName];
|
||||
NSString* infoForString = [NSString stringWithCString: "Info for "];
|
||||
[[self window] setTitle: [infoForString stringByAppendingString: bookmarkName]];
|
||||
|
||||
if (!isGroup && !isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
if (!isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
else {
|
||||
[[self window] setTitle: [NSString stringWithCString: "Bookmark Info"]];
|
||||
|
||||
[self hideUIElementPair: mNameLabel control: mNameField];
|
||||
[self hideUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
mBookmarkItem = aBookmark;
|
||||
}
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aLabel];
|
||||
[aLabel autorelease];
|
||||
}
|
||||
if ([aControl superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aControl];
|
||||
[aControl autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)hideUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] != nil) {
|
||||
[aLabel removeFromSuperview];
|
||||
[aLabel retain];
|
||||
}
|
||||
if ([aControl superview] != nil) {
|
||||
[aControl removeFromSuperview];
|
||||
[aControl retain];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
CLASS = BookmarkInfoController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mDescriptionField = NSTextField;
|
||||
mDescriptionLabel = NSTextField;
|
||||
mKeywordField = NSTextField;
|
||||
mKeywordLabel = NSTextField;
|
||||
mLocationField = NSTextField;
|
||||
mLocationLabel = NSTextField;
|
||||
mNameField = NSTextField;
|
||||
mNameLabel = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{CLASS = BookmarkItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
addBookmark = id;
|
||||
addFolder = id;
|
||||
beginRenameBookmark = id;
|
||||
cancelRenameBookmarkSheet = id;
|
||||
deleteBookmarks = id;
|
||||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
mRenameTextField = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>158 201 366 258 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -48,6 +48,8 @@
|
|||
class BookmarksService;
|
||||
class nsIAtom;
|
||||
|
||||
@class BookmarkInfoController;
|
||||
|
||||
@interface BookmarksDataSource : NSObject
|
||||
{
|
||||
BookmarksService* mBookmarks;
|
||||
|
@ -58,7 +60,11 @@ class nsIAtom;
|
|||
IBOutlet id mRenameSheet;
|
||||
IBOutlet NSTextField* mRenameTextField;
|
||||
|
||||
IBOutlet id mBookmarkInfoPanel;
|
||||
|
||||
NSString* mCachedHref;
|
||||
|
||||
BookmarkInfoController* mBookmarkInfoController;
|
||||
}
|
||||
|
||||
-(id) init;
|
||||
|
@ -85,6 +91,7 @@ class nsIAtom;
|
|||
-(IBAction)openBookmarkInNewWindow:(id)aSender;
|
||||
|
||||
-(void)openBookmarkGroup:(id)aTabView groupElement:(nsIDOMElement*)aFolder;
|
||||
-(IBAction)showBookmarkInfo:(id)aSender;
|
||||
|
||||
// Datasource methods.
|
||||
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
|
||||
|
@ -170,8 +177,11 @@ public:
|
|||
static nsIAtom* gFolderAtom;
|
||||
static nsIAtom* gNameAtom;
|
||||
static nsIAtom* gHrefAtom;
|
||||
static nsIAtom* gKeywordAtom;
|
||||
static nsIAtom* gDescriptionAtom;
|
||||
static nsIAtom* gBookmarkAtom;
|
||||
static nsIAtom* gOpenAtom;
|
||||
static nsIAtom* gGroupAtom;
|
||||
static nsIDocument* gBookmarks;
|
||||
static nsVoidArray* gInstances;
|
||||
static int CHInsertNone;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#import "CHBrowserView.h"
|
||||
#import "BookmarksService.h"
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -70,6 +71,7 @@
|
|||
|
||||
-(void) dealloc
|
||||
{
|
||||
[mBookmarkInfoController release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -329,7 +331,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
mBookmarks->OpenBookmarkGroup([mBrowserWindowController getTabBrowser], elt);
|
||||
else if ([mOutlineView isExpandable: item]) {
|
||||
|
@ -460,7 +462,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
[attachmentAttrStringCell setImage:[NSImage imageNamed:@"groupbookmark"]];
|
||||
else
|
||||
|
@ -692,12 +694,13 @@
|
|||
NSURL* urlToLoad = [NSURL URLWithString: hrefStr];
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (group.IsEmpty())
|
||||
[mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO];
|
||||
else
|
||||
else {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
[mBrowserWindowController openNewWindowWithGroup: elt loadInBackground: NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,6 +709,32 @@
|
|||
mBookmarks->OpenBookmarkGroup(aTabView, aFolder);
|
||||
}
|
||||
|
||||
-(IBAction)showBookmarkInfo:(id)aSender
|
||||
{
|
||||
if (!mBookmarkInfoController)
|
||||
mBookmarkInfoController = [[BookmarkInfoController alloc] initWithOutlineView: mOutlineView];
|
||||
|
||||
[mBookmarkInfoController showWindow:mBookmarkInfoController];
|
||||
|
||||
int index = [mOutlineView selectedRow];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
|
||||
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
if (index == -1) {
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:NULL];
|
||||
}
|
||||
else {
|
||||
BookmarkItem* item = [mOutlineView itemAtRow:index];
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem:(NSMenuItem*)aMenuItem
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
|
@ -716,8 +745,7 @@
|
|||
BOOL isBookmark = [mOutlineView isExpandable:item] == NO;
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
|
||||
if (([aMenuItem action] == @selector(openBookmarkInNewWindow:))) {
|
||||
|
@ -796,9 +824,12 @@ NSMutableDictionary* BookmarksService::gDictionary = nil;
|
|||
MainController* BookmarksService::gMainController = nil;
|
||||
NSMenu* BookmarksService::gBookmarksMenu = nil;
|
||||
nsIDOMElement* BookmarksService::gToolbarRoot = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gBookmarkAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gDescriptionAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gGroupAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gHrefAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gKeywordAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gNameAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gOpenAtom = nsnull;
|
||||
nsVoidArray* BookmarksService::gInstances = nsnull;
|
||||
|
@ -994,6 +1025,9 @@ BookmarksService::AddObserver()
|
|||
gNameAtom = NS_NewAtom("name");
|
||||
gHrefAtom = NS_NewAtom("href");
|
||||
gOpenAtom = NS_NewAtom("open");
|
||||
gKeywordAtom = NS_NewAtom("id");
|
||||
gDescriptionAtom = NS_NewAtom("description");
|
||||
gGroupAtom = NS_NewAtom("group");
|
||||
gInstances = new nsVoidArray();
|
||||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
|
@ -1281,8 +1315,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||
aChild->GetTag(*getter_AddRefs(tagName));
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aChild));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
aChild->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
|
||||
if (group.IsEmpty() && tagName == gFolderAtom) {
|
||||
NSMenu* menu = [[[NSMenu alloc] initWithTitle: title] autorelease];
|
||||
|
@ -1314,11 +1347,12 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||
|
||||
// Get the content node.
|
||||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
if (!group.IsEmpty())
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
return OpenBookmarkGroup([aController getTabBrowser], elt);
|
||||
}
|
||||
|
||||
// Get the href attribute. This is the URL we want to load.
|
||||
nsAutoString href;
|
||||
|
@ -1562,7 +1596,7 @@ BookmarksService::CreateIconForBookmark(nsIDOMElement* aElement)
|
|||
return [NSImage imageNamed:@"folder"];
|
||||
|
||||
nsAutoString group;
|
||||
aElement->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
return [NSImage imageNamed:@"smallgroup"];
|
||||
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>124</key>
|
||||
<string>305 659 170 162 0 0 1152 848 </string>
|
||||
<string>345 807 170 162 0 0 1280 1002 </string>
|
||||
<key>160</key>
|
||||
<string>478 172 195 666 0 0 1152 848 </string>
|
||||
<key>28</key>
|
||||
|
@ -43,8 +43,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>10</integer>
|
||||
<integer>394</integer>
|
||||
<integer>124</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
|
|
Двоичный файл не отображается.
|
@ -28,6 +28,7 @@
|
|||
F52F87CD027D75C301A80165,
|
||||
F52F87CE027D75C301A80165,
|
||||
2E748B73029A448D4B000102,
|
||||
F5383FCD02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Classes;
|
||||
|
@ -414,6 +415,7 @@
|
|||
2E293A01027F33604B000102,
|
||||
2EEC3E63028138724B000102,
|
||||
2E748B74029A448D4B000102,
|
||||
F5383FCE02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
name = Headers;
|
||||
|
@ -477,6 +479,7 @@
|
|||
F540BD1B029ED15301026D5D,
|
||||
F540BD1D029ED17901026D5D,
|
||||
F5007D3B02A3DA4801010220,
|
||||
F5388AC202ACBC9001A80164,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
name = "Bundle Resources";
|
||||
|
@ -517,6 +520,7 @@
|
|||
2E293A02027F33604B000102,
|
||||
2EEC3E64028138724B000102,
|
||||
2E748B75029A448D4B000102,
|
||||
F5383FCF02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
name = Sources;
|
||||
|
@ -1048,6 +1052,7 @@
|
|||
F52F87CB027D75C301A80165,
|
||||
F52F87CC027D75C301A80165,
|
||||
2E748B72029A448D4B000102,
|
||||
F5383FCC02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Headers;
|
||||
|
@ -1854,6 +1859,39 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCC02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.h;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCD02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.mm;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCE02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCC02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCF02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCD02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5388AC102ACBC8F01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoPanel.nib;
|
||||
refType = 4;
|
||||
};
|
||||
F5388AC202ACBC9001A80164 = {
|
||||
fileRef = F5388AC102ACBC8F01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F538DFAE023B36A7010001CA = {
|
||||
children = (
|
||||
F538DFAF023B3739010001CA,
|
||||
|
@ -3141,6 +3179,7 @@
|
|||
F58A94F2023F10CA010001CA = {
|
||||
children = (
|
||||
29B97319FDCFA39411CA2CEA,
|
||||
F5388AC102ACBC8F01A80164,
|
||||
F51842FC0206176901A966FE,
|
||||
F5247C2D02289FD9013DD99A,
|
||||
F5173958020CE1E50189DA0C,
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
CLASS = BookmarkInfoController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mDescriptionField = NSTextField;
|
||||
mDescriptionLabel = NSTextField;
|
||||
mKeywordField = NSTextField;
|
||||
mKeywordLabel = NSTextField;
|
||||
mLocationField = NSTextField;
|
||||
mLocationLabel = NSTextField;
|
||||
mNameField = NSTextField;
|
||||
mNameLabel = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{CLASS = BookmarkItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
addBookmark = id;
|
||||
addFolder = id;
|
||||
beginRenameBookmark = id;
|
||||
cancelRenameBookmarkSheet = id;
|
||||
deleteBookmarks = id;
|
||||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
mRenameTextField = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>158 201 366 258 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -11,10 +11,12 @@
|
|||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>124</key>
|
||||
<string>305 659 170 162 0 0 1152 848 </string>
|
||||
<string>345 807 170 162 0 0 1280 1002 </string>
|
||||
<key>160</key>
|
||||
<string>478 172 195 666 0 0 1152 848 </string>
|
||||
<key>28</key>
|
||||
|
@ -43,8 +43,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>10</integer>
|
||||
<integer>394</integer>
|
||||
<integer>124</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
|
|
Двоичный файл не отображается.
|
@ -28,6 +28,7 @@
|
|||
F52F87CD027D75C301A80165,
|
||||
F52F87CE027D75C301A80165,
|
||||
2E748B73029A448D4B000102,
|
||||
F5383FCD02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Classes;
|
||||
|
@ -414,6 +415,7 @@
|
|||
2E293A01027F33604B000102,
|
||||
2EEC3E63028138724B000102,
|
||||
2E748B74029A448D4B000102,
|
||||
F5383FCE02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
name = Headers;
|
||||
|
@ -477,6 +479,7 @@
|
|||
F540BD1B029ED15301026D5D,
|
||||
F540BD1D029ED17901026D5D,
|
||||
F5007D3B02A3DA4801010220,
|
||||
F5388AC202ACBC9001A80164,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
name = "Bundle Resources";
|
||||
|
@ -517,6 +520,7 @@
|
|||
2E293A02027F33604B000102,
|
||||
2EEC3E64028138724B000102,
|
||||
2E748B75029A448D4B000102,
|
||||
F5383FCF02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
name = Sources;
|
||||
|
@ -1048,6 +1052,7 @@
|
|||
F52F87CB027D75C301A80165,
|
||||
F52F87CC027D75C301A80165,
|
||||
2E748B72029A448D4B000102,
|
||||
F5383FCC02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Headers;
|
||||
|
@ -1854,6 +1859,39 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCC02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.h;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCD02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.mm;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCE02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCC02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCF02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCD02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5388AC102ACBC8F01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoPanel.nib;
|
||||
refType = 4;
|
||||
};
|
||||
F5388AC202ACBC9001A80164 = {
|
||||
fileRef = F5388AC102ACBC8F01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F538DFAE023B36A7010001CA = {
|
||||
children = (
|
||||
F538DFAF023B3739010001CA,
|
||||
|
@ -3141,6 +3179,7 @@
|
|||
F58A94F2023F10CA010001CA = {
|
||||
children = (
|
||||
29B97319FDCFA39411CA2CEA,
|
||||
F5388AC102ACBC8F01A80164,
|
||||
F51842FC0206176901A966FE,
|
||||
F5247C2D02289FD9013DD99A,
|
||||
F5173958020CE1E50189DA0C,
|
||||
|
|
45
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/classes.nib
сгенерированный
Normal file
45
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/classes.nib
сгенерированный
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
CLASS = BookmarkInfoController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mDescriptionField = NSTextField;
|
||||
mDescriptionLabel = NSTextField;
|
||||
mKeywordField = NSTextField;
|
||||
mKeywordLabel = NSTextField;
|
||||
mLocationField = NSTextField;
|
||||
mLocationLabel = NSTextField;
|
||||
mNameField = NSTextField;
|
||||
mNameLabel = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{CLASS = BookmarkItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
addBookmark = id;
|
||||
addFolder = id;
|
||||
beginRenameBookmark = id;
|
||||
cancelRenameBookmarkSheet = id;
|
||||
deleteBookmarks = id;
|
||||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
mRenameTextField = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
16
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/info.nib
сгенерированный
Normal file
16
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/info.nib
сгенерированный
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>158 201 366 258 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичные данные
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/objects.nib
сгенерированный
Normal file
Двоичные данные
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/objects.nib
сгенерированный
Normal file
Двоичный файл не отображается.
|
@ -11,10 +11,12 @@
|
|||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>124</key>
|
||||
<string>305 659 170 162 0 0 1152 848 </string>
|
||||
<string>345 807 170 162 0 0 1280 1002 </string>
|
||||
<key>160</key>
|
||||
<string>478 172 195 666 0 0 1152 848 </string>
|
||||
<key>28</key>
|
||||
|
@ -43,8 +43,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>10</integer>
|
||||
<integer>394</integer>
|
||||
<integer>124</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
|
|
Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "BookmarksService.h"
|
||||
|
||||
@interface BookmarkInfoController : NSWindowController {
|
||||
IBOutlet NSTextField* mNameField;
|
||||
IBOutlet NSTextField* mLocationField;
|
||||
IBOutlet NSTextField* mKeywordField;
|
||||
IBOutlet NSTextField* mDescriptionField;
|
||||
IBOutlet NSTextField* mNameLabel;
|
||||
IBOutlet NSTextField* mLocationLabel;
|
||||
IBOutlet NSTextField* mKeywordLabel;
|
||||
IBOutlet NSTextField* mDescriptionLabel;
|
||||
|
||||
BookmarkItem* mBookmarkItem;
|
||||
|
||||
NSOutlineView* mOutlineView;
|
||||
}
|
||||
|
||||
-(id)initWithOutlineView: (id)aOutlineView;
|
||||
|
||||
-(void)setBookmark:(BookmarkItem*)aBookmark;
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control: (id) aControl;
|
||||
-(void)hideUIElementPair: (id)aLabel control: (id) aControl;
|
||||
|
||||
@end
|
|
@ -0,0 +1,196 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINamespaceManager.h"
|
||||
|
||||
@implementation BookmarkInfoController
|
||||
|
||||
-(id) init
|
||||
{
|
||||
[mNameField setDelegate: self];
|
||||
[mLocationField setDelegate: self];
|
||||
[mKeywordField setDelegate: self];
|
||||
[mDescriptionField setDelegate: self];
|
||||
|
||||
[super initWithWindowNibName:@"BookmarkInfoPanel"];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithOutlineView: (id)aOutlineView
|
||||
{
|
||||
mOutlineView = aOutlineView;
|
||||
|
||||
return [self init];
|
||||
}
|
||||
|
||||
-(void)windowDidLoad
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
-(void)controlTextDidEndEditing: (NSNotification*) aNotification
|
||||
{
|
||||
if (!mBookmarkItem)
|
||||
return;
|
||||
|
||||
unsigned int len;
|
||||
PRUnichar* buffer;
|
||||
nsXPIDLString buf;
|
||||
|
||||
// Name
|
||||
len = [[mNameField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mNameField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, buf, PR_TRUE);
|
||||
|
||||
// Location
|
||||
len = [[mLocationField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mLocationField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, buf, PR_TRUE);
|
||||
|
||||
// Keyword
|
||||
len = [[mKeywordField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mKeywordField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, buf, PR_TRUE);
|
||||
|
||||
// Description
|
||||
len = [[mDescriptionField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mDescriptionField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, buf, PR_TRUE);
|
||||
|
||||
[mOutlineView reloadItem: mBookmarkItem reloadChildren: NO];
|
||||
}
|
||||
|
||||
-(void)setBookmark: (BookmarkItem*) aBookmark
|
||||
{
|
||||
if (aBookmark) {
|
||||
nsAutoString group;
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
BOOL isFolder = !isGroup && [mOutlineView isExpandable: aBookmark];
|
||||
|
||||
// First, Show/Hide the appropriate UI
|
||||
if (isGroup) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else if (isFolder) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
// Then, fill with appropriate values from Bookmarks
|
||||
nsAutoString value;
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
||||
[mNameField setStringValue: bookmarkName];
|
||||
NSString* infoForString = [NSString stringWithCString: "Info for "];
|
||||
[[self window] setTitle: [infoForString stringByAppendingString: bookmarkName]];
|
||||
|
||||
if (!isGroup && !isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
if (!isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
else {
|
||||
[[self window] setTitle: [NSString stringWithCString: "Bookmark Info"]];
|
||||
|
||||
[self hideUIElementPair: mNameLabel control: mNameField];
|
||||
[self hideUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
mBookmarkItem = aBookmark;
|
||||
}
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aLabel];
|
||||
[aLabel autorelease];
|
||||
}
|
||||
if ([aControl superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aControl];
|
||||
[aControl autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)hideUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] != nil) {
|
||||
[aLabel removeFromSuperview];
|
||||
[aLabel retain];
|
||||
}
|
||||
if ([aControl superview] != nil) {
|
||||
[aControl removeFromSuperview];
|
||||
[aControl retain];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -48,6 +48,8 @@
|
|||
class BookmarksService;
|
||||
class nsIAtom;
|
||||
|
||||
@class BookmarkInfoController;
|
||||
|
||||
@interface BookmarksDataSource : NSObject
|
||||
{
|
||||
BookmarksService* mBookmarks;
|
||||
|
@ -58,7 +60,11 @@ class nsIAtom;
|
|||
IBOutlet id mRenameSheet;
|
||||
IBOutlet NSTextField* mRenameTextField;
|
||||
|
||||
IBOutlet id mBookmarkInfoPanel;
|
||||
|
||||
NSString* mCachedHref;
|
||||
|
||||
BookmarkInfoController* mBookmarkInfoController;
|
||||
}
|
||||
|
||||
-(id) init;
|
||||
|
@ -85,6 +91,7 @@ class nsIAtom;
|
|||
-(IBAction)openBookmarkInNewWindow:(id)aSender;
|
||||
|
||||
-(void)openBookmarkGroup:(id)aTabView groupElement:(nsIDOMElement*)aFolder;
|
||||
-(IBAction)showBookmarkInfo:(id)aSender;
|
||||
|
||||
// Datasource methods.
|
||||
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
|
||||
|
@ -170,8 +177,11 @@ public:
|
|||
static nsIAtom* gFolderAtom;
|
||||
static nsIAtom* gNameAtom;
|
||||
static nsIAtom* gHrefAtom;
|
||||
static nsIAtom* gKeywordAtom;
|
||||
static nsIAtom* gDescriptionAtom;
|
||||
static nsIAtom* gBookmarkAtom;
|
||||
static nsIAtom* gOpenAtom;
|
||||
static nsIAtom* gGroupAtom;
|
||||
static nsIDocument* gBookmarks;
|
||||
static nsVoidArray* gInstances;
|
||||
static int CHInsertNone;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#import "CHBrowserView.h"
|
||||
#import "BookmarksService.h"
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -70,6 +71,7 @@
|
|||
|
||||
-(void) dealloc
|
||||
{
|
||||
[mBookmarkInfoController release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -329,7 +331,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
mBookmarks->OpenBookmarkGroup([mBrowserWindowController getTabBrowser], elt);
|
||||
else if ([mOutlineView isExpandable: item]) {
|
||||
|
@ -460,7 +462,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
[attachmentAttrStringCell setImage:[NSImage imageNamed:@"groupbookmark"]];
|
||||
else
|
||||
|
@ -692,12 +694,13 @@
|
|||
NSURL* urlToLoad = [NSURL URLWithString: hrefStr];
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (group.IsEmpty())
|
||||
[mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO];
|
||||
else
|
||||
else {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
[mBrowserWindowController openNewWindowWithGroup: elt loadInBackground: NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,6 +709,32 @@
|
|||
mBookmarks->OpenBookmarkGroup(aTabView, aFolder);
|
||||
}
|
||||
|
||||
-(IBAction)showBookmarkInfo:(id)aSender
|
||||
{
|
||||
if (!mBookmarkInfoController)
|
||||
mBookmarkInfoController = [[BookmarkInfoController alloc] initWithOutlineView: mOutlineView];
|
||||
|
||||
[mBookmarkInfoController showWindow:mBookmarkInfoController];
|
||||
|
||||
int index = [mOutlineView selectedRow];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
|
||||
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
if (index == -1) {
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:NULL];
|
||||
}
|
||||
else {
|
||||
BookmarkItem* item = [mOutlineView itemAtRow:index];
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem:(NSMenuItem*)aMenuItem
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
|
@ -716,8 +745,7 @@
|
|||
BOOL isBookmark = [mOutlineView isExpandable:item] == NO;
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
|
||||
if (([aMenuItem action] == @selector(openBookmarkInNewWindow:))) {
|
||||
|
@ -796,9 +824,12 @@ NSMutableDictionary* BookmarksService::gDictionary = nil;
|
|||
MainController* BookmarksService::gMainController = nil;
|
||||
NSMenu* BookmarksService::gBookmarksMenu = nil;
|
||||
nsIDOMElement* BookmarksService::gToolbarRoot = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gBookmarkAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gDescriptionAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gGroupAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gHrefAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gKeywordAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gNameAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gOpenAtom = nsnull;
|
||||
nsVoidArray* BookmarksService::gInstances = nsnull;
|
||||
|
@ -994,6 +1025,9 @@ BookmarksService::AddObserver()
|
|||
gNameAtom = NS_NewAtom("name");
|
||||
gHrefAtom = NS_NewAtom("href");
|
||||
gOpenAtom = NS_NewAtom("open");
|
||||
gKeywordAtom = NS_NewAtom("id");
|
||||
gDescriptionAtom = NS_NewAtom("description");
|
||||
gGroupAtom = NS_NewAtom("group");
|
||||
gInstances = new nsVoidArray();
|
||||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
|
@ -1281,8 +1315,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||
aChild->GetTag(*getter_AddRefs(tagName));
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aChild));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
aChild->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
|
||||
if (group.IsEmpty() && tagName == gFolderAtom) {
|
||||
NSMenu* menu = [[[NSMenu alloc] initWithTitle: title] autorelease];
|
||||
|
@ -1314,11 +1347,12 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||
|
||||
// Get the content node.
|
||||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
if (!group.IsEmpty())
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
return OpenBookmarkGroup([aController getTabBrowser], elt);
|
||||
}
|
||||
|
||||
// Get the href attribute. This is the URL we want to load.
|
||||
nsAutoString href;
|
||||
|
@ -1562,7 +1596,7 @@ BookmarksService::CreateIconForBookmark(nsIDOMElement* aElement)
|
|||
return [NSImage imageNamed:@"folder"];
|
||||
|
||||
nsAutoString group;
|
||||
aElement->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
return [NSImage imageNamed:@"smallgroup"];
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "BookmarksService.h"
|
||||
|
||||
@interface BookmarkInfoController : NSWindowController {
|
||||
IBOutlet NSTextField* mNameField;
|
||||
IBOutlet NSTextField* mLocationField;
|
||||
IBOutlet NSTextField* mKeywordField;
|
||||
IBOutlet NSTextField* mDescriptionField;
|
||||
IBOutlet NSTextField* mNameLabel;
|
||||
IBOutlet NSTextField* mLocationLabel;
|
||||
IBOutlet NSTextField* mKeywordLabel;
|
||||
IBOutlet NSTextField* mDescriptionLabel;
|
||||
|
||||
BookmarkItem* mBookmarkItem;
|
||||
|
||||
NSOutlineView* mOutlineView;
|
||||
}
|
||||
|
||||
-(id)initWithOutlineView: (id)aOutlineView;
|
||||
|
||||
-(void)setBookmark:(BookmarkItem*)aBookmark;
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control: (id) aControl;
|
||||
-(void)hideUIElementPair: (id)aLabel control: (id) aControl;
|
||||
|
||||
@end
|
|
@ -0,0 +1,196 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINamespaceManager.h"
|
||||
|
||||
@implementation BookmarkInfoController
|
||||
|
||||
-(id) init
|
||||
{
|
||||
[mNameField setDelegate: self];
|
||||
[mLocationField setDelegate: self];
|
||||
[mKeywordField setDelegate: self];
|
||||
[mDescriptionField setDelegate: self];
|
||||
|
||||
[super initWithWindowNibName:@"BookmarkInfoPanel"];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithOutlineView: (id)aOutlineView
|
||||
{
|
||||
mOutlineView = aOutlineView;
|
||||
|
||||
return [self init];
|
||||
}
|
||||
|
||||
-(void)windowDidLoad
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
-(void)controlTextDidEndEditing: (NSNotification*) aNotification
|
||||
{
|
||||
if (!mBookmarkItem)
|
||||
return;
|
||||
|
||||
unsigned int len;
|
||||
PRUnichar* buffer;
|
||||
nsXPIDLString buf;
|
||||
|
||||
// Name
|
||||
len = [[mNameField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mNameField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, buf, PR_TRUE);
|
||||
|
||||
// Location
|
||||
len = [[mLocationField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mLocationField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, buf, PR_TRUE);
|
||||
|
||||
// Keyword
|
||||
len = [[mKeywordField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mKeywordField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, buf, PR_TRUE);
|
||||
|
||||
// Description
|
||||
len = [[mDescriptionField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mDescriptionField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, buf, PR_TRUE);
|
||||
|
||||
[mOutlineView reloadItem: mBookmarkItem reloadChildren: NO];
|
||||
}
|
||||
|
||||
-(void)setBookmark: (BookmarkItem*) aBookmark
|
||||
{
|
||||
if (aBookmark) {
|
||||
nsAutoString group;
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
BOOL isFolder = !isGroup && [mOutlineView isExpandable: aBookmark];
|
||||
|
||||
// First, Show/Hide the appropriate UI
|
||||
if (isGroup) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else if (isFolder) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
// Then, fill with appropriate values from Bookmarks
|
||||
nsAutoString value;
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
||||
[mNameField setStringValue: bookmarkName];
|
||||
NSString* infoForString = [NSString stringWithCString: "Info for "];
|
||||
[[self window] setTitle: [infoForString stringByAppendingString: bookmarkName]];
|
||||
|
||||
if (!isGroup && !isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
if (!isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
else {
|
||||
[[self window] setTitle: [NSString stringWithCString: "Bookmark Info"]];
|
||||
|
||||
[self hideUIElementPair: mNameLabel control: mNameField];
|
||||
[self hideUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
mBookmarkItem = aBookmark;
|
||||
}
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aLabel];
|
||||
[aLabel autorelease];
|
||||
}
|
||||
if ([aControl superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aControl];
|
||||
[aControl autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)hideUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] != nil) {
|
||||
[aLabel removeFromSuperview];
|
||||
[aLabel retain];
|
||||
}
|
||||
if ([aControl superview] != nil) {
|
||||
[aControl removeFromSuperview];
|
||||
[aControl retain];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
CLASS = BookmarkInfoController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mDescriptionField = NSTextField;
|
||||
mDescriptionLabel = NSTextField;
|
||||
mKeywordField = NSTextField;
|
||||
mKeywordLabel = NSTextField;
|
||||
mLocationField = NSTextField;
|
||||
mLocationLabel = NSTextField;
|
||||
mNameField = NSTextField;
|
||||
mNameLabel = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{CLASS = BookmarkItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
addBookmark = id;
|
||||
addFolder = id;
|
||||
beginRenameBookmark = id;
|
||||
cancelRenameBookmarkSheet = id;
|
||||
deleteBookmarks = id;
|
||||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
mRenameTextField = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>158 201 366 258 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -48,6 +48,8 @@
|
|||
class BookmarksService;
|
||||
class nsIAtom;
|
||||
|
||||
@class BookmarkInfoController;
|
||||
|
||||
@interface BookmarksDataSource : NSObject
|
||||
{
|
||||
BookmarksService* mBookmarks;
|
||||
|
@ -58,7 +60,11 @@ class nsIAtom;
|
|||
IBOutlet id mRenameSheet;
|
||||
IBOutlet NSTextField* mRenameTextField;
|
||||
|
||||
IBOutlet id mBookmarkInfoPanel;
|
||||
|
||||
NSString* mCachedHref;
|
||||
|
||||
BookmarkInfoController* mBookmarkInfoController;
|
||||
}
|
||||
|
||||
-(id) init;
|
||||
|
@ -85,6 +91,7 @@ class nsIAtom;
|
|||
-(IBAction)openBookmarkInNewWindow:(id)aSender;
|
||||
|
||||
-(void)openBookmarkGroup:(id)aTabView groupElement:(nsIDOMElement*)aFolder;
|
||||
-(IBAction)showBookmarkInfo:(id)aSender;
|
||||
|
||||
// Datasource methods.
|
||||
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
|
||||
|
@ -170,8 +177,11 @@ public:
|
|||
static nsIAtom* gFolderAtom;
|
||||
static nsIAtom* gNameAtom;
|
||||
static nsIAtom* gHrefAtom;
|
||||
static nsIAtom* gKeywordAtom;
|
||||
static nsIAtom* gDescriptionAtom;
|
||||
static nsIAtom* gBookmarkAtom;
|
||||
static nsIAtom* gOpenAtom;
|
||||
static nsIAtom* gGroupAtom;
|
||||
static nsIDocument* gBookmarks;
|
||||
static nsVoidArray* gInstances;
|
||||
static int CHInsertNone;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#import "CHBrowserView.h"
|
||||
#import "BookmarksService.h"
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -70,6 +71,7 @@
|
|||
|
||||
-(void) dealloc
|
||||
{
|
||||
[mBookmarkInfoController release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -329,7 +331,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
mBookmarks->OpenBookmarkGroup([mBrowserWindowController getTabBrowser], elt);
|
||||
else if ([mOutlineView isExpandable: item]) {
|
||||
|
@ -460,7 +462,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
[attachmentAttrStringCell setImage:[NSImage imageNamed:@"groupbookmark"]];
|
||||
else
|
||||
|
@ -692,12 +694,13 @@
|
|||
NSURL* urlToLoad = [NSURL URLWithString: hrefStr];
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (group.IsEmpty())
|
||||
[mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO];
|
||||
else
|
||||
else {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
[mBrowserWindowController openNewWindowWithGroup: elt loadInBackground: NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,6 +709,32 @@
|
|||
mBookmarks->OpenBookmarkGroup(aTabView, aFolder);
|
||||
}
|
||||
|
||||
-(IBAction)showBookmarkInfo:(id)aSender
|
||||
{
|
||||
if (!mBookmarkInfoController)
|
||||
mBookmarkInfoController = [[BookmarkInfoController alloc] initWithOutlineView: mOutlineView];
|
||||
|
||||
[mBookmarkInfoController showWindow:mBookmarkInfoController];
|
||||
|
||||
int index = [mOutlineView selectedRow];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
|
||||
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
if (index == -1) {
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:NULL];
|
||||
}
|
||||
else {
|
||||
BookmarkItem* item = [mOutlineView itemAtRow:index];
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem:(NSMenuItem*)aMenuItem
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
|
@ -716,8 +745,7 @@
|
|||
BOOL isBookmark = [mOutlineView isExpandable:item] == NO;
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
|
||||
if (([aMenuItem action] == @selector(openBookmarkInNewWindow:))) {
|
||||
|
@ -796,9 +824,12 @@ NSMutableDictionary* BookmarksService::gDictionary = nil;
|
|||
MainController* BookmarksService::gMainController = nil;
|
||||
NSMenu* BookmarksService::gBookmarksMenu = nil;
|
||||
nsIDOMElement* BookmarksService::gToolbarRoot = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gBookmarkAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gDescriptionAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gGroupAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gHrefAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gKeywordAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gNameAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gOpenAtom = nsnull;
|
||||
nsVoidArray* BookmarksService::gInstances = nsnull;
|
||||
|
@ -994,6 +1025,9 @@ BookmarksService::AddObserver()
|
|||
gNameAtom = NS_NewAtom("name");
|
||||
gHrefAtom = NS_NewAtom("href");
|
||||
gOpenAtom = NS_NewAtom("open");
|
||||
gKeywordAtom = NS_NewAtom("id");
|
||||
gDescriptionAtom = NS_NewAtom("description");
|
||||
gGroupAtom = NS_NewAtom("group");
|
||||
gInstances = new nsVoidArray();
|
||||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
|
@ -1281,8 +1315,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||
aChild->GetTag(*getter_AddRefs(tagName));
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aChild));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
aChild->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
|
||||
if (group.IsEmpty() && tagName == gFolderAtom) {
|
||||
NSMenu* menu = [[[NSMenu alloc] initWithTitle: title] autorelease];
|
||||
|
@ -1314,11 +1347,12 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||
|
||||
// Get the content node.
|
||||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
if (!group.IsEmpty())
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
return OpenBookmarkGroup([aController getTabBrowser], elt);
|
||||
}
|
||||
|
||||
// Get the href attribute. This is the URL we want to load.
|
||||
nsAutoString href;
|
||||
|
@ -1562,7 +1596,7 @@ BookmarksService::CreateIconForBookmark(nsIDOMElement* aElement)
|
|||
return [NSImage imageNamed:@"folder"];
|
||||
|
||||
nsAutoString group;
|
||||
aElement->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
return [NSImage imageNamed:@"smallgroup"];
|
||||
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>124</key>
|
||||
<string>305 659 170 162 0 0 1152 848 </string>
|
||||
<string>345 807 170 162 0 0 1280 1002 </string>
|
||||
<key>160</key>
|
||||
<string>478 172 195 666 0 0 1152 848 </string>
|
||||
<key>28</key>
|
||||
|
@ -43,8 +43,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>10</integer>
|
||||
<integer>394</integer>
|
||||
<integer>124</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
|
|
Двоичный файл не отображается.
|
@ -28,6 +28,7 @@
|
|||
F52F87CD027D75C301A80165,
|
||||
F52F87CE027D75C301A80165,
|
||||
2E748B73029A448D4B000102,
|
||||
F5383FCD02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Classes;
|
||||
|
@ -414,6 +415,7 @@
|
|||
2E293A01027F33604B000102,
|
||||
2EEC3E63028138724B000102,
|
||||
2E748B74029A448D4B000102,
|
||||
F5383FCE02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
name = Headers;
|
||||
|
@ -477,6 +479,7 @@
|
|||
F540BD1B029ED15301026D5D,
|
||||
F540BD1D029ED17901026D5D,
|
||||
F5007D3B02A3DA4801010220,
|
||||
F5388AC202ACBC9001A80164,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
name = "Bundle Resources";
|
||||
|
@ -517,6 +520,7 @@
|
|||
2E293A02027F33604B000102,
|
||||
2EEC3E64028138724B000102,
|
||||
2E748B75029A448D4B000102,
|
||||
F5383FCF02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
name = Sources;
|
||||
|
@ -1048,6 +1052,7 @@
|
|||
F52F87CB027D75C301A80165,
|
||||
F52F87CC027D75C301A80165,
|
||||
2E748B72029A448D4B000102,
|
||||
F5383FCC02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Headers;
|
||||
|
@ -1854,6 +1859,39 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCC02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.h;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCD02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.mm;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCE02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCC02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCF02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCD02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5388AC102ACBC8F01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoPanel.nib;
|
||||
refType = 4;
|
||||
};
|
||||
F5388AC202ACBC9001A80164 = {
|
||||
fileRef = F5388AC102ACBC8F01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F538DFAE023B36A7010001CA = {
|
||||
children = (
|
||||
F538DFAF023B3739010001CA,
|
||||
|
@ -3141,6 +3179,7 @@
|
|||
F58A94F2023F10CA010001CA = {
|
||||
children = (
|
||||
29B97319FDCFA39411CA2CEA,
|
||||
F5388AC102ACBC8F01A80164,
|
||||
F51842FC0206176901A966FE,
|
||||
F5247C2D02289FD9013DD99A,
|
||||
F5173958020CE1E50189DA0C,
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
CLASS = BookmarkInfoController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mDescriptionField = NSTextField;
|
||||
mDescriptionLabel = NSTextField;
|
||||
mKeywordField = NSTextField;
|
||||
mKeywordLabel = NSTextField;
|
||||
mLocationField = NSTextField;
|
||||
mLocationLabel = NSTextField;
|
||||
mNameField = NSTextField;
|
||||
mNameLabel = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{CLASS = BookmarkItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
addBookmark = id;
|
||||
addFolder = id;
|
||||
beginRenameBookmark = id;
|
||||
cancelRenameBookmarkSheet = id;
|
||||
deleteBookmarks = id;
|
||||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
mRenameTextField = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>158 201 366 258 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -11,10 +11,12 @@
|
|||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>124</key>
|
||||
<string>305 659 170 162 0 0 1152 848 </string>
|
||||
<string>345 807 170 162 0 0 1280 1002 </string>
|
||||
<key>160</key>
|
||||
<string>478 172 195 666 0 0 1152 848 </string>
|
||||
<key>28</key>
|
||||
|
@ -43,8 +43,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>10</integer>
|
||||
<integer>394</integer>
|
||||
<integer>124</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
|
|
Двоичный файл не отображается.
|
@ -28,6 +28,7 @@
|
|||
F52F87CD027D75C301A80165,
|
||||
F52F87CE027D75C301A80165,
|
||||
2E748B73029A448D4B000102,
|
||||
F5383FCD02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Classes;
|
||||
|
@ -414,6 +415,7 @@
|
|||
2E293A01027F33604B000102,
|
||||
2EEC3E63028138724B000102,
|
||||
2E748B74029A448D4B000102,
|
||||
F5383FCE02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
name = Headers;
|
||||
|
@ -477,6 +479,7 @@
|
|||
F540BD1B029ED15301026D5D,
|
||||
F540BD1D029ED17901026D5D,
|
||||
F5007D3B02A3DA4801010220,
|
||||
F5388AC202ACBC9001A80164,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
name = "Bundle Resources";
|
||||
|
@ -517,6 +520,7 @@
|
|||
2E293A02027F33604B000102,
|
||||
2EEC3E64028138724B000102,
|
||||
2E748B75029A448D4B000102,
|
||||
F5383FCF02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
name = Sources;
|
||||
|
@ -1048,6 +1052,7 @@
|
|||
F52F87CB027D75C301A80165,
|
||||
F52F87CC027D75C301A80165,
|
||||
2E748B72029A448D4B000102,
|
||||
F5383FCC02AC8F8E01A80164,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Headers;
|
||||
|
@ -1854,6 +1859,39 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCC02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.h;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCD02AC8F8E01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoController.mm;
|
||||
refType = 4;
|
||||
};
|
||||
F5383FCE02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCC02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5383FCF02AC8F8E01A80164 = {
|
||||
fileRef = F5383FCD02AC8F8E01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5388AC102ACBC8F01A80164 = {
|
||||
isa = PBXFileReference;
|
||||
path = BookmarkInfoPanel.nib;
|
||||
refType = 4;
|
||||
};
|
||||
F5388AC202ACBC9001A80164 = {
|
||||
fileRef = F5388AC102ACBC8F01A80164;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F538DFAE023B36A7010001CA = {
|
||||
children = (
|
||||
F538DFAF023B3739010001CA,
|
||||
|
@ -3141,6 +3179,7 @@
|
|||
F58A94F2023F10CA010001CA = {
|
||||
children = (
|
||||
29B97319FDCFA39411CA2CEA,
|
||||
F5388AC102ACBC8F01A80164,
|
||||
F51842FC0206176901A966FE,
|
||||
F5247C2D02289FD9013DD99A,
|
||||
F5173958020CE1E50189DA0C,
|
||||
|
|
45
chimera/resources/localized/English.lproj/BookmarkInfoPanel.nib/classes.nib
сгенерированный
Normal file
45
chimera/resources/localized/English.lproj/BookmarkInfoPanel.nib/classes.nib
сгенерированный
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
CLASS = BookmarkInfoController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mDescriptionField = NSTextField;
|
||||
mDescriptionLabel = NSTextField;
|
||||
mKeywordField = NSTextField;
|
||||
mKeywordLabel = NSTextField;
|
||||
mLocationField = NSTextField;
|
||||
mLocationLabel = NSTextField;
|
||||
mNameField = NSTextField;
|
||||
mNameLabel = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{CLASS = BookmarkItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
addBookmark = id;
|
||||
addFolder = id;
|
||||
beginRenameBookmark = id;
|
||||
cancelRenameBookmarkSheet = id;
|
||||
deleteBookmarks = id;
|
||||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
mRenameTextField = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
16
chimera/resources/localized/English.lproj/BookmarkInfoPanel.nib/info.nib
сгенерированный
Normal file
16
chimera/resources/localized/English.lproj/BookmarkInfoPanel.nib/info.nib
сгенерированный
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>158 201 366 258 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичные данные
chimera/resources/localized/English.lproj/BookmarkInfoPanel.nib/objects.nib
сгенерированный
Normal file
Двоичные данные
chimera/resources/localized/English.lproj/BookmarkInfoPanel.nib/objects.nib
сгенерированный
Normal file
Двоичный файл не отображается.
|
@ -11,10 +11,12 @@
|
|||
doRenameBookmarkSheet = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
showBookmarkInfo = id;
|
||||
};
|
||||
CLASS = BookmarksDataSource;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
mBookmarkInfoPanel = id;
|
||||
mBrowserWindowController = id;
|
||||
mOutlineView = id;
|
||||
mRenameSheet = id;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>124</key>
|
||||
<string>305 659 170 162 0 0 1152 848 </string>
|
||||
<string>345 807 170 162 0 0 1280 1002 </string>
|
||||
<key>160</key>
|
||||
<string>478 172 195 666 0 0 1152 848 </string>
|
||||
<key>28</key>
|
||||
|
@ -43,8 +43,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>10</integer>
|
||||
<integer>394</integer>
|
||||
<integer>124</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q125</string>
|
||||
|
|
Двоичные данные
chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичные данные
chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "BookmarksService.h"
|
||||
|
||||
@interface BookmarkInfoController : NSWindowController {
|
||||
IBOutlet NSTextField* mNameField;
|
||||
IBOutlet NSTextField* mLocationField;
|
||||
IBOutlet NSTextField* mKeywordField;
|
||||
IBOutlet NSTextField* mDescriptionField;
|
||||
IBOutlet NSTextField* mNameLabel;
|
||||
IBOutlet NSTextField* mLocationLabel;
|
||||
IBOutlet NSTextField* mKeywordLabel;
|
||||
IBOutlet NSTextField* mDescriptionLabel;
|
||||
|
||||
BookmarkItem* mBookmarkItem;
|
||||
|
||||
NSOutlineView* mOutlineView;
|
||||
}
|
||||
|
||||
-(id)initWithOutlineView: (id)aOutlineView;
|
||||
|
||||
-(void)setBookmark:(BookmarkItem*)aBookmark;
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control: (id) aControl;
|
||||
-(void)hideUIElementPair: (id)aLabel control: (id) aControl;
|
||||
|
||||
@end
|
|
@ -0,0 +1,196 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINamespaceManager.h"
|
||||
|
||||
@implementation BookmarkInfoController
|
||||
|
||||
-(id) init
|
||||
{
|
||||
[mNameField setDelegate: self];
|
||||
[mLocationField setDelegate: self];
|
||||
[mKeywordField setDelegate: self];
|
||||
[mDescriptionField setDelegate: self];
|
||||
|
||||
[super initWithWindowNibName:@"BookmarkInfoPanel"];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithOutlineView: (id)aOutlineView
|
||||
{
|
||||
mOutlineView = aOutlineView;
|
||||
|
||||
return [self init];
|
||||
}
|
||||
|
||||
-(void)windowDidLoad
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
-(void)controlTextDidEndEditing: (NSNotification*) aNotification
|
||||
{
|
||||
if (!mBookmarkItem)
|
||||
return;
|
||||
|
||||
unsigned int len;
|
||||
PRUnichar* buffer;
|
||||
nsXPIDLString buf;
|
||||
|
||||
// Name
|
||||
len = [[mNameField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mNameField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, buf, PR_TRUE);
|
||||
|
||||
// Location
|
||||
len = [[mLocationField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mLocationField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, buf, PR_TRUE);
|
||||
|
||||
// Keyword
|
||||
len = [[mKeywordField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mKeywordField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, buf, PR_TRUE);
|
||||
|
||||
// Description
|
||||
len = [[mDescriptionField stringValue] length];
|
||||
buffer = new PRUnichar[len + 1];
|
||||
if (!buffer) return;
|
||||
|
||||
[[mDescriptionField stringValue] getCharacters:buffer];
|
||||
buffer[len] = (PRUnichar)'\0';
|
||||
|
||||
buf.Adopt(buffer);
|
||||
[mBookmarkItem contentNode]->SetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, buf, PR_TRUE);
|
||||
|
||||
[mOutlineView reloadItem: mBookmarkItem reloadChildren: NO];
|
||||
}
|
||||
|
||||
-(void)setBookmark: (BookmarkItem*) aBookmark
|
||||
{
|
||||
if (aBookmark) {
|
||||
nsAutoString group;
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
BOOL isFolder = !isGroup && [mOutlineView isExpandable: aBookmark];
|
||||
|
||||
// First, Show/Hide the appropriate UI
|
||||
if (isGroup) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else if (isFolder) {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
else {
|
||||
[self showUIElementPair: mNameLabel control: mNameField];
|
||||
[self showUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self showUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self showUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
// Then, fill with appropriate values from Bookmarks
|
||||
nsAutoString value;
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, value);
|
||||
NSString* bookmarkName = [NSString stringWithCharacters: value.get() length: value.Length()];
|
||||
[mNameField setStringValue: bookmarkName];
|
||||
NSString* infoForString = [NSString stringWithCString: "Info for "];
|
||||
[[self window] setTitle: [infoForString stringByAppendingString: bookmarkName]];
|
||||
|
||||
if (!isGroup && !isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, value);
|
||||
[mLocationField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
if (!isFolder) {
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gKeywordAtom, value);
|
||||
[mKeywordField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
|
||||
[aBookmark contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gDescriptionAtom, value);
|
||||
[mDescriptionField setStringValue: [NSString stringWithCharacters: value.get() length: value.Length()]];
|
||||
}
|
||||
else {
|
||||
[[self window] setTitle: [NSString stringWithCString: "Bookmark Info"]];
|
||||
|
||||
[self hideUIElementPair: mNameLabel control: mNameField];
|
||||
[self hideUIElementPair: mDescriptionLabel control: mDescriptionField];
|
||||
[self hideUIElementPair: mKeywordLabel control: mKeywordField];
|
||||
[self hideUIElementPair: mLocationLabel control: mLocationField];
|
||||
}
|
||||
|
||||
mBookmarkItem = aBookmark;
|
||||
}
|
||||
|
||||
-(void)showUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aLabel];
|
||||
[aLabel autorelease];
|
||||
}
|
||||
if ([aControl superview] == nil) {
|
||||
[[[self window] contentView] addSubview: aControl];
|
||||
[aControl autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)hideUIElementPair: (id)aLabel control:(id)aControl
|
||||
{
|
||||
if ([aLabel superview] != nil) {
|
||||
[aLabel removeFromSuperview];
|
||||
[aLabel retain];
|
||||
}
|
||||
if ([aControl superview] != nil) {
|
||||
[aControl removeFromSuperview];
|
||||
[aControl retain];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -48,6 +48,8 @@
|
|||
class BookmarksService;
|
||||
class nsIAtom;
|
||||
|
||||
@class BookmarkInfoController;
|
||||
|
||||
@interface BookmarksDataSource : NSObject
|
||||
{
|
||||
BookmarksService* mBookmarks;
|
||||
|
@ -58,7 +60,11 @@ class nsIAtom;
|
|||
IBOutlet id mRenameSheet;
|
||||
IBOutlet NSTextField* mRenameTextField;
|
||||
|
||||
IBOutlet id mBookmarkInfoPanel;
|
||||
|
||||
NSString* mCachedHref;
|
||||
|
||||
BookmarkInfoController* mBookmarkInfoController;
|
||||
}
|
||||
|
||||
-(id) init;
|
||||
|
@ -85,6 +91,7 @@ class nsIAtom;
|
|||
-(IBAction)openBookmarkInNewWindow:(id)aSender;
|
||||
|
||||
-(void)openBookmarkGroup:(id)aTabView groupElement:(nsIDOMElement*)aFolder;
|
||||
-(IBAction)showBookmarkInfo:(id)aSender;
|
||||
|
||||
// Datasource methods.
|
||||
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
|
||||
|
@ -170,8 +177,11 @@ public:
|
|||
static nsIAtom* gFolderAtom;
|
||||
static nsIAtom* gNameAtom;
|
||||
static nsIAtom* gHrefAtom;
|
||||
static nsIAtom* gKeywordAtom;
|
||||
static nsIAtom* gDescriptionAtom;
|
||||
static nsIAtom* gBookmarkAtom;
|
||||
static nsIAtom* gOpenAtom;
|
||||
static nsIAtom* gGroupAtom;
|
||||
static nsIDocument* gBookmarks;
|
||||
static nsVoidArray* gInstances;
|
||||
static int CHInsertNone;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#import "CHBrowserView.h"
|
||||
#import "BookmarksService.h"
|
||||
#import "BookmarkInfoController.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -70,6 +71,7 @@
|
|||
|
||||
-(void) dealloc
|
||||
{
|
||||
[mBookmarkInfoController release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -329,7 +331,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
mBookmarks->OpenBookmarkGroup([mBrowserWindowController getTabBrowser], elt);
|
||||
else if ([mOutlineView isExpandable: item]) {
|
||||
|
@ -460,7 +462,7 @@
|
|||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
[attachmentAttrStringCell setImage:[NSImage imageNamed:@"groupbookmark"]];
|
||||
else
|
||||
|
@ -692,12 +694,13 @@
|
|||
NSURL* urlToLoad = [NSURL URLWithString: hrefStr];
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
if (group.IsEmpty())
|
||||
[mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO];
|
||||
else
|
||||
else {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
[mBrowserWindowController openNewWindowWithGroup: elt loadInBackground: NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,6 +709,32 @@
|
|||
mBookmarks->OpenBookmarkGroup(aTabView, aFolder);
|
||||
}
|
||||
|
||||
-(IBAction)showBookmarkInfo:(id)aSender
|
||||
{
|
||||
if (!mBookmarkInfoController)
|
||||
mBookmarkInfoController = [[BookmarkInfoController alloc] initWithOutlineView: mOutlineView];
|
||||
|
||||
[mBookmarkInfoController showWindow:mBookmarkInfoController];
|
||||
|
||||
int index = [mOutlineView selectedRow];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
|
||||
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
if (index == -1) {
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:NULL];
|
||||
}
|
||||
else {
|
||||
BookmarkItem* item = [mOutlineView itemAtRow:index];
|
||||
if (mBookmarkInfoController)
|
||||
[mBookmarkInfoController setBookmark:item];
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem:(NSMenuItem*)aMenuItem
|
||||
{
|
||||
int index = [mOutlineView selectedRow];
|
||||
|
@ -716,8 +745,7 @@
|
|||
BOOL isBookmark = [mOutlineView isExpandable:item] == NO;
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
[item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gGroupAtom, group);
|
||||
BOOL isGroup = !group.IsEmpty();
|
||||
|
||||
if (([aMenuItem action] == @selector(openBookmarkInNewWindow:))) {
|
||||
|
@ -796,9 +824,12 @@ NSMutableDictionary* BookmarksService::gDictionary = nil;
|
|||
MainController* BookmarksService::gMainController = nil;
|
||||
NSMenu* BookmarksService::gBookmarksMenu = nil;
|
||||
nsIDOMElement* BookmarksService::gToolbarRoot = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gBookmarkAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gDescriptionAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gFolderAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gGroupAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gHrefAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gKeywordAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gNameAtom = nsnull;
|
||||
nsIAtom* BookmarksService::gOpenAtom = nsnull;
|
||||
nsVoidArray* BookmarksService::gInstances = nsnull;
|
||||
|
@ -994,6 +1025,9 @@ BookmarksService::AddObserver()
|
|||
gNameAtom = NS_NewAtom("name");
|
||||
gHrefAtom = NS_NewAtom("href");
|
||||
gOpenAtom = NS_NewAtom("open");
|
||||
gKeywordAtom = NS_NewAtom("id");
|
||||
gDescriptionAtom = NS_NewAtom("description");
|
||||
gGroupAtom = NS_NewAtom("group");
|
||||
gInstances = new nsVoidArray();
|
||||
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
|
@ -1281,8 +1315,7 @@ BookmarksService::AddMenuBookmark(NSMenu* aMenu, nsIContent* aParent, nsIContent
|
|||
aChild->GetTag(*getter_AddRefs(tagName));
|
||||
|
||||
nsAutoString group;
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aChild));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
aChild->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
|
||||
if (group.IsEmpty() && tagName == gFolderAtom) {
|
||||
NSMenu* menu = [[[NSMenu alloc] initWithTitle: title] autorelease];
|
||||
|
@ -1314,11 +1347,12 @@ BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMen
|
|||
|
||||
// Get the content node.
|
||||
nsIContent* content = [item contentNode];
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
|
||||
nsAutoString group;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
if (!group.IsEmpty())
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface([item contentNode]));
|
||||
return OpenBookmarkGroup([aController getTabBrowser], elt);
|
||||
}
|
||||
|
||||
// Get the href attribute. This is the URL we want to load.
|
||||
nsAutoString href;
|
||||
|
@ -1562,7 +1596,7 @@ BookmarksService::CreateIconForBookmark(nsIDOMElement* aElement)
|
|||
return [NSImage imageNamed:@"folder"];
|
||||
|
||||
nsAutoString group;
|
||||
aElement->GetAttribute(NS_LITERAL_STRING("group"), group);
|
||||
content->GetAttr(kNameSpaceID_None, gGroupAtom, group);
|
||||
if (!group.IsEmpty())
|
||||
return [NSImage imageNamed:@"smallgroup"];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче