diff --git a/modules/rdf/include/vocab.h b/modules/rdf/include/vocab.h index 6b66bdf729c..43219db52ac 100644 --- a/modules/rdf/include/vocab.h +++ b/modules/rdf/include/vocab.h @@ -64,6 +64,11 @@ typedef struct _RDF_NCVocabStruct { RDF_Resource RDF_HistoryBySite; RDF_Resource RDF_HistoryByDate; RDF_Resource RDF_HistoryMostVisited; + + /* IE items */ + RDF_Resource RDF_IEBookmarkFolderCategory; + RDF_Resource RDF_IEHistory; + RDF_Resource RDF_bookmarkAddDate; RDF_Resource RDF_PersonalToolbarFolderCategory; RDF_Resource RDF_Column; diff --git a/modules/rdf/macbuild/RDF.mcp b/modules/rdf/macbuild/RDF.mcp index d1c5c7a22c7..ecdccaaa423 100644 Binary files a/modules/rdf/macbuild/RDF.mcp and b/modules/rdf/macbuild/RDF.mcp differ diff --git a/modules/rdf/src/bmk2mcf.c b/modules/rdf/src/bmk2mcf.c index 2db144c7c02..fcf8b41cd84 100644 --- a/modules/rdf/src/bmk2mcf.c +++ b/modules/rdf/src/bmk2mcf.c @@ -161,18 +161,22 @@ parseNextBkToken (RDFFile f, char* token) if ((f->status == IN_TITLE) || (f->status == IN_H3) || (f->status == IN_ITEM_TITLE)) { if (IN_H3 && gBkFolderDate) { - char url[150]; + char *url; RDF_Resource newFolder; - sprintf(url, "%s%s.rdf", gBkFolderDate, token); + url = PR_smprintf("%s%s.rdf", gBkFolderDate, token); newFolder = createContainer(url); + XP_FREE(url); addSlotValue(f,newFolder, gCoreVocab->RDF_parent, f->stack[f->depth-1], RDF_RESOURCE_TYPE, true); freeMem(gBkFolderDate); gBkFolderDate = NULL; f->lastItem = newFolder; } - addSlotValue(f, f->lastItem, gCoreVocab->RDF_name, - copyString(token), RDF_STRING_TYPE, true); + if ((f->db == gLocalStore) || (f->status != IN_TITLE)) + { + addSlotValue(f, f->lastItem, gCoreVocab->RDF_name, + copyString(token), RDF_STRING_TYPE, true); + } if (startsWith("Personal Toolbar", token) && (containerp(f->lastItem))) nlocalStoreAssert(gLocalStore, f->lastItem, gCoreVocab->RDF_instanceOf, gNavCenter->RDF_PersonalToolbarFolderCategory, diff --git a/modules/rdf/src/fs2rdf.c b/modules/rdf/src/fs2rdf.c index 3ae587bc92a..236923c5d6f 100644 --- a/modules/rdf/src/fs2rdf.c +++ b/modules/rdf/src/fs2rdf.c @@ -30,6 +30,8 @@ /* external string references in allxpstr */ extern int RDF_UNABLETODELETEFILE, RDF_UNABLETODELETEFOLDER; +extern RDF gNCDB; + #define IMPORT_LIST_SIZE 12 /* XXX localization */ @@ -122,6 +124,89 @@ GuessIEBookmarks (void) importForProfile("file:///c|/windows/", NULL); } XP_FREE(nativePath); + +#elif XP_MAC + + Handle nameH; + RDFFile newFile; + char *nativePath, *url; + short len, prefsVRefNum; + long prefsDirID; + OSErr err; + + if (!(err = FindFolder(kOnSystemDisk, kPreferencesFolderType, + kDontCreateFolder, &prefsVRefNum, &prefsDirID))) + { + if (!(err = GetFullPath(prefsVRefNum, prefsDirID, "\p:Explorer:Favorites.html", &len, &nameH))) + { + if (nameH != NULL) + { + HLock(nameH); + nativePath = PR_smprintf("%.*s", (int)len, *nameH); + DisposeHandle(nameH); + if (nativePath != NULL) + { + url = XP_PlatformFileToURL(nativePath); + XP_FREE(nativePath); + if (url != NULL) + { + if ((newFile = makeRDFFile(url, gNavCenter->RDF_IEBookmarkFolderCategory, + true)) != NULL) + { + newFile->fileType = RDF_BOOKMARKS; + /* + newFile->db = gLocalStore; + newFile->assert = nlocalStoreAssert1; + */ + newFile->db = gRemoteStore; + newFile->assert = remoteAssert3; + readInBookmarksOnInit(newFile); + + RDF_Assert(gNCDB, gNavCenter->RDF_IEBookmarkFolderCategory, + gCoreVocab->RDF_parent, + gNavCenter->RDF_BookmarkFolderCategory, + RDF_RESOURCE_TYPE); + } + XP_FREE(url); + } + } + } + } + if (!(err = GetFullPath(prefsVRefNum, prefsDirID, "\p:Explorer:History.html", &len, &nameH))) + { + if (nameH != NULL) + { + HLock(nameH); + nativePath = PR_smprintf("%.*s", (int)len, *nameH); + DisposeHandle(nameH); + if (nativePath != NULL) + { + url = XP_PlatformFileToURL(nativePath); + XP_FREE(nativePath); + if (url != NULL) + { + if ((newFile = makeRDFFile(url, gNavCenter->RDF_IEHistory, + true)) != NULL) + { + newFile->fileType = RDF_BOOKMARKS; + /* + newFile->db = gLocalStore; + newFile->assert = nlocalStoreAssert1; + */ + newFile->db = gRemoteStore; + newFile->assert = remoteAssert3; + readInBookmarksOnInit(newFile); + + RDF_Assert(gNCDB, gNavCenter->RDF_IEHistory, + gCoreVocab->RDF_parent, gNavCenter->RDF_History, + RDF_RESOURCE_TYPE); + } + XP_FREE(url); + } + } + } + } + } #endif } diff --git a/modules/rdf/src/fs2rdf.h b/modules/rdf/src/fs2rdf.h index c565bade95b..df409338466 100644 --- a/modules/rdf/src/fs2rdf.h +++ b/modules/rdf/src/fs2rdf.h @@ -25,13 +25,18 @@ #include "client.h" #include "prio.h" #include "prlong.h" +#include "nlcstore.h" +#include "remstore.h" #ifdef XP_MAC #include #include #include #include +#include #include + +#include "FullPath.h" #endif diff --git a/modules/rdf/src/ht.c b/modules/rdf/src/ht.c index 7086402bba2..ce32b5f837d 100644 --- a/modules/rdf/src/ht.c +++ b/modules/rdf/src/ht.c @@ -9006,10 +9006,20 @@ dropOn (HT_Resource dropTarget, HT_Resource dropObject, PRBool justAction) break; case LDAP_RT: + return DROP_NOT_ALLOWED; + break; + case RDF_RT : if (justAction) { - return COPY_MOVE_LINK; + if (HT_IsLocalData(dropTarget)) + { + return COPY_MOVE_LINK; + } + else + { + return DROP_NOT_ALLOWED; + } } else { diff --git a/modules/rdf/src/nlcstore.c b/modules/rdf/src/nlcstore.c index 423de4a1949..f7b4ed3524c 100644 --- a/modules/rdf/src/nlcstore.c +++ b/modules/rdf/src/nlcstore.c @@ -95,25 +95,27 @@ readInBookmarksOnInit(RDFFile f) parseNextBkBlob(f, buf, len); } - /* if no personal toolbar was specified in bookmark file, create one */ - - ptFolder = nlocalStoreGetSlotValue(f->db, gNavCenter->RDF_PersonalToolbarFolderCategory, - gCoreVocab->RDF_instanceOf, RDF_RESOURCE_TYPE, true, true); - - if (ptFolder == NULL) + if (f->db == gLocalStore) { - if ((ptFolder = createContainer("personaltoolbar.rdf")) != NULL) - { - addSlotValue(f, ptFolder, gCoreVocab->RDF_parent, - gNavCenter->RDF_BookmarkFolderCategory, - RDF_RESOURCE_TYPE, true); - addSlotValue(f, ptFolder, gCoreVocab->RDF_name, - copyString(XP_GetString(RDF_PERSONAL_TOOLBAR_NAME)), - RDF_STRING_TYPE, true ); - RDFUtil_SetPTFolder(ptFolder); - } - } + /* if no personal toolbar was specified in bookmark file, create one */ + ptFolder = nlocalStoreGetSlotValue(f->db, gNavCenter->RDF_PersonalToolbarFolderCategory, + gCoreVocab->RDF_instanceOf, RDF_RESOURCE_TYPE, true, true); + + if (ptFolder == NULL) + { + if ((ptFolder = createContainer("personaltoolbar.rdf")) != NULL) + { + addSlotValue(f, ptFolder, gCoreVocab->RDF_parent, + gNavCenter->RDF_BookmarkFolderCategory, + RDF_RESOURCE_TYPE, true); + addSlotValue(f, ptFolder, gCoreVocab->RDF_name, + copyString(XP_GetString(RDF_PERSONAL_TOOLBAR_NAME)), + RDF_STRING_TYPE, true ); + RDFUtil_SetPTFolder(ptFolder); + } + } + } PR_Close(fp); freeMem(f->line); freeMem(f->currentSlot); @@ -177,6 +179,7 @@ DBM_OpenDBMStore (DBMRDF store, char* directory) newFile->db = gLocalStore; newFile->assert = nlocalStoreAssert1; readInBookmarksOnInit(newFile); + doingFirstTimeInitp = 0; (*store->propDB->sync)(store->propDB, 0); (*store->invPropDB->sync)(store->invPropDB, 0); diff --git a/modules/rdf/src/rdfht.c b/modules/rdf/src/rdfht.c index 5582d856e04..bcd7055ebb3 100644 --- a/modules/rdf/src/rdfht.c +++ b/modules/rdf/src/rdfht.c @@ -127,9 +127,9 @@ RDF_Init(RDF_InitParams params) freeMem(navCenterURL); HT_Startup(); -#ifdef XP_WIN + GuessIEBookmarks(); -#endif + #endif walkThroughAllBookmarks(RDF_GetResource(NULL, "NC:Bookmarks", true)); return 0; diff --git a/modules/rdf/src/vocab.c b/modules/rdf/src/vocab.c index 694fefe2c95..b82d4cb6080 100644 --- a/modules/rdf/src/vocab.c +++ b/modules/rdf/src/vocab.c @@ -140,6 +140,12 @@ createNavCenterVocab () { setResourceType(gNavCenter->RDF_HistoryBySite, HISTORY_RT); setResourceType(gNavCenter->RDF_HistoryByDate, HISTORY_RT); setResourceType(gNavCenter->RDF_HistoryMostVisited, HISTORY_RT); + + /* IE items */ + gNavCenter->RDF_IEBookmarkFolderCategory = createContainer("NC:IEBookmarks"); + gNavCenter->RDF_IEHistory = createContainer("NC:IEHistory"); + setResourceType(gNavCenter->RDF_IEHistory, HISTORY_RT); + gNavCenter->RDF_bookmarkAddDate = newResource("bookmarkAddDate", RDF_ADDED_ON_STR); gNavCenter->RDF_PersonalToolbarFolderCategory = RDF_GetResource(gCoreDB, "PersonalToolbarCat", true); @@ -375,6 +381,16 @@ getResourceDefaultName(RDF_Resource node) { defaultName = XP_GetString(strID); } + /* XXX localization !!! */ + else if (node == gNavCenter->RDF_IEBookmarkFolderCategory) + { + defaultName = "Your IE Favorites"; + } + else if (node == gNavCenter->RDF_IEHistory) + { + defaultName = "Your IE History"; + } + #endif /* MOZILLA_CLIENT */ return(defaultName); }