Diff for /chimera/BookmarksService.mm between versions 1.24 and 1.25

version 1.24, 2002/04/17 23:55:25 version 1.25, 2002/04/18 00:27:51
Line 206 Line 206
   mBookmarks->BookmarkAdded(mCachedParent, childContent);    mBookmarks->BookmarkAdded(mCachedParent, childContent);
 }  }
   
-(IBAction)deleteBookmark: (id)aSender-(IBAction)deleteBookmarks: (id)aSender
 {  {
    if (!mBookmarks)  if (!mBookmarks)
        return;    return;
    
    int index = [mOutlineView selectedRow];  int index = [mOutlineView selectedRow];
    if (index == -1)  if (index == -1)
        return;    return;
          if ([mOutlineView numberOfSelectedRows] == 1) {
     BookmarkItem* item = [mOutlineView itemAtRow: index];      BookmarkItem* item = [mOutlineView itemAtRow: index];
    nsCOMPtr<nsIContent> content = [item contentNode];    [self deleteBookmark: item];
    nsCOMPtr<nsIDOMElement> child(do_QueryInterface(content)); 
    nsCOMPtr<nsIDOMNode> parent; 
    child->GetParentNode(getter_AddRefs(parent)); 
    nsCOMPtr<nsIContent> parentContent(do_QueryInterface(parent)); 
    nsCOMPtr<nsIDOMNode> dummy; 
    parent->RemoveChild(child, getter_AddRefs(dummy)); 
    mBookmarks->BookmarkRemoved(parentContent, content); 
     
     int total = [mOutlineView numberOfRows];      int total = [mOutlineView numberOfRows];
     if (index == total)      if (index == total)
        index--;      index--;
         
     [mOutlineView selectRow: index byExtendingSelection: NO];      [mOutlineView selectRow: index byExtendingSelection: NO];
     }
     else {
       NSMutableArray* itemsToDelete = [[[NSMutableArray alloc] init] autorelease];
       NSEnumerator* selRows = [mOutlineView selectedRowEnumerator];
       for (NSNumber* currIndex = [selRows nextObject];
            currIndex != nil;
            currIndex = [selRows nextObject]) {
         index = [currIndex intValue];
         BookmarkItem* item = [mOutlineView itemAtRow: index];
         [itemsToDelete addObject: item];
       }
   
       int count = [itemsToDelete count];
       for (int i = 0; i < count; i++) {
         BookmarkItem* item = [itemsToDelete objectAtIndex: i];
         [self deleteBookmark: item];      
       }
     }
   }       
   
   -(void)deleteBookmark:(id)aItem
   {
     nsCOMPtr<nsIContent> content = [aItem contentNode];
     nsCOMPtr<nsIDOMElement> child(do_QueryInterface(content));
     if (child == BookmarksService::gToolbarRoot)
       return; // Don't allow the personal toolbar to be deleted.
     
     nsCOMPtr<nsIDOMNode> parent;
     child->GetParentNode(getter_AddRefs(parent));
     nsCOMPtr<nsIContent> parentContent(do_QueryInterface(parent));
     nsCOMPtr<nsIDOMNode> dummy;
     parent->RemoveChild(child, getter_AddRefs(dummy));
     mBookmarks->BookmarkRemoved(parentContent, content);
 }  }
   
 -(IBAction)openBookmark: (id)aSender  -(IBAction)openBookmark: (id)aSender

Removed from v.1.24  
changed lines
  Added in v.1.25


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