From 45b16a8bafc6d24b42e0b1f477d671fe4e71c812 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Fri, 11 Jun 1999 06:17:15 +0000 Subject: [PATCH] Move bookmarks to xpfe/components. git-svn-id: svn://10.0.0.236/trunk@34763 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/rdf/build/nsRDFCID.h | 4 - mozilla/rdf/build/nsRDFFactory.cpp | 12 - mozilla/rdf/datasource/public/MANIFEST | 1 - mozilla/rdf/datasource/public/Makefile.in | 1 - mozilla/rdf/datasource/public/makefile.win | 1 - .../datasource/public/nsIBookmarkDataSource.h | 48 - mozilla/rdf/datasource/src/Makefile.in | 1 - mozilla/rdf/datasource/src/makefile.win | 1 - .../datasource/src/nsBookmarkDataSource.cpp | 1499 ----------------- .../datasource/src/nsRDFBuiltInDataSources.h | 7 - mozilla/rdf/macbuild/rdf.mcp | Bin 86286 -> 86286 bytes mozilla/rdf/resources/Makefile.in | 12 - mozilla/rdf/resources/bm-panel.xul | 60 - mozilla/rdf/resources/bm-props.xul | 98 -- .../rdf/resources/bookmark-folder-closed.gif | Bin 918 -> 0 bytes .../rdf/resources/bookmark-folder-open.gif | Bin 931 -> 0 bytes mozilla/rdf/resources/bookmark-item.gif | Bin 138 -> 0 bytes mozilla/rdf/resources/bookmarks.css | 126 -- mozilla/rdf/resources/bookmarks.html | 151 -- mozilla/rdf/resources/bookmarks.js | 108 -- mozilla/rdf/resources/bookmarks.xul | 119 -- mozilla/rdf/resources/iefavorite.gif | Bin 256 -> 0 bytes mozilla/rdf/resources/makefile.win | 12 - .../rdf/resources/personal-folder-closed.gif | Bin 938 -> 0 bytes .../rdf/resources/personal-folder-open.gif | Bin 940 -> 0 bytes mozilla/rdf/resources/sidebar-browser.rdf | 4 +- mozilla/rdf/resources/sidebar.css | 32 - 27 files changed, 2 insertions(+), 2295 deletions(-) delete mode 100644 mozilla/rdf/datasource/public/nsIBookmarkDataSource.h delete mode 100644 mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp delete mode 100644 mozilla/rdf/resources/bm-panel.xul delete mode 100644 mozilla/rdf/resources/bm-props.xul delete mode 100644 mozilla/rdf/resources/bookmark-folder-closed.gif delete mode 100644 mozilla/rdf/resources/bookmark-folder-open.gif delete mode 100644 mozilla/rdf/resources/bookmark-item.gif delete mode 100644 mozilla/rdf/resources/bookmarks.css delete mode 100644 mozilla/rdf/resources/bookmarks.html delete mode 100644 mozilla/rdf/resources/bookmarks.js delete mode 100644 mozilla/rdf/resources/bookmarks.xul delete mode 100644 mozilla/rdf/resources/iefavorite.gif delete mode 100644 mozilla/rdf/resources/personal-folder-closed.gif delete mode 100644 mozilla/rdf/resources/personal-folder-open.gif diff --git a/mozilla/rdf/build/nsRDFCID.h b/mozilla/rdf/build/nsRDFCID.h index 5b0d3870516..e42f63a0155 100644 --- a/mozilla/rdf/build/nsRDFCID.h +++ b/mozilla/rdf/build/nsRDFCID.h @@ -42,10 +42,6 @@ #define NS_RDFINMEMORYDATASOURCE_CID \ { 0xbfd0526d, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } -// {E638D760-8687-11d2-B530-000000000000} -#define NS_RDFBOOKMARKDATASOURCE_CID \ -{ 0xe638d760, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } - // {E638D760-8687-11d2-B530-000000000001} #define NS_RDFFILESYSTEMDATASOURCE_CID \ { 0xe638d760, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x01 } } diff --git a/mozilla/rdf/build/nsRDFFactory.cpp b/mozilla/rdf/build/nsRDFFactory.cpp index c8f40a7e04b..54757602294 100644 --- a/mozilla/rdf/build/nsRDFFactory.cpp +++ b/mozilla/rdf/build/nsRDFFactory.cpp @@ -56,7 +56,6 @@ static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); static NS_DEFINE_CID(kGenericFactoryCID, NS_GENERICFACTORY_CID); static NS_DEFINE_CID(kLocalStoreCID, NS_LOCALSTORE_CID); -static NS_DEFINE_CID(kRDFBookmarkDataSourceCID, NS_RDFBOOKMARKDATASOURCE_CID); static NS_DEFINE_CID(kRDFCompositeDataSourceCID, NS_RDFCOMPOSITEDATASOURCE_CID); static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID); static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID); @@ -185,10 +184,6 @@ RDFFactoryImpl::CreateInstance(nsISupports *aOuter, if (NS_FAILED(rv = NS_NewRDFXMLDataSource((nsIRDFXMLDataSource**) &inst))) return rv; } - else if (mClassID.Equals(kRDFBookmarkDataSourceCID)) { - if (NS_FAILED(rv = NS_NewRDFBookmarkDataSource((nsIRDFDataSource**) &inst))) - return rv; - } else if (mClassID.Equals(kRDFFileSystemDataSourceCID)) { if (NS_FAILED(rv = NS_NewRDFFileSystemDataSource((nsIRDFDataSource**) &inst))) return rv; @@ -358,11 +353,6 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath) if (NS_FAILED(rv)) return rv; // register our build-in datasources: - rv = compMgr->RegisterComponent(kRDFBookmarkDataSourceCID, - "Bookmarks", - NS_RDF_DATASOURCE_PROGID_PREFIX "bookmarks", - aPath, PR_TRUE, PR_TRUE); - if (NS_FAILED(rv)) goto done; rv = compMgr->RegisterComponent(kRDFCompositeDataSourceCID, "RDF Composite Data Source", NS_RDF_DATASOURCE_PROGID_PREFIX "composite-datasource", @@ -515,8 +505,6 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* aPath) (nsISupports**)&compMgr); if (NS_FAILED(rv)) return rv; - rv = compMgr->UnregisterComponent(kRDFBookmarkDataSourceCID, aPath); - if (NS_FAILED(rv)) goto done; rv = compMgr->UnregisterComponent(kRDFFileSystemDataSourceCID,aPath); if (NS_FAILED(rv)) goto done; rv = compMgr->UnregisterComponent(kRDFSearchDataSourceCID,aPath); diff --git a/mozilla/rdf/datasource/public/MANIFEST b/mozilla/rdf/datasource/public/MANIFEST index b089af55883..e5cc6359ca7 100644 --- a/mozilla/rdf/datasource/public/MANIFEST +++ b/mozilla/rdf/datasource/public/MANIFEST @@ -1,4 +1,3 @@ -nsIBookmarkDataSource.h nsILocalStore.h nsIRDFFileSystem.h nsIRDFFind.h diff --git a/mozilla/rdf/datasource/public/Makefile.in b/mozilla/rdf/datasource/public/Makefile.in index 5444ad75ed3..6bfb64f7047 100644 --- a/mozilla/rdf/datasource/public/Makefile.in +++ b/mozilla/rdf/datasource/public/Makefile.in @@ -25,7 +25,6 @@ include $(DEPTH)/config/autoconf.mk MODULE = rdf EXPORTS = \ - nsIBookmarkDataSource.h \ nsILocalStore.h \ nsIRDFFileSystem.h \ nsIRDFFind.h \ diff --git a/mozilla/rdf/datasource/public/makefile.win b/mozilla/rdf/datasource/public/makefile.win index 29fdbace525..771a84a087a 100644 --- a/mozilla/rdf/datasource/public/makefile.win +++ b/mozilla/rdf/datasource/public/makefile.win @@ -21,7 +21,6 @@ MODULE=rdf DEPTH=..\..\.. EXPORTS = \ - nsIBookmarkDataSource.h \ nsILocalStore.h \ nsIRDFFileSystem.h \ nsIRDFFind.h \ diff --git a/mozilla/rdf/datasource/public/nsIBookmarkDataSource.h b/mozilla/rdf/datasource/public/nsIBookmarkDataSource.h deleted file mode 100644 index 4c1639273c4..00000000000 --- a/mozilla/rdf/datasource/public/nsIBookmarkDataSource.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -/* - - The global bookmark data source. - - */ - -#ifndef nsIRDFBookmarkDataSource_h__ -#define nsIRDFBookmarkDataSource_h__ - -#include "nscore.h" -#include "nsIRDFDataSource.h" - -// {a82e9300-e4af-11d2-8fdf-0008c70adc7b} -#define NS_IRDFBOOKMARKDATASOURCE_IID \ -{ 0xa82e9300, 0xe4af, 0x11d2, { 0x8f, 0xdf, 0x0, 0x08, 0xc7, 0x0a, 0xdc, 0x7b } } - -class nsIRDFBookmarkDataSource : public nsIRDFDataSource -{ -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFBOOKMARKDATASOURCE_IID; return iid; } - - /** - * Add the specified item to bookmarks - */ - NS_IMETHOD AddBookmark (const char *aURI, const PRUnichar *aOptionalTitle) = 0; - NS_IMETHOD FindBookmarkShortcut (const char *userInput, char **shortcutURL /* out */) = 0; -}; - -#endif /* nsIRDFBookmarkDataSource_h__ */ - diff --git a/mozilla/rdf/datasource/src/Makefile.in b/mozilla/rdf/datasource/src/Makefile.in index c8924c00788..4d3272ba915 100644 --- a/mozilla/rdf/datasource/src/Makefile.in +++ b/mozilla/rdf/datasource/src/Makefile.in @@ -27,7 +27,6 @@ include $(topsrcdir)/config/config.mk LIBRARY_NAME = rdfdatasource_s CPPSRCS = \ - nsBookmarkDataSource.cpp \ nsLocalStore.cpp \ nsFileSystemDataSource.cpp \ nsFindDataSource.cpp \ diff --git a/mozilla/rdf/datasource/src/makefile.win b/mozilla/rdf/datasource/src/makefile.win index a9d5bbec6a9..9a1b9b969ac 100644 --- a/mozilla/rdf/datasource/src/makefile.win +++ b/mozilla/rdf/datasource/src/makefile.win @@ -22,7 +22,6 @@ LIBRARY_NAME=rdfdatasource_s LCFLAGS=-DMOZ_BRPROF CPP_OBJS=\ - .\$(OBJDIR)\nsBookmarkDataSource.obj \ .\$(OBJDIR)\nsFileSystemDataSource.obj \ .\$(OBJDIR)\nsFindDataSource.obj \ .\$(OBJDIR)\nsFTPDataSource.obj \ diff --git a/mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp b/mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp deleted file mode 100644 index e2be463b686..00000000000 --- a/mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp +++ /dev/null @@ -1,1499 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -/* - A data source that reads the 4.x "bookmarks.html" file and - constructs an in-memory data source. - */ - -#include "nsIRDFContainer.h" -#include "nsIRDFContainerUtils.h" -#include "nsIRDFDataSource.h" -#include "nsIRDFNode.h" -#include "nsIRDFService.h" -#include "nsIServiceManager.h" -#include "nsFileSpec.h" -#include "nsFileStream.h" -#include "nsSpecialSystemDirectory.h" -#include "nsRDFCID.h" -#include "nsString.h" -#include "nsVoidArray.h" -#include "nsXPIDLString.h" -#include "prio.h" -#include "rdf.h" -#include "rdfutil.h" -#include "prlog.h" -#include "nsIComponentManager.h" -#include "xp_core.h" -#include "nsIBookmarkDataSource.h" - -//////////////////////////////////////////////////////////////////////// - -static NS_DEFINE_IID(kIRDFDataSourceIID, NS_IRDFDATASOURCE_IID); -static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID); -static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID); -static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); -static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID); -static NS_DEFINE_CID(kRDFBookmarkDataSourceCID, NS_RDFBOOKMARKDATASOURCE_CID); -static NS_DEFINE_IID(kIRDFBookmarkDataSourceIID,NS_IRDFBOOKMARKDATASOURCE_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - -static const char kURINC_BookmarksRoot[] = "NC:BookmarksRoot"; // XXX? -static const char kURINC_IEFavoritesRoot[] = "NC:IEFavoritesRoot"; // XXX? -static const char kURINC_PersonalToolbarFolder[] = "NC:PersonalToolbarFolder"; // XXX? - -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, child); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Bookmark); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, BookmarkSeparator); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, BookmarkAddDate); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Description); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Folder); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, IEFavorite); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, PersonalToolbarFolderCategory); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, URL); -DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, ShortcutURL); - -DEFINE_RDF_VOCAB(WEB_NAMESPACE_URI, WEB, LastVisitDate); -DEFINE_RDF_VOCAB(WEB_NAMESPACE_URI, WEB, LastModifiedDate); - -DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, RDF, instanceOf); -DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, RDF, type); - -static const char kPersonalToolbarFolder[] = "Personal Toolbar Folder"; - - -//////////////////////////////////////////////////////////////////////// - -PRInt32 gRefCnt; -nsIRDFService* gRDFService; -nsIRDFResource* kNC_Bookmark; -nsIRDFResource* kNC_BookmarkSeparator; -nsIRDFResource* kNC_BookmarkAddDate; -nsIRDFResource* kNC_BookmarksRoot; -nsIRDFResource* kNC_Description; -nsIRDFResource* kNC_Folder; -nsIRDFResource* kNC_IEFavorite; -nsIRDFResource* kNC_IEFavoritesRoot; -nsIRDFResource* kNC_Name; -nsIRDFResource* kNC_PersonalToolbarFolder; -nsIRDFResource* kNC_ShortcutURL; -nsIRDFResource* kNC_URL; -nsIRDFResource* kRDF_type; -nsIRDFResource* kWEB_LastModifiedDate; -nsIRDFResource* kWEB_LastVisitDate; - -static void -bm_AddRefGlobals() -{ - if (gRefCnt++ == 0) { - nsresult rv; - if (NS_FAILED(rv = nsServiceManager::GetService(kRDFServiceCID, - kIRDFServiceIID, - (nsISupports**) &gRDFService))) { - NS_ERROR("unable to get RDF service"); - return; - } - - gRDFService->GetResource(kURINC_Bookmark, &kNC_Bookmark); - gRDFService->GetResource(kURINC_BookmarkSeparator, &kNC_BookmarkSeparator); - gRDFService->GetResource(kURINC_BookmarkAddDate, &kNC_BookmarkAddDate); - gRDFService->GetResource(kURINC_BookmarksRoot, &kNC_BookmarksRoot); - gRDFService->GetResource(kURINC_Description, &kNC_Description); - gRDFService->GetResource(kURINC_Folder, &kNC_Folder); - gRDFService->GetResource(kURINC_IEFavorite, &kNC_IEFavorite); - gRDFService->GetResource(kURINC_IEFavoritesRoot, &kNC_IEFavoritesRoot); - gRDFService->GetResource(kURINC_Name, &kNC_Name); - gRDFService->GetResource(kURINC_PersonalToolbarFolder, &kNC_PersonalToolbarFolder); - gRDFService->GetResource(kURINC_ShortcutURL, &kNC_ShortcutURL); - gRDFService->GetResource(kURINC_URL, &kNC_URL); - gRDFService->GetResource(kURIRDF_type, &kRDF_type); - gRDFService->GetResource(kURIWEB_LastModifiedDate, &kWEB_LastModifiedDate); - gRDFService->GetResource(kURIWEB_LastVisitDate, &kWEB_LastVisitDate); - } -} - - -static void -bm_ReleaseGlobals() -{ - if (--gRefCnt == 0) { - if (gRDFService) - nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService); - - NS_IF_RELEASE(kNC_Bookmark); - NS_IF_RELEASE(kNC_BookmarkSeparator); - NS_IF_RELEASE(kNC_BookmarkAddDate); - NS_IF_RELEASE(kNC_BookmarksRoot); - NS_IF_RELEASE(kNC_Description); - NS_IF_RELEASE(kNC_Folder); - NS_IF_RELEASE(kNC_IEFavorite); - NS_IF_RELEASE(kNC_IEFavoritesRoot); - NS_IF_RELEASE(kNC_Name); - NS_IF_RELEASE(kNC_PersonalToolbarFolder); - NS_IF_RELEASE(kNC_ShortcutURL); - NS_IF_RELEASE(kNC_URL); - NS_IF_RELEASE(kRDF_type); - NS_IF_RELEASE(kWEB_LastModifiedDate); - NS_IF_RELEASE(kWEB_LastVisitDate); - } -} - - -//////////////////////////////////////////////////////////////////////// - -/** - * The bookmark parser knows how to read bookmarks.html and convert it - * into an RDF graph. - */ -class BookmarkParser { -private: - nsInputFileStream *mStream; - nsIRDFDataSource *mDataSource; - const char *mIEFavoritesRoot; - PRBool mFoundIEFavoritesRoot; - -protected: - nsresult AssertTime(nsIRDFResource* aSource, - nsIRDFResource* aLabel, - PRInt32 aTime); - - nsresult ParseBookmark(const nsString& aLine, nsIRDFResource* aContainer, nsIRDFResource *nodeType); - nsresult ParseBookmarkHeader(const nsString& aLine, nsIRDFResource* aContainer, nsIRDFResource *nodeType); - nsresult ParseBookmarkSeparator(const nsString& aLine, nsIRDFResource* aContainer); - nsresult ParseHeaderBegin(const nsString& aLine, nsIRDFResource* aContainer); - nsresult ParseHeaderEnd(const nsString& aLine); - nsresult ParseAttribute(const nsString& aLine, - const char* aAttribute, - PRInt32 aAttributeLen, - nsString& aResult); - -public: - BookmarkParser(); - ~BookmarkParser(); - - nsresult Init(nsInputFileStream *aStream, nsIRDFDataSource *aDataSource); - nsresult Parse(nsIRDFResource* aContainer, nsIRDFResource *nodeType); - - nsresult AddBookmark(nsIRDFResource* aContainer, - const char* aURL, - const PRUnichar* aOptionalTitle, - PRInt32 aAddDate, - PRInt32 aLastVisitDate, - PRInt32 aLastModifiedDate, - const char* aShortcutURL, - nsIRDFResource* aNodeType); - - nsresult SetIEFavoritesRoot(const char *IEFavoritesRootURL) - { - mIEFavoritesRoot = IEFavoritesRootURL; - return(NS_OK); - } - nsresult ParserFoundIEFavoritesRoot(PRBool *foundIEFavoritesRoot) - { - *foundIEFavoritesRoot = mFoundIEFavoritesRoot; - return(NS_OK); - } -}; - - -BookmarkParser::BookmarkParser() -{ - bm_AddRefGlobals(); -} - -nsresult -BookmarkParser::Init(nsInputFileStream *aStream, nsIRDFDataSource *aDataSource) -{ - mStream = aStream; - mDataSource = aDataSource; - mIEFavoritesRoot = nsnull; - mFoundIEFavoritesRoot = PR_FALSE; - return(NS_OK); -} - -BookmarkParser::~BookmarkParser(void) -{ - bm_ReleaseGlobals(); -} - -static const char kHREFEquals[] = "HREF=\""; -static const char kCloseAnchor[] = ""; - -static const char kOpenHeading[] = "= 0) { - rv = ParseBookmark(line, aContainer, nodeType); - } - else if ((offset = line.Find(kOpenHeading)) >= 0 && - nsString::IsDigit(line.CharAt(offset + 2))) { - // XXX Ignore

so that bookmarks root _is_

- if (line.CharAt(offset + 2) != PRUnichar('1')) - rv = ParseBookmarkHeader(line, aContainer, nodeType); - } - else if ((offset = line.Find(kSeparator)) >= 0) { - rv = ParseBookmarkSeparator(line, aContainer); - } - else if ((offset = line.Find(kCloseUL)) >= 0 || - (offset = line.Find(kCloseMenu)) >= 0 || - (offset = line.Find(kCloseDL)) >= 0) { - return ParseHeaderEnd(line); - } - else if ((offset = line.Find(kOpenUL)) >= 0 || - (offset = line.Find(kOpenMenu)) >= 0 || - (offset = line.Find(kOpenDL)) >= 0) { - rv = ParseHeaderBegin(line, aContainer); - } - else { - // XXX Discard the line. We should be treating this as the - // description. - } - } - return rv; -} - - -nsresult -BookmarkParser::ParseBookmark(const nsString& aLine, nsIRDFResource* aContainer, nsIRDFResource *nodeType) -{ - NS_PRECONDITION(aContainer != nsnull, "null ptr"); - if (! aContainer) - return NS_ERROR_NULL_POINTER; - - PRInt32 start = aLine.Find(kHREFEquals); - NS_ASSERTION(start >= 0, "no 'HREF=\"' string: how'd we get here?"); - if (start < 0) - return NS_ERROR_UNEXPECTED; - - // 1. Crop out the URL - - // Skip past the first double-quote - start += (sizeof(kHREFEquals) - 1); - - // ...and find the next so we can chop the URL. - PRInt32 end = aLine.Find(PRUnichar('"'), start); - NS_ASSERTION(end >= 0, "unterminated string"); - if (end < 0) - return NS_ERROR_UNEXPECTED; - - nsAutoString url; - aLine.Mid(url, start, end - start); - - { - // Now do properly replace %22's (this is what 4.5 did, anyway...) - static const char kEscape22[] = "%22"; - PRInt32 offset; - while ((offset = url.Find(kEscape22)) >= 0) { - url.SetCharAt(' ',offset); - url.Cut(offset + 1, sizeof(kEscape22) - 2); - } - } - - // XXX At this point, the URL may be relative. 4.5 called into - // netlib to make an absolute URL, and there was some magic - // "relative_URL" parameter that got sent down as well. We punt on - // that stuff. - - // 2. Parse the name - - start = aLine.Find(PRUnichar('>'), end + 1); // 'end' still points to the end of the URL - NS_ASSERTION(start >= 0, "open anchor tag not terminated"); - if (start < 0) - return NS_ERROR_UNEXPECTED; - - nsAutoString name; - aLine.Right(name, aLine.Length() - (start + 1)); - - end = name.Find(kCloseAnchor); - NS_ASSERTION(end >= 0, "anchor tag not terminated"); - if (end < 0) - return NS_ERROR_UNEXPECTED; - - name.Truncate(end); - - // 3. Parse the target - nsAutoString target; - - start = aLine.Find(kTargetEquals); - if (start >= 0) { - start += (sizeof(kTargetEquals) - 1); - end = aLine.Find(PRUnichar('"'), start); - aLine.Mid(target, start, end - start); - } - - - // 4. Parse the addition date - PRInt32 addDate = 0; - - { - nsAutoString s; - ParseAttribute(aLine, kAddDateEquals, sizeof(kAddDateEquals) - 1, s); - if (s.Length() > 0) { - PRInt32 err; - addDate = s.ToInteger(&err); // ignored. - } - } - - // 5. Parse the last visit date - - PRInt32 lastVisitDate = 0; - - { - nsAutoString s; - ParseAttribute(aLine, kLastVisitEquals, sizeof(kLastVisitEquals) - 1, s); - if (s.Length() > 0) { - PRInt32 err; - lastVisitDate = s.ToInteger(&err); // ignored. - } - } - - // 6. Parse the last modified date - - PRInt32 lastModifiedDate; - - { - nsAutoString s; - ParseAttribute(aLine, kLastModifiedEquals, sizeof(kLastModifiedEquals) - 1, s); - if (s.Length() > 0) { - PRInt32 err; - lastModifiedDate = s.ToInteger(&err); // ignored. - } - } - - // 7. Parse the shortcut URL - - nsAutoString shortcut; - ParseAttribute(aLine, kShortcutURLEquals, sizeof(kShortcutURLEquals) -1, shortcut); - - - // Dunno. 4.5 did it, so will we. - if (!lastModifiedDate) - lastModifiedDate = lastVisitDate; - - // XXX There was some other cruft here to deal with aliases, but - // since I have no clue what those are, I'll punt. - - char *cURL = url.ToNewCString(); - if (cURL) - { - char *cShortcutURL = shortcut.ToNewCString(); - if (! cShortcutURL) - return NS_ERROR_OUT_OF_MEMORY; - - nsresult rv = AddBookmark(aContainer, - cURL, - name.GetUnicode(), - addDate, - lastVisitDate, - lastModifiedDate, - cShortcutURL, - nodeType); - - delete [] cURL; - if (cShortcutURL) delete [] cShortcutURL; - } - return(NS_OK); -} - - - - // Now create the bookmark -nsresult -BookmarkParser::AddBookmark(nsIRDFResource* aContainer, - const char* aURL, - const PRUnichar* aOptionalTitle, - PRInt32 aAddDate, - PRInt32 aLastVisitDate, - PRInt32 aLastModifiedDate, - const char* aShortcutURL, - nsIRDFResource* aNodeType) -{ - nsresult rv; - nsCOMPtr bookmark; - - if (NS_FAILED(rv = gRDFService->GetResource(aURL, getter_AddRefs(bookmark) ))) - { - NS_ERROR("unable to get bookmark resource"); - return rv; - } - - PRBool result = PR_FALSE; - if (nsnull != mIEFavoritesRoot) - { - if (!PL_strcmp(aURL, mIEFavoritesRoot)) - { - mFoundIEFavoritesRoot = PR_TRUE; - } - } - - nsCOMPtr container; - rv = NS_NewRDFContainer(mDataSource, aContainer, getter_AddRefs(container)); - if (NS_FAILED(rv)) return rv; - - rv = container->AppendElement(bookmark); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add bookmark to container"); - if (NS_FAILED(rv)) return rv; - - rv = mDataSource->Assert(bookmark, kRDF_type, aNodeType, PR_TRUE); - if (rv != NS_RDF_ASSERTION_ACCEPTED) - { - NS_ERROR("unable to add bookmark to data source"); - return rv; - } - - if ((nsnull != aOptionalTitle) && (*aOptionalTitle != PRUnichar('\0'))) - { - nsCOMPtr literal; - if (NS_FAILED(rv = gRDFService->GetLiteral(aOptionalTitle, getter_AddRefs(literal)))) - { - NS_ERROR("unable to create literal for bookmark name"); - return rv; - } - - rv = mDataSource->Assert(bookmark, kNC_Name, literal, PR_TRUE); - if (rv != NS_RDF_ASSERTION_ACCEPTED) - { - NS_ERROR("unable to set bookmark name"); - return rv; - } - } - - AssertTime(bookmark, kNC_BookmarkAddDate, aAddDate); - AssertTime(bookmark, kWEB_LastVisitDate, aLastVisitDate); - AssertTime(bookmark, kWEB_LastModifiedDate, aLastModifiedDate); - - if ((nsnull != aShortcutURL) && (*aShortcutURL != '\0')) - { - nsCOMPtr shortcutLiteral; - if (NS_FAILED(rv = gRDFService->GetLiteral(nsAutoString(aShortcutURL).GetUnicode(), - getter_AddRefs(shortcutLiteral)))) - { - NS_ERROR("unable to get literal for bookmark shortcut URL"); - return(rv); - } - if (rv != NS_RDF_NO_VALUE) - { - rv = mDataSource->Assert(bookmark, - kNC_ShortcutURL, - shortcutLiteral, - PR_TRUE); - - if (rv != NS_RDF_ASSERTION_ACCEPTED) - { - NS_ERROR("unable to set bookmark shortcut URL"); - return(rv); - } - } - } - - return(NS_OK); -} - - - -nsresult -BookmarkParser::ParseBookmarkHeader(const nsString& aLine, nsIRDFResource* aContainer, nsIRDFResource *nodeType) -{ - // Snip out the header - PRInt32 start = aLine.Find(kOpenHeading); - NS_ASSERTION(start >= 0, "couldn't find ''), start); // skip to the end of the '' tag - - if (start < 0) { - NS_WARNING("couldn't find end of header tag"); - return NS_OK; - } - - nsAutoString name; - aLine.Right(name, aLine.Length() - (start + 1)); - - PRInt32 end = name.Find(kCloseHeading); - if (end < 0) - NS_WARNING("No '= 0) - name.Truncate(end); - - // Find the add date - PRInt32 addDate = 0; - - nsAutoString s; - ParseAttribute(aLine, kAddDateEquals, sizeof(kAddDateEquals) - 1, s); - if (s.Length() > 0) { - PRInt32 err; - addDate = s.ToInteger(&err); // ignored - } - - nsAutoString id; - ParseAttribute(aLine, kIDEquals, sizeof(kIDEquals) - 1, id); - - // Make the necessary assertions - nsresult rv; - nsCOMPtr folder; - if (id.Length() > 0) { - // Use the ID attribute, if one is set. - rv = gRDFService->GetUnicodeResource(id.GetUnicode(), getter_AddRefs(folder)); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create resource for folder"); - if (NS_FAILED(rv)) return rv; - } - else if (name.Equals(kPersonalToolbarFolder)) { // XXX I18n!!! - folder = dont_QueryInterface( kNC_PersonalToolbarFolder ); - } - else { - // We've never seen this folder before. Assign it an anonymous ID - rv = rdf_CreateAnonymousResource(kURINC_BookmarksRoot, getter_AddRefs(folder)); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create anonymous resource for folder"); - if (NS_FAILED(rv)) return rv; - } - - nsCOMPtr literal; - rv = gRDFService->GetLiteral(name.GetUnicode(), getter_AddRefs(literal)); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create literal for folder name"); - if (NS_FAILED(rv)) return rv; - - rv = mDataSource->Assert(folder, kNC_Name, literal, PR_TRUE); - if (rv != NS_RDF_ASSERTION_ACCEPTED) { - NS_ERROR("unable to set folder name"); - return rv; - } - - nsCOMPtr container; - rv = NS_NewRDFContainer(mDataSource, aContainer, getter_AddRefs(container)); - if (NS_FAILED(rv)) return rv; - - rv = container->AppendElement(folder); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add bookmark to container"); - if (NS_FAILED(rv)) return rv; - - NS_WITH_SERVICE(nsIRDFContainerUtils, rdfc, kRDFContainerUtilsCID, &rv); - if (NS_FAILED(rv)) return rv; - - rv = rdfc->MakeSeq(mDataSource, folder, nsnull); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to make new folder as sequence"); - if (NS_FAILED(rv)) return rv; - - rv = mDataSource->Assert(folder, kRDF_type, kNC_Folder, PR_TRUE); - if (rv != NS_RDF_ASSERTION_ACCEPTED) { - NS_ERROR("unable to mark new folder as folder"); - return rv; - } - - if (NS_FAILED(rv = AssertTime(folder, kNC_BookmarkAddDate, addDate))) { - NS_ERROR("unable to mark add date"); - return rv; - } - - // And now recursively parse the rest of the file... - - if (NS_FAILED(rv = Parse(folder, nodeType))) { - NS_ERROR("recursive parse of bookmarks file failed"); - return rv; - } - - return NS_OK; -} - - -nsresult -BookmarkParser::ParseBookmarkSeparator(const nsString& aLine, nsIRDFResource* aContainer) -{ - nsresult rv; - nsCOMPtr separator; - - if (NS_SUCCEEDED(rv = rdf_CreateAnonymousResource(kURINC_BookmarksRoot, getter_AddRefs(separator)))) - { - nsAutoString defaultSeparatorName("-----"); - nsCOMPtr nameLiteral; - if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(defaultSeparatorName.GetUnicode(), getter_AddRefs(nameLiteral)))) - { - if (NS_SUCCEEDED(rv = mDataSource->Assert(separator, kNC_Name, nameLiteral, PR_TRUE))) - { - } - } - if (NS_SUCCEEDED(rv = mDataSource->Assert(separator, kRDF_type, kNC_BookmarkSeparator, PR_TRUE))) - { - nsCOMPtr container; - rv = NS_NewRDFContainer(mDataSource, aContainer, getter_AddRefs(container)); - if (NS_SUCCEEDED(rv)) - { - rv = container->AppendElement(separator); - } - } - } - return(rv); -} - - - -nsresult -BookmarkParser::ParseHeaderBegin(const nsString& aLine, nsIRDFResource* aContainer) -{ - return NS_OK; -} - - - -nsresult -BookmarkParser::ParseHeaderEnd(const nsString& aLine) -{ - return NS_OK; -} - - -nsresult -BookmarkParser::ParseAttribute(const nsString& aLine, - const char* aAttributeName, - PRInt32 aAttributeLen, - nsString& aResult) -{ - aResult.Truncate(); - - PRInt32 start = aLine.Find(aAttributeName); - if (start < 0) - return NS_OK; - - start += aAttributeLen; - PRInt32 end = aLine.Find(PRUnichar('"'), start); - aLine.Mid(aResult, start, end - start); - - return NS_OK; -} - -nsresult -BookmarkParser::AssertTime(nsIRDFResource* aSource, - nsIRDFResource* aLabel, - PRInt32 aTime) -{ - // XXX TO DO: Convert to a date literal - - nsAutoString time; - time.Append(aTime, 10); - - nsresult rv; - nsIRDFLiteral* literal; - if (NS_FAILED(rv = gRDFService->GetLiteral(time.GetUnicode(), &literal))) { - NS_ERROR("unable to get literal for time"); - return rv; - } - - rv = mDataSource->Assert(aSource, aLabel, literal, PR_TRUE); - NS_ASSERTION(rv == NS_RDF_ASSERTION_ACCEPTED, "unable to assert time"); - - NS_RELEASE(literal); - return rv; -} - -//////////////////////////////////////////////////////////////////////// -// BookmarkDataSourceImpl - -/** - * The bookmark data source uses a BookmarkParser to read the - * bookmarks.html file from the local disk and present an - * in-memory RDF graph based on it. - */ - -class BookmarkDataSourceImpl : public nsIRDFBookmarkDataSource { -protected: - nsIRDFDataSource* mInner; - - nsresult ReadBookmarks(void); - nsresult WriteBookmarks(nsIRDFDataSource *ds, nsIRDFResource *root); - nsresult WriteBookmarksContainer(nsIRDFDataSource *ds, nsOutputFileStream strm, nsIRDFResource *container, PRInt32 level); - nsresult WriteBookmarkProperties(nsIRDFDataSource *ds, nsOutputFileStream strm, nsIRDFResource *node, - nsIRDFResource *property, const char *htmlAttrib, PRBool isFirst); - PRBool CanAccept(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aTarget); - -public: - BookmarkDataSourceImpl(void); - virtual ~BookmarkDataSourceImpl(void); -#if 0 - // for nsIGenericFactory: - static nsresult Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); -#endif - // nsISupports - NS_DECL_ISUPPORTS - - // nsIRDFBookmarkDataSource - NS_IMETHOD AddBookmark(const char *aURI, const PRUnichar *aOptionalTitle) - { - // XXX for the moment, just add it as a child of BookmarksRoot - BookmarkParser parser; - parser.Init(nsnull, NS_STATIC_CAST(nsIRDFDataSource *, this)); - nsresult rv = parser.AddBookmark(kNC_BookmarksRoot, aURI, aOptionalTitle, - 0L, 0L, 0L, nsnull, kNC_Bookmark); - if (NS_SUCCEEDED(rv)) - { - Flush(); - } - return(rv); - } - - NS_IMETHOD FindBookmarkShortcut(const char *userInput, char **shortcutURL) - { - nsresult rv = NS_RDF_NO_VALUE; - if (nsnull != shortcutURL) - { - *shortcutURL = nsnull; - nsCOMPtr literalTarget; - if (NS_FAILED(rv = gRDFService->GetLiteral(nsAutoString(userInput).GetUnicode(), - getter_AddRefs(literalTarget)))) - { - } - else if (rv != NS_RDF_NO_VALUE) - { - nsCOMPtr source; - if (NS_FAILED(rv = GetSource(kNC_ShortcutURL, literalTarget, - PR_TRUE, getter_AddRefs(source)))) - { - } - else if (rv != NS_RDF_NO_VALUE) - { - nsXPIDLCString uri; - source->GetValue(getter_Copies(uri)); - nsAutoString url(uri); - *shortcutURL = url.ToNewCString(); - } - } - } - return(rv); - } - - // nsIRDFDataSource - NS_IMETHOD Init(const char* uri); - - NS_IMETHOD GetURI(char* *uri) { - return mInner->GetURI(uri); - } - - NS_IMETHOD GetSource(nsIRDFResource* property, - nsIRDFNode* target, - PRBool tv, - nsIRDFResource** source) { - return mInner->GetSource(property, target, tv, source); - } - - NS_IMETHOD GetSources(nsIRDFResource* property, - nsIRDFNode* target, - PRBool tv, - nsISimpleEnumerator** sources) { - return mInner->GetSources(property, target, tv, sources); - } - - NS_IMETHOD GetTarget(nsIRDFResource* source, - nsIRDFResource* property, - PRBool tv, - nsIRDFNode** target); - - NS_IMETHOD GetTargets(nsIRDFResource* source, - nsIRDFResource* property, - PRBool tv, - nsISimpleEnumerator** targets) { - return mInner->GetTargets(source, property, tv, targets); - } - - NS_IMETHOD Assert(nsIRDFResource* aSource, - nsIRDFResource* aProperty, - nsIRDFNode* aTarget, - PRBool aTruthValue); - - NS_IMETHOD Unassert(nsIRDFResource* aSource, - nsIRDFResource* aProperty, - nsIRDFNode* aTarget); - - NS_IMETHOD HasAssertion(nsIRDFResource* source, - nsIRDFResource* property, - nsIRDFNode* target, - PRBool tv, - PRBool* hasAssertion) { - return mInner->HasAssertion(source, property, target, tv, hasAssertion); - } - - NS_IMETHOD AddObserver(nsIRDFObserver* n) { - return mInner->AddObserver(n); - } - - NS_IMETHOD RemoveObserver(nsIRDFObserver* n) { - return mInner->RemoveObserver(n); - } - - NS_IMETHOD ArcLabelsIn(nsIRDFNode* node, - nsISimpleEnumerator** labels) { - return mInner->ArcLabelsIn(node, labels); - } - - NS_IMETHOD ArcLabelsOut(nsIRDFResource* source, - nsISimpleEnumerator** labels) { - return mInner->ArcLabelsOut(source, labels); - } - - NS_IMETHOD GetAllResources(nsISimpleEnumerator** aResult) { - return mInner->GetAllResources(aResult); - } - - NS_IMETHOD Flush(void); - - NS_IMETHOD GetAllCommands(nsIRDFResource* source, - nsIEnumerator/**/** commands); - - NS_IMETHOD IsCommandEnabled(nsISupportsArray/**/* aSources, - nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, - PRBool* aResult); - - NS_IMETHOD DoCommand(nsISupportsArray/**/* aSources, - nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments); - -}; - - -//////////////////////////////////////////////////////////////////////// - -BookmarkDataSourceImpl::BookmarkDataSourceImpl(void) -{ - // XXX rvg there should be only one instance of this class. - // this is actually true of all datasources. - NS_INIT_REFCNT(); - bm_AddRefGlobals(); -} - -BookmarkDataSourceImpl::~BookmarkDataSourceImpl(void) -{ - Flush(); - NS_RELEASE(mInner); - bm_ReleaseGlobals(); -} - -#if 0 -nsresult -BookmarkDataSourceImpl::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) -{ - nsresult rv; - if (aOuter) - return NS_ERROR_NO_AGGREGATION; - if (aResult == nsnull) - return NS_ERROR_NULL_POINTER; - BookmarkDataSourceImpl* ds = new BookmarkDataSourceImpl(); - if (ds == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - rv = ds->QueryInterface(aIID, aResult); - if (NS_FAILED(rv)) { - delete ds; - return rv; - } - return rv; -} -#endif - -//NS_IMPL_ISUPPORTS(BookmarkDataSourceImpl, kIRDFDataSourceIID); -NS_IMPL_ADDREF(BookmarkDataSourceImpl); -NS_IMPL_RELEASE(BookmarkDataSourceImpl); - -NS_IMETHODIMP -BookmarkDataSourceImpl::QueryInterface(REFNSIID iid, void **result) -{ - if (! result) - return NS_ERROR_NULL_POINTER; - - *result = nsnull; - if (iid.Equals(kIRDFDataSourceIID) || - iid.Equals(kIRDFBookmarkDataSourceIID) || - iid.Equals(kISupportsIID)) - { - *result = NS_STATIC_CAST(nsIRDFBookmarkDataSource *, this); - AddRef(); - return NS_OK; - } - return(NS_NOINTERFACE); -} - -NS_IMETHODIMP -BookmarkDataSourceImpl::Init(const char* uri) -{ - nsresult rv; - - if (NS_FAILED(rv = nsComponentManager::CreateInstance(kRDFInMemoryDataSourceCID, - nsnull, - kIRDFDataSourceIID, - (void**) &mInner))) - return rv; - - if (NS_FAILED(rv = mInner->Init(uri))) - return rv; - - if (NS_FAILED(rv = ReadBookmarks())) - return rv; - - // register this as a named data source with the RDF service - return gRDFService->RegisterDataSource(this, PR_FALSE); -} - -NS_IMETHODIMP -BookmarkDataSourceImpl::GetTarget(nsIRDFResource* aSource, - nsIRDFResource* aProperty, - PRBool aTruthValue, - nsIRDFNode** aTarget) -{ - nsresult rv; - - // If they want the URL... - if (aTruthValue && aProperty == kNC_URL) { - // ...and it is in fact a bookmark... - PRBool hasAssertion; - if (NS_SUCCEEDED(mInner->HasAssertion(aSource, kRDF_type, kNC_Bookmark, PR_TRUE, &hasAssertion)) - && hasAssertion) { - - nsXPIDLCString uri; - if (NS_FAILED(rv = aSource->GetValue( getter_Copies(uri) ))) { - NS_ERROR("unable to get source's URI"); - return rv; - } - - nsAutoString ncURI(uri); - if (ncURI.Find("NC:") == 0) - { - return(NS_RDF_NO_VALUE); - } - - nsIRDFLiteral* literal; - if (NS_FAILED(rv = gRDFService->GetLiteral(nsAutoString(uri).GetUnicode(), &literal))) { - NS_ERROR("unable to construct literal for URL"); - return rv; - } - - *aTarget = (nsIRDFNode*)literal; - return NS_OK; - } - } - - return mInner->GetTarget(aSource, aProperty, aTruthValue, aTarget); -} - - -NS_IMETHODIMP -BookmarkDataSourceImpl::Assert(nsIRDFResource* aSource, - nsIRDFResource* aProperty, - nsIRDFNode* aTarget, - PRBool aTruthValue) -{ - if (CanAccept(aSource, aProperty, aTarget)) { - return mInner->Assert(aSource, aProperty, aTarget, aTruthValue); - } - else { - return NS_RDF_ASSERTION_REJECTED; - } -} - - - -NS_IMETHODIMP -BookmarkDataSourceImpl::Unassert(nsIRDFResource* aSource, - nsIRDFResource* aProperty, - nsIRDFNode* aTarget) -{ - if (CanAccept(aSource, aProperty, aTarget)) { - return mInner->Unassert(aSource, aProperty, aTarget); - } - else { - return NS_RDF_ASSERTION_REJECTED; - } -} - - - -NS_IMETHODIMP -BookmarkDataSourceImpl::Flush(void) -{ - return WriteBookmarks(mInner, kNC_BookmarksRoot); -} - - -NS_IMETHODIMP -BookmarkDataSourceImpl::GetAllCommands(nsIRDFResource* source, - nsIEnumerator/**/** commands) -{ - NS_NOTYETIMPLEMENTED("write me!"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -BookmarkDataSourceImpl::IsCommandEnabled(nsISupportsArray/**/* aSources, - nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments, - PRBool* aResult) -{ - NS_NOTYETIMPLEMENTED("write me!"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -BookmarkDataSourceImpl::DoCommand(nsISupportsArray* aSources, - nsIRDFResource* aCommand, - nsISupportsArray* aArguments) -{ - NS_NOTYETIMPLEMENTED("write me!"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -nsresult -BookmarkDataSourceImpl::ReadBookmarks(void) -{ - nsresult rv; - - NS_WITH_SERVICE(nsIRDFContainerUtils, rdfc, kRDFContainerUtilsCID, &rv); - if (NS_FAILED(rv)) return rv; - - rv = rdfc->MakeSeq(mInner, kNC_BookmarksRoot, nsnull); - NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to make NC:BookmarksRoot a sequence"); - if (NS_FAILED(rv)) return rv; - - nsSpecialSystemDirectory bookmarksFile(nsSpecialSystemDirectory::OS_CurrentProcessDirectory); - - // XXX we should get this from prefs. - bookmarksFile += "res"; - bookmarksFile += "rdf"; - bookmarksFile += "bookmarks.html"; - - PRBool foundIERoot = PR_FALSE; - #ifdef XP_WIN - nsCOMPtr ieFolder; - const char *ieFavoritesURL; - #endif - { // <-- scope the stream to get the open/close automatically. - nsInputFileStream strm(bookmarksFile); - - if (! strm.is_open()) - { - NS_ERROR("unable to open file"); - return NS_ERROR_FAILURE; - } - - BookmarkParser parser; - parser.Init(&strm, NS_STATIC_CAST(nsIRDFDataSource *, this)); - - #ifdef XP_MAC - parser.SetIEFavoritesRoot(kURINC_IEFavoritesRoot); - #endif - - #ifdef XP_WIN - nsSpecialSystemDirectory ieFavoritesFile(nsSpecialSystemDirectory::Win_Favorites); - nsFileURL ieFavoritesURLSpec(ieFavoritesFile); - ieFavoritesURL = ieFavoritesURLSpec.GetAsString(); - parser.SetIEFavoritesRoot(ieFavoritesURL); - #endif - - parser.Parse(kNC_BookmarksRoot, kNC_Bookmark); - - parser.ParserFoundIEFavoritesRoot(&foundIERoot); - } // <-- scope the stream to get the open/close automatically. - - // look for and import any IE Favorites - nsAutoString ieTitle("Imported IE Favorites"); // XXX localization? - -#ifdef XP_MAC - nsSpecialSystemDirectory ieFavoritesFile(nsSpecialSystemDirectory::Mac_PreferencesDirectory); - ieFavoritesFile += "Explorer"; - ieFavoritesFile += "Favorites.html"; - - nsInputFileStream ieStream(ieFavoritesFile); - if (ieStream.is_open()) - { - NS_WITH_SERVICE(nsIRDFContainerUtils, rdfc, kRDFContainerUtilsCID, &rv); - if (NS_SUCCEEDED(rv)) - { - if (NS_SUCCEEDED(rv = rdfc->MakeSeq(mInner, kNC_IEFavoritesRoot, nsnull))) - { - BookmarkParser parser; - parser.Init(&ieStream, this); - parser.Parse(kNC_IEFavoritesRoot, kNC_IEFavorite); - - nsCOMPtr ieTitleLiteral; - if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(ieTitle.GetUnicode(), getter_AddRefs(ieTitleLiteral)))) - { - rv = mInner->Assert(kNC_IEFavoritesRoot, kNC_Name, ieTitleLiteral, PR_TRUE); - } - - // if the IE Favorites root isn't somewhere in bookmarks.html, add it - if (!foundIERoot) - { - nsCOMPtr bookmarksRoot; - rv = NS_NewRDFContainer(mInner, kNC_BookmarksRoot, getter_AddRefs(bookmarksRoot)); - if (NS_SUCCEEDED(rv)) - { - rv = bookmarksRoot->AppendElement(kNC_IEFavoritesRoot); - } - } - } - } - } -#endif - -#ifdef XP_WIN - if (NS_SUCCEEDED(rv = gRDFService->GetResource(ieFavoritesURL, getter_AddRefs(ieFolder)))) - { - nsCOMPtr ieTitleLiteral; - if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(ieTitle.GetUnicode(), getter_AddRefs(ieTitleLiteral)))) - { - rv = mInner->Assert(ieFolder, kNC_Name, ieTitleLiteral, PR_TRUE); - } - - // if the IE Favorites root isn't somewhere in bookmarks.html, add it - if (!foundIERoot) - { - nsCOMPtr container; - rv = NS_NewRDFContainer(mInner, kNC_BookmarksRoot, getter_AddRefs(container)); - if (NS_SUCCEEDED(rv)) - { - rv = container->AppendElement(ieFolder); - } - } - } -#endif - - return NS_OK; -} - - -nsresult -BookmarkDataSourceImpl::WriteBookmarks(nsIRDFDataSource *ds, nsIRDFResource *root) -{ - nsSpecialSystemDirectory bookmarksFile(nsSpecialSystemDirectory::OS_CurrentProcessDirectory); - - // XXX we should get this from prefs. - bookmarksFile += "res"; - bookmarksFile += "rdf"; - bookmarksFile += "bookmarks.html"; - - nsresult rv = NS_ERROR_FAILURE; - nsOutputFileStream strm(bookmarksFile); - if (strm.is_open()) - { - strm << "\n"; - strm << "\n"; - strm << "Bookmarks\n"; - strm << "

Bookmarks

\n\n"; - - rv = WriteBookmarksContainer(ds, strm, root, 0); - } - return(rv); -} - - -nsresult -BookmarkDataSourceImpl::WriteBookmarksContainer(nsIRDFDataSource *ds, nsOutputFileStream strm, nsIRDFResource *parent, PRInt32 level) -{ - nsresult rv = NS_OK; - - nsAutoString indentationString(""); - for (PRInt32 loop=0; loop container; - if (NS_SUCCEEDED(rv = NS_NewRDFContainer(ds, parent, getter_AddRefs(container)))) - { - nsCOMPtr containerUtils; - if (NS_SUCCEEDED(rv = NS_NewRDFContainerUtils(getter_AddRefs(containerUtils)))) - { - strm << indentation; - strm << "

\n"; - - nsCOMPtr children; - if (NS_SUCCEEDED(rv = container->GetElements(getter_AddRefs(children)))) - { - PRBool more = PR_TRUE; - while (more == PR_TRUE) - { - if (NS_FAILED(rv = children->HasMoreElements(&more))) break; - if (more != PR_TRUE) break; - - nsCOMPtr iSupports; - if (NS_FAILED(rv = children->GetNext(getter_AddRefs(iSupports)))) break; - - nsCOMPtr child = do_QueryInterface(iSupports); - if (!child) break; - - PRBool isIERoot = PR_FALSE, isContainer = PR_FALSE; - if (NS_SUCCEEDED(child->EqualsResource(kNC_IEFavoritesRoot, &isIERoot))) - { - if (isIERoot == PR_FALSE) - { - if (NS_SUCCEEDED(rv = containerUtils->IsContainer(ds, child, &isContainer))) - { - } - } - } - - nsCOMPtr nameNode; - nsAutoString nameString(""); - char *name = nsnull; - if (NS_SUCCEEDED(rv = ds->GetTarget(child, kNC_Name, PR_TRUE, getter_AddRefs(nameNode)))) - { - nsCOMPtr nameLiteral = do_QueryInterface(nameNode); - PRUnichar *title = nsnull; - if (NS_SUCCEEDED(rv = nameLiteral->GetValue(&title))) - { - nameString = title; - name = nameString.ToNewCString(); - } - - } - - strm << indentation; - strm << " "; - if (isContainer == PR_TRUE) - { - strm << "

GetValue(getter_Copies(id)); - if (NS_SUCCEEDED(rv) && (id)) { - strm << (const char*) id; - } - strm << "\""; - - strm << ">"; - - // output title - if (name) strm << name; - strm << "

\n"; - rv = WriteBookmarksContainer(ds, strm, child, level+1); - } - else - { - char *url = nsnull; - if (NS_SUCCEEDED(rv = child->GetValue(&url))) - { - if (url) - { - nsAutoString uri(url); - // XXX What's the best way to determine if its a separator? - if (uri.Find(kURINC_BookmarksRoot) == 0) - { - // its a separator - strm << "
\n"; - } - else - { - strm << "
"; - // output title - if (name) strm << name; - strm << "\n"; - } - } - } - } - - if (nsnull != name) - { - delete []name; - name = nsnull; - } - - if (NS_FAILED(rv)) break; - } - } - strm << indentation; - strm << "

\n"; - } - } - delete [] indentation; - return(rv); -} - - -nsresult -BookmarkDataSourceImpl::WriteBookmarkProperties(nsIRDFDataSource *ds, nsOutputFileStream strm, - nsIRDFResource *child, nsIRDFResource *property, const char *htmlAttrib, PRBool isFirst) -{ - nsresult rv; - nsCOMPtr node; - if (NS_SUCCEEDED(rv = ds->GetTarget(child, property, PR_TRUE, getter_AddRefs(node)))) - { - nsCOMPtr literal = do_QueryInterface(node); - if (literal) - { - PRUnichar *literalUni = nsnull; - if (NS_SUCCEEDED(rv = literal->GetValue(&literalUni))) - { - nsAutoString literalString = literalUni; - char *attribute = literalString.ToNewCString(); - if (nsnull != attribute) - { - if (isFirst == PR_FALSE) - { - strm << " "; - } - strm << htmlAttrib; - strm << attribute; - strm << "\""; - delete [] attribute; - attribute = nsnull; - } - } - } - } - return(rv); -} - - -PRBool -BookmarkDataSourceImpl::CanAccept(nsIRDFResource* aSource, - nsIRDFResource* aProperty, - nsIRDFNode* aTarget) -{ - // XXX This is really crippled, and needs to be stricter. We want - // to exclude any property that isn't talking about a known - // bookmark. - nsresult rv; - NS_WITH_SERVICE(nsIRDFContainerUtils, rdfc, kRDFContainerUtilsCID, &rv); - if (NS_FAILED(rv)) - return PR_FALSE; - - PRBool isOrdinal; - rv = rdfc->IsOrdinalProperty(aProperty, &isOrdinal); - if (NS_FAILED(rv)) - return PR_FALSE; - - if (isOrdinal) { - return PR_TRUE; - } - else if ((aProperty != kRDF_type) || - (aProperty != kWEB_LastModifiedDate) || - (aProperty != kWEB_LastVisitDate) || - (aProperty != kNC_Name) || - (aProperty != kNC_BookmarkAddDate)) { - return PR_TRUE; - } - else { - return PR_FALSE; - } -} - -//////////////////////////////////////////////////////////////////////////////// - -#if 0 -#include "nsXPComFactory.h" - -NS_DEF_FACTORY(BookmarkDataSource,BookmarkDataSourceImpl) - -nsresult -NS_NewRDFBookmarkDataSourceFactory(nsIFactory** aResult) -{ - nsresult rv = NS_OK; - nsIFactory* inst = new nsBookmarkDataSourceFactory; - if (NULL == inst) { - rv = NS_ERROR_OUT_OF_MEMORY; - } else { - NS_ADDREF(inst); - } - *aResult = inst; - return rv; -} -#endif - -nsresult -NS_NewRDFBookmarkDataSource(nsIRDFDataSource** result) -{ - BookmarkDataSourceImpl* ds = new BookmarkDataSourceImpl(); - if (! ds) - return NS_ERROR_NULL_POINTER; - - *result = ds; - NS_ADDREF(*result); - return NS_OK; -} diff --git a/mozilla/rdf/datasource/src/nsRDFBuiltInDataSources.h b/mozilla/rdf/datasource/src/nsRDFBuiltInDataSources.h index 682a59e6e66..f39324d3197 100644 --- a/mozilla/rdf/datasource/src/nsRDFBuiltInDataSources.h +++ b/mozilla/rdf/datasource/src/nsRDFBuiltInDataSources.h @@ -32,10 +32,6 @@ #include "nsError.h" class nsIRDFDataSource; -class nsIRDFDataBase; - -// in nsBookmarkDataSource.cpp -nsresult NS_NewRDFBookmarkDataSource(nsIRDFDataSource** result); // in nsFileSystemDataSource.cpp nsresult NS_NewRDFFileSystemDataSource(nsIRDFDataSource** result); @@ -49,9 +45,6 @@ nsresult NS_NewRDFFindDataSource(nsIRDFDataSource** result); // in nsFTPDataSource.cpp nsresult NS_NewRDFFTPDataSource(nsIRDFDataSource** result); -// in nsRelatedLinksDataSource.cpp -nsresult NS_NewRDFRelatedLinksDataSource(nsIRDFDataSource **result); - #endif // nsBuiltinDataSources_h__ diff --git a/mozilla/rdf/macbuild/rdf.mcp b/mozilla/rdf/macbuild/rdf.mcp index 93677861294b422ac68c7272b844f72cb58ae143..9c4c7b67d8bdaa237cd89218675e46dd4261e530 100644 GIT binary patch delta 297 zcmeBM#M-xrb%QnwCp!ZJ13wVUOtxT=XXKb%%OTAuFu8z5pHX)50+wz@lgT=)){`%B zwoHD{Dmj^jO`q2UsM>)ENC0v7WC`}(&1c!#88tx$F#|COumCaGP$10+#30qIK+Fcj z=vH)Y4&roRnmmnrAqU7npbFE8j+&FtzZ9K5i=EMCav7)Q!~p(D|5!GEnm>uY;HOQWF=i>u3$VfJ; BSR?=d delta 372 zcmeBM#M-xrb%QpGCIzl|qv>QFR_n>9g1wZ6=p-YEBH`pY)Gq^GBWxPWBct8wLi|Et?a>>iO7P1cC00ZQLA~`I~X_Lp3pw z!2kcpUIGPvGH(8^QOU^3?&j&^3RLB@xlpT`5h%O)n|7lct259ZyUFpV6gHO>akFn; uUb#7d)dwo3ygBL=2m9u(i?_=eFHBGKWb9{LGX0w;V>#oM?Rj2|3)ldTAz1YQ diff --git a/mozilla/rdf/resources/Makefile.in b/mozilla/rdf/resources/Makefile.in index 75500a45100..6c3157b86c2 100644 --- a/mozilla/rdf/resources/Makefile.in +++ b/mozilla/rdf/resources/Makefile.in @@ -27,17 +27,8 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk FILES = \ - bookmarks.html \ history.css \ history.xul \ - bm-panel.xul \ - bm-props.xul \ - bookmark-folder-closed.gif \ - bookmark-folder-open.gif \ - bookmark-item.gif \ - bookmarks.css \ - bookmarks.js \ - bookmarks.xul \ document.gif \ dom-test-1.css \ dom-test-1.xul \ @@ -53,12 +44,9 @@ FILES = \ flames.gif \ folder-closed.gif \ folder-open.gif \ - iefavorite.gif \ ignore-test.xul \ loading.gif \ online.gif \ - personal-folder-closed.gif \ - personal-folder-open.gif \ remote-flash-1.rdf \ remote-flash-2.rdf \ remote-flash-3.rdf \ diff --git a/mozilla/rdf/resources/bm-panel.xul b/mozilla/rdf/resources/bm-panel.xul deleted file mode 100644 index fb4409cc971..00000000000 --- a/mozilla/rdf/resources/bm-panel.xul +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - Name - - - - URL - - - - - - - - - diff --git a/mozilla/rdf/resources/bm-props.xul b/mozilla/rdf/resources/bm-props.xul deleted file mode 100644 index 17a171f5b20..00000000000 --- a/mozilla/rdf/resources/bm-props.xul +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - -
- - - - - - - - - - -
- Name: - - -
- Location: - - -
- Shortcut: - - -
- Description: - - -
-
-
- - - -
-
-
diff --git a/mozilla/rdf/resources/bookmark-folder-closed.gif b/mozilla/rdf/resources/bookmark-folder-closed.gif deleted file mode 100644 index d8f072037f3b1addc87460101d12eabb6db52a57..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 918 zcmX9-O-R&H5T9s^HCEa!unt?Kmry!Lb8(46{)FX0@M2eyaEO9BB<;n+pAOQ;MN}51 zh%BrK3c~7~bP&n`3uLWu>97Z3DRfV*NKC)?da%4V``-M%X7|G2KwoJrPkH)7VWsht z#w|sarb}2GOV2-VXEK>=Hk-@k3WY*PM@O+(?CR?3?(QBL85tTHN|K~hD*0sU!^2gY zwO_tfUEbWRzJ58)L_(xQ25=^35+-FbCXaV4Btj}=LLQ&8k|?Q?DS7NF%yq&p+;TIVJJ9*=O8K=g>5)M z4-~;`NCZ?c0X$$pT0EjbP1R#qFau)LX6i9Jcmp@C&DCR+$R0@}T4agX5E4>B4Db!F zFb6jfjW)=Hy2u|v11ey`4DcNH_yWu0NDvtuf)%wRzBo)w4`aa)kUC;UuE-L@Lt01( zk)Q|eF-us4r_di{hS5R}_(2FnK%y1Tafu4e0QkRQ$LSe$j*gC&%jK!5sY<1?va+(c zxVXN)UaQsW^?IYxXf~UzR?By{=jRvFGz~u-CyyI;oUl4~GJA;r(kWcxACV`@-lW~O z;>9;VduiX{1I7JqPm0v!M2^vI12cZ>c4AFWR*n?6*h!0(YpvU$S^rvD(PorRP zo-+C{OCe_n;fqf_=z%cFfh7hDgcal-s)fYqcW)QQy=V8H-`ClO&JCW-ji)F@zsavC ze4?;LsG?{Q>+|CCrR{h;o=7B;$z*3|XIEEOI-SmBGTCf)WMrgJDCG0`TrOufBO4xG zqlfz4eyqLQ+FF~LDl?HI5+VgS6Eis`VNxawckIYH5=ZLD!c!J7CKqUDT$IQ z8O}yxq~;L;=?EQo!WIaa*)a>VGF#w7?Hr3^b!>qi*G^c3RoH?Wymrc>tjZQTov|3J zu?3+J4yBM5_`wMhpaKScc_n0Lt!jtd!GW}>F2mBxeA|TO<=eR_LW&r%(u;cWMy2r-Gip657RH{@e z%gf8vYPD9YZES4R>-9#X(QGzbt(NUbBnZ)Z2>ZXJ1aIeqcN z*ZymJMjyQSwQ@zvJ%=xS8(m%Rms1NX@h`J4h7#{@^!41YPOY}l-DAD&bB)-m^OJoG gOCMkMCI${&|G9o(`ofc|lO6HJ`I%4iu^65H2j}R#Y5)KL diff --git a/mozilla/rdf/resources/bookmark-item.gif b/mozilla/rdf/resources/bookmark-item.gif deleted file mode 100644 index 02d55f528ed19c331b1e4cd4820794f2b22ec989..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 138 zcmZ?wbhEHb6krfw*vtR|4Pe{=rW$~}hK2(N4m310{0EBvXZR1MfHaT=1d2ad7#SFN z8FYY>KobNQ7+B0Vob+6}y22{C=x)q&(*%vARE`wQ?TeP3K6dQ)MYF5disxkS;7Q treecell > titledbutton { - list-style-image: url("resource:/res/rdf/loading.gif") ! important ; -} - -treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-folder-closed.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-folder-open.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/personal-folder-closed.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/personal-folder-open.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#BookmarkSeparator"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-item.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#IEFavorite"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/IEFavorite.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-item.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/folder-open.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/folder-closed.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/article.gif"); -} - -treeitem[container="true"][open="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/folder-open.gif"); -} - -treeitem[container="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/folder-closed.gif"); -} - -treeitem > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/document.gif"); -} - -titledbutton#bookmarks { - list-style-image:url("resource:/res/rdf/bookmark-item.gif"); -} diff --git a/mozilla/rdf/resources/bookmarks.html b/mozilla/rdf/resources/bookmarks.html deleted file mode 100644 index aaccc1d7d5b..00000000000 --- a/mozilla/rdf/resources/bookmarks.html +++ /dev/null @@ -1,151 +0,0 @@ - - -Bookmarks for temp -

Bookmarks for temp

- -

-

Sample FTP URLs

-

-

FTP: Netscape -
FTP: XPNav -

-

Sample SmartFind queries

-

-

Find: Bookmark Names containing 'Netscape' -
Find: Bookmark Names starting with 'A' -
Find: Bookmark Names ending with '.com' -
Find: Bookmark Names containing 'Mac' -
Find: Bookmark URLs containing 'mac' -

-

Personal Toolbar Folder

-

-

Mozilla.org -
Tinderbox -
Bonsai -
Bugzilla -

Channels

-

-

Autos -
Business -
Computing and Internet -
Education -
Entertainment -
Games -
Health -
Kids and Family -
Lifestyles -
Local -
Netscape -
News -
Personal Finance -
Real Estate -
Shopping -
Sports -
Travel -

-

-


-

Search

-

-

Alta Vista -
Excite -
GoTo.com -
Infoseek -
LookSmart -
Lycos -
Netscape Search -

-

Business and Finance

-

-

Career Center -
CBS.MarketWatch -
Datek Online -
dbusiness.com -
Gartner Group, Inc. -
NextCard Internet Visa -
Personal Finance -
Small Business Source -
Virtual Office by Netopia -

-

Computers and Internet

-

-

@vantage -
Computing Channel -
Netscape Channel -
ONSALE Computer Auctions -
Open Studio -
Professional Connections -
SmartUpdate -
Toshiba -

-

Directories

-

-

GTE SuperPages -
Member Directory -
Netcenter Yellow Pages -
People -
Thomas Register -
Web Directory -
YellowPages AtHand -

-

Entertainment and Lifestyle

-

-

Entertainment Channel -
Games -
Health -
Kids and Family -
Lifestyle Channel -
theglobe.com community -
TV Guide -
Women.com -

-

News and Sports

-

-

ABCNEWS.com -
Business Journal -
CBS SportsLine -
In-Box Direct -
News Channel -
Sports Channel -

-

Shopping and Classifieds

-

-

Amazon.com -
Audio Book Club -
DealDeal.com Auctions -
FreeRide -
FTD Flowers -
Music Boulevard -
netMarket -
Real Estate -
Rent.Net -
Software Depot -

-

Travel and Leisure

-

-

Leisure Planet -
Local -
Renaissance Cruises -
Travelocity -

-

Macintosh Resources

-

-

Mac OS Rumors -
MacSurfer -
Macintouch -
MacWEEK -
O'Grady's Mac PowerPage -

-

AAA URLs with no redirection

-

-

Netscape -
Yahoo -
AOL -

-


-

Personal Bookmarks

-

-

-

diff --git a/mozilla/rdf/resources/bookmarks.js b/mozilla/rdf/resources/bookmarks.js deleted file mode 100644 index 3ed0ba1c778..00000000000 --- a/mozilla/rdf/resources/bookmarks.js +++ /dev/null @@ -1,108 +0,0 @@ -// -*- Mode: Java -*- - -function BookmarksNewWindow() -{ - var toolkitCore = XPAppCoresManager.Find("toolkitCore"); - if (!toolkitCore) { - toolkitCore = new ToolkitCore(); - if (toolkitCore) { - toolkitCore.Init("toolkitCore"); - } - } - if (toolkitCore) { - toolkitCore.ShowWindow("resource://res/rdf/bookmarks.xul",window); - } -} - -function BookmarkProperties() -{ - var tree = document.getElementById('bookmarksTree'); - var select_list = tree.getElementsByAttribute("selected", "true"); - - if (select_list.length >= 1) { - dump("Bookmark Properties: Have selection\n"); - var propsCore = XPAppCoresManager.Find(select_list[0].id); - if (!propsCore) { - dump("Bookmark Properties: no existing appcore\n"); - var propsCore = new DOMPropsCore(); - if (propsCore) { - dump("Bookmark Properties: initing new appcore\n"); - propsCore.Init(select_list[0].id); - } else { - dump("Bookmark Properties: failed to create new appcore\n"); - } - } - if (propsCore) { - dump("Bookmark Properties: opening new window\n"); - propsCore.showProperties("resource://res/rdf/bm-props.xul", - window, select_list[0]); - return true; - } - } else { - dump("nothing selected!\n"); - } - return false; -} - -function OpenURL(event,node) -{ - if (node.getAttribute('container') == "true") { - return false; - } - url = node.getAttribute('id'); - - // Ignore "NC:" urls. - if (url.substring(0, 3) == "NC:") { - return false; - } - - /*window.open(url,'bookmarks');*/ - var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); - if (!toolkitCore) { - toolkitCore = new ToolkitCore(); - if (toolkitCore) { - toolkitCore.Init("ToolkitCore"); - } - } - if (toolkitCore) { - toolkitCore.ShowWindow(url,window); - } - - dump("OpenURL(" + url + ")\n"); - - return true; -} - -function doSort(sortColName) -{ - var node = document.getElementById(sortColName); - // determine column resource to sort on - var sortResource = node.getAttribute('resource'); - if (!node) return(false); - - var sortDirection="ascending"; - var isSortActive = node.getAttribute('sortActive'); - if (isSortActive == "true") { - var currentDirection = node.getAttribute('sortDirection'); - if (currentDirection == "ascending") - sortDirection = "descending"; - else if (currentDirection == "descending") - sortDirection = "natural"; - else - sortDirection = "ascending"; - } - - // get RDF Core service - var rdfCore = XPAppCoresManager.Find("RDFCore"); - if (!rdfCore) { - rdfCore = new RDFCore(); - if (!rdfCore) { - return(false); - } - rdfCore.Init("RDFCore"); -// XPAppCoresManager.Add(rdfCore); - } - // sort!!! - rdfCore.doSort(node, sortResource, sortDirection); - return(false); -} diff --git a/mozilla/rdf/resources/bookmarks.xul b/mozilla/rdf/resources/bookmarks.xul deleted file mode 100644 index 12e7fc8a9b3..00000000000 --- a/mozilla/rdf/resources/bookmarks.xul +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -]> - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &tree.header.name.label; - - - - &tree.header.url.label; - - - - &tree.header.shortcut.label; - - - - - - - - - diff --git a/mozilla/rdf/resources/iefavorite.gif b/mozilla/rdf/resources/iefavorite.gif deleted file mode 100644 index cba35c4225afd72800290f660462492c42ec84e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmZ?wbhEHb6krfwIP#z2|NsAY@7_Ig=Kq;9XLj%2J#*&&nQ1dSIy%bB%hS@%xVX3& z|DS0*GtD?H&Dc0iNl8giP>^9a1MxudCkrD;wGM~?+3CPqtDw*ol-ZZEa9!&~gR_q< zgcJnN9x|vZ7U6V0E2bmWG|9avBif?Ux^0o+6dso5L#q=lWcI60)4HJ%JazG;g9gy&sip0h>4Lku#7F)Lr9y6mEAy(*U_mfNmr0}I+uxAJm FILES=\ - bookmarks.html \ history.css \ history.xul \ - bm-panel.xul \ - bm-props.xul \ - bookmark-folder-closed.gif \ - bookmark-folder-open.gif \ - bookmark-item.gif \ - bookmarks.css \ - bookmarks.js \ - bookmarks.xul \ document.gif \ dom-test-1.css \ dom-test-1.xul \ @@ -47,12 +38,9 @@ FILES=\ flames.gif \ folder-closed.gif \ folder-open.gif \ - iefavorite.gif \ ignore-test.xul \ loading.gif \ online.gif \ - personal-folder-closed.gif \ - personal-folder-open.gif \ remote-flash-1.rdf \ remote-flash-2.rdf \ remote-flash-3.rdf \ diff --git a/mozilla/rdf/resources/personal-folder-closed.gif b/mozilla/rdf/resources/personal-folder-closed.gif deleted file mode 100644 index 69fa1c09379832165373041493635a96bd45a188..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 938 zcmX9-O-R&H5TA0hB?P}}A=rx>B!UNF4z*>l3Vp(Ym=c}VC?-935NQwp2&^D52o|OY zmeRnY%bub`2|(zI&PnbxEl*jg-po9Q&tisRWcJ4}7RaScOg413j)qS(Q!MgBrXRV>LEo51rzy&gSev zD1<{Pqy>I(f&{35K_A}6Ht+?Oide7&N))PMDjpm{ftr|!2e(k8F6J;4JA>y~RBRNs z;Q&2Q1g~)-pn?hD0Rz&)5e;gp9>Rhd5TiCz581&RxN&W+9->6{NE*>1OT>ndkP2de zZ+L|{xPfT2K_=7%{s0=I0w$gTp5q>0V0jn`B7;M)qISd=hKcE6EEob(N6g3-Sz>rd z3ke|-^uRr435)O)_s25h(LxURK?p=Zq7~0^i3-gC_`hMtX@)uqg~Isw_~hhdsZ^Su zpRZIZwOVayX=!zJwO+4pZEfxC?fL#@xjY?3QT)Sk@~~mY39I8z;sDWK>c%Dh5iLZ? z2ejYUb8{{C>3*_(_wMcneY}0>*vVpP(Rzx_C$3DtUwrxbabxG&tL>?kdsA|BaQe=2 z;nc&#nK$W)%FOYDjk^oCCMw_a4cYU*dY9Wf2VNY$R_#8rGdlR}+(K@&J~Z~N;p%L? mm>L=DD_(z|>Atk{cBtI8(7XL;s+?nNgxEnkm=q7Xb+d!PuSTN|K_CbZ z3U@G}Ll-IN6h_oR-!Zg9qe4=Wz}cac70=J_+ZV?7`}Y05&%d`_9KCS1G?}3c{h?&V z;S+}~Mis|PSf7^`mRqS*DvF|XI-SjCbGckTpDz}Ry}iBFYPC|S3=a>NN+q9;eQa!% zX6&bLuYTCvTz&EUF%t=q5*fgmm`RwF$(TIcv5*L9K)}qxtjxyjfe*C^tFQ@spvSc+tFkG3P=nWEtj1>Sp;MgI*_=HH zg>Wc^w7?HekN_1h=)>E@2EM>j5et?;i9%IO#e+jAP!lup;1+7s#Tswn}J3BkOySv_QH5&7A949{p1;XG@1G9L4b}EKPo@eZ*Nd0OJAaIFR!?*v`ZoDdD|6LX#|O?| kiQ289qkX@>jzrSB-+eV#D8D>&aN*H|%&BIrqk{(b0lrncl>h($ diff --git a/mozilla/rdf/resources/sidebar-browser.rdf b/mozilla/rdf/resources/sidebar-browser.rdf index 3395cdd3498..6bcb62001df 100644 --- a/mozilla/rdf/resources/sidebar-browser.rdf +++ b/mozilla/rdf/resources/sidebar-browser.rdf @@ -35,8 +35,8 @@ &sidebar.bookmarks.label; - resource://res/rdf/bm-panel.xul - resource://res/rdf/bm-panel-cust.xul + resource://res/samples/bm-panel.xul + resource://res/samples/bm-panel-cust.xul diff --git a/mozilla/rdf/resources/sidebar.css b/mozilla/rdf/resources/sidebar.css index 1045eab472f..37752880327 100644 --- a/mozilla/rdf/resources/sidebar.css +++ b/mozilla/rdf/resources/sidebar.css @@ -75,34 +75,6 @@ treeitem[container="true"][open="true"][loading="true"] > treecell > titledbutto list-style-image: url("resource:/res/rdf/loading.gif") ! important ; } -treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-folder-closed.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-folder-open.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/personal-folder-closed.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/personal-folder-open.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#BookmarkSeparator"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-item.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#IEFavorite"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/IEFavorite.gif"); -} - -treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treecell > titledbutton { - list-style-image: url("resource:/res/rdf/bookmark-item.gif"); -} - treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treecell > titledbutton { list-style-image: url("resource:/res/rdf/folder-open.gif"); } @@ -127,10 +99,6 @@ treeitem > treecell > titledbutton { list-style-image: url("resource:/res/rdf/document.gif"); } -titledbutton#bookmarks { - list-style-image:url("resource:/res/rdf/bookmark-item.gif"); -} - toolbar#sidebarbar titledbutton{ color:#CCCCFF; }