Diff for /chimera/BookmarksService.mm between versions 1.5 and 1.6

version 1.5, 2002/02/09 08:12:33 version 1.6, 2002/02/09 20:31:06
Line 20 Line 20
 #include "nsIFile.h"  #include "nsIFile.h"
 #include "nsAppDirectoryServiceDefs.h"  #include "nsAppDirectoryServiceDefs.h"
 #include "nsIXMLHttpRequest.h"  #include "nsIXMLHttpRequest.h"
   #include "nsIDOMSerializer.h"
 #include "nsNetUtil.h"  #include "nsNetUtil.h"
 #include "nsINamespaceManager.h"  #include "nsINamespaceManager.h"
 #include "nsIXBLService.h"  #include "nsIXBLService.h"
Line 119 Line 120
   
 -(IBAction)deleteBookmark: (id)aSender  -(IBAction)deleteBookmark: (id)aSender
 {  {
       if (!mBookmarks)
           return;
       
       int index = [mOutlineView selectedRow];
       if (index == -1)
           return;
           
       BookmarkItem* item = [mOutlineView itemAtRow: index];
       nsCOMPtr<nsIContent> content = [item contentNode];
       nsCOMPtr<nsIDOMElement> child(do_QueryInterface(content));
       nsCOMPtr<nsIDOMNode> parent;
       child->GetParentNode(getter_AddRefs(parent));
       nsCOMPtr<nsIDOMNode> dummy;
       parent->RemoveChild(child, getter_AddRefs(dummy));
       nsCOMPtr<nsIContent> parentContent(do_QueryInterface(parent));
       mBookmarks->NotifyObservers(parentContent, PR_TRUE);
       
       int total = [mOutlineView numberOfRows];
       if (index == total)
           index--;
           
       [mOutlineView selectRow: index byExtendingSelection: NO];
 }  }
   
 -(IBAction)openBookmark: (id)aSender  -(IBAction)openBookmark: (id)aSender
Line 329  BookmarksService::NotifyObservers(nsICon Line 352  BookmarksService::NotifyObservers(nsICon
         BookmarksService* instance = (BookmarksService*)gInstances->ElementAt(i);          BookmarksService* instance = (BookmarksService*)gInstances->ElementAt(i);
         instance->NotifyObserver(aContainer, aReloadChildren);          instance->NotifyObserver(aContainer, aReloadChildren);
     }      }
       
       FlushBookmarks();
 }  }
   
   
Line 337  BookmarksService::NotifyObserver(nsICont Line 362  BookmarksService::NotifyObserver(nsICont
 {  {
     if (!gDictionary)      if (!gDictionary)
         return;          return;
          
    printf("uh. appended!\n"); 
     
     nsCOMPtr<nsIContent> parent;      nsCOMPtr<nsIContent> parent;
     aContainer->GetParent(*getter_AddRefs(parent));      aContainer->GetParent(*getter_AddRefs(parent));
           
Line 402  BookmarksService::RemoveObserver() Line 425  BookmarksService::RemoveObserver()
     }      }
 }  }
   
   void
   BookmarksService::FlushBookmarks()
   {
       nsCOMPtr<nsIFile> bookmarksFile;
       NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(bookmarksFile));
       bookmarksFile->Append("bookmarks.xml");
   
       nsCOMPtr<nsIOutputStream> outputStream;
       NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), bookmarksFile);
   
       nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(gBookmarks));
       
       nsCOMPtr<nsIDOMSerializer> domSerializer(do_CreateInstance(NS_XMLSERIALIZER_CONTRACTID));
       domSerializer->SerializeToStream(domDoc, outputStream, nsnull);
   }

Removed from v.1.5  
changed lines
  Added in v.1.6


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