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

version 1.28, 2002/04/19 19:28:43 version 1.29, 2002/04/20 00:02:55
Line 314 Line 314
   
 -(IBAction)openBookmark: (id)aSender  -(IBAction)openBookmark: (id)aSender
 {  {
    int index = [mOutlineView selectedRow];  int index = [mOutlineView selectedRow];
    if (index == -1)  if (index == -1)
        return;    return;
    
    id item = [mOutlineView itemAtRow: index];  id item = [mOutlineView itemAtRow: index];
    if (!item)  if (!item)
        return;    return;
        
    if ([mOutlineView isExpandable: item]) {  nsIContent* content = [item contentNode];
        if ([mOutlineView isItemExpanded: item])  nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(content));
            [mOutlineView collapseItem: item];  nsAutoString group;
        else  elt->GetAttribute(NS_LITERAL_STRING("group"), group);
            [mOutlineView expandItem: item];  if (!group.IsEmpty())
     mBookmarks->OpenBookmarkGroup([mBrowserWindowController getTabBrowser], elt);
   else if ([mOutlineView isExpandable: item]) {
     if ([mOutlineView isItemExpanded: item])
       [mOutlineView collapseItem: item];
     else
       [mOutlineView expandItem: item];
   }
   else {
     nsAutoString href;
     content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href);
     if (!href.IsEmpty()) {
       nsCAutoString cstr; cstr.AssignWithConversion(href);
       NSString* url = [NSString stringWithCString: cstr.get()];
       [[[mBrowserWindowController getMyBrowserView] getBrowserView] loadURI:[NSURL URLWithString: url] flags:                   NSLoadFlagsNone];
       // Focus and activate our content area.
       [[[mBrowserWindowController getMyBrowserView] getBrowserView] setActive: YES];
     }      }
    else {  }
        nsIContent* content = [item contentNode]; 
        nsAutoString href; 
        content->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, href); 
        if (!href.IsEmpty()) { 
            nsCAutoString cstr; cstr.AssignWithConversion(href); 
            NSString* url = [NSString stringWithCString: cstr.get()]; 
            [[[mBrowserWindowController getMyBrowserView] getBrowserView] loadURI:[NSURL URLWithString: url] flags:NSLoadFlagsNone]; 
            // Focus and activate our content area. 
            [[[mBrowserWindowController getMyBrowserView] getBrowserView] setActive: YES]; 
        } 
    }  
 }  }
   
 - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item  - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item
Line 945  BookmarksService::OpenMenuBookmark(Brows Line 950  BookmarksService::OpenMenuBookmark(Brows
           
     // Focus and activate our content area.      // Focus and activate our content area.
     [[[aController getMyBrowserView] getBrowserView] setActive: YES];      [[[aController getMyBrowserView] getBrowserView] setActive: YES];
 }  
   
   }
   
   void
   BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder)
   {
     // We might conceivably have to make new tabs in order to load all
     // the items in the group.
     int currentIndex = 0;
     int total = [aTabView numberOfTabViewItems];
     nsCOMPtr<nsIDOMNode> child;
     aFolder->GetFirstChild(getter_AddRefs(child));
     while (child) {
       nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(child));
       if (elt) {
         nsAutoString href;
         elt->GetAttribute(NS_LITERAL_STRING("href"), href);
         if (!href.IsEmpty()) {
           nsCAutoString cref; cref.AssignWithConversion(href);
           NSString* url = [NSString stringWithCString: cref.get()];
           NSTabViewItem* tabViewItem = nil;
           if (currentIndex >= total) {
             // We need to make a new tab.
             tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
             MyBrowserView* newView = [[[MyBrowserView alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease];
             [tabViewItem setLabel: @"Untitled"];
             [tabViewItem setView: newView];
             [aTabView addTabViewItem: tabViewItem];
           }
           else
             tabViewItem = [aTabView tabViewItemAtIndex: currentIndex];
   
           [[[tabViewItem view] getBrowserView] loadURI:[NSURL URLWithString: url]
                                                  flags: NSLoadFlagsNone];
         }
       }
       
       nsCOMPtr<nsIDOMNode> temp = child;
       temp->GetNextSibling(getter_AddRefs(child));
       currentIndex++;
     }
   
     // XXXdwh Select and activate the first tab.
   }

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


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