Diff for /chimera/BookmarksService.mm between versions 1.29 and 1.32

version 1.29, 2002/04/20 00:02:55 version 1.32, 2002/04/20 01:20:53
Line 58 Line 58
   
 -(id) init  -(id) init
 {  {
    [super init];    if ( (self = [super init]) ) {
    mBookmarks = nsnull;        mBookmarks = nsnull;
    mCachedHref = nil;        mCachedHref = nil;
     }
     return self;      return self;
 }  }
   
Line 429 Line 430
                                                                                           atIndex:0                                                                                            atIndex:0
                                                                                    effectiveRange:nil] attachmentCell];                                                                                     effectiveRange:nil] attachmentCell];
         //Figure out which image to add, and set the cell's image.          //Figure out which image to add, and set the cell's image.
           // XXXdwh Use the bookmark groups image for groups.
         if ( [self outlineView:outlineView isItemExpandable:item] ) {          if ( [self outlineView:outlineView isItemExpandable:item] ) {
             [attachmentAttrStringCell setImage:[NSImage imageNamed:@"folder"]];              [attachmentAttrStringCell setImage:[NSImage imageNamed:@"folder"]];
         } else {          } else {
Line 911  BookmarksService::AddMenuBookmark(NSMenu Line 913  BookmarksService::AddMenuBookmark(NSMenu
   nsCOMPtr<nsIAtom> tagName;    nsCOMPtr<nsIAtom> tagName;
   aChild->GetTag(*getter_AddRefs(tagName));    aChild->GetTag(*getter_AddRefs(tagName));
   
  if (tagName == gFolderAtom) {  nsAutoString group;
   nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aChild));
   elt->GetAttribute(NS_LITERAL_STRING("group"), group);
   
   if (group.IsEmpty() && tagName == gFolderAtom) {
     NSMenu* menu = [[[NSMenu alloc] initWithTitle: title] autorelease];      NSMenu* menu = [[[NSMenu alloc] initWithTitle: title] autorelease];
     [aMenu setSubmenu: menu forItem: menuItem];      [aMenu setSubmenu: menu forItem: menuItem];
     [menu setAutoenablesItems: NO];      [menu setAutoenablesItems: NO];
Line 930  BookmarksService::AddMenuBookmark(NSMenu Line 936  BookmarksService::AddMenuBookmark(NSMenu
 void   void 
 BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMenuItem)  BookmarksService::OpenMenuBookmark(BrowserWindowController* aController, id aMenuItem)
 {  {
    // Get the corresponding bookmark item.  // Get the corresponding bookmark item.
    BookmarkItem* item = [gDictionary objectForKey: [NSNumber numberWithInt: [aMenuItem tag]]];  BookmarkItem* item = [gDictionary objectForKey: [NSNumber numberWithInt: [aMenuItem tag]]];
        
    // Get the content node.  // Get the content node.
    nsIContent* content = [item contentNode];  nsIContent* content = [item contentNode];
          nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
    // Get the href attribute.  This is the URL we want to load.  nsAutoString group;
    nsAutoString href;  elt->GetAttribute(NS_LITERAL_STRING("group"), group);
    content->GetAttr(kNameSpaceID_None, gHrefAtom, href);  if (!group.IsEmpty())
    nsCAutoString cref; cref.AssignWithConversion(href);    return OpenBookmarkGroup([aController getTabBrowser], elt);
    if (cref.IsEmpty())  
        return;  // Get the href attribute.  This is the URL we want to load.
          nsAutoString href;
    NSString* url = [NSString stringWithCString: cref.get()];  content->GetAttr(kNameSpaceID_None, gHrefAtom, href);
      nsCAutoString cref; cref.AssignWithConversion(href);
    // Now load the URL in the window.  if (cref.IsEmpty())
    [aController loadURL:[NSURL URLWithString: url]];    return;
    
    // Focus and activate our content area.  NSString* url = [NSString stringWithCString: cref.get()];
    [[[aController getMyBrowserView] getBrowserView] setActive: YES];
   // Now load the URL in the window.
   [aController loadURL:[NSURL URLWithString: url]];
 
   // Focus and activate our content area.
   [[[aController getMyBrowserView] getBrowserView] setActive: YES];
 }  }
   
 void  void
Line 991  BookmarksService::OpenBookmarkGroup(id a Line 1002  BookmarksService::OpenBookmarkGroup(id a
     currentIndex++;      currentIndex++;
   }    }
   
  // XXXdwh Select and activate the first tab.  // Select and activate the first tab.
   [aTabView selectTabViewItemAtIndex: 0];
   [[[[aTabView tabViewItemAtIndex: 0] view] getBrowserView] setActive: YES];
 }  }

Removed from v.1.29  
changed lines
  Added in v.1.32


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>