Import IE favorites and history on Mac might like how its also done on Windows.

This commit is contained in:
rjc%netscape.com 1998-08-17 20:17:06 +00:00
Родитель 81b9b5804b
Коммит 19feb29e00
9 изменённых файлов: 152 добавлений и 24 удалений

Просмотреть файл

@ -64,6 +64,11 @@ typedef struct _RDF_NCVocabStruct {
RDF_Resource RDF_HistoryBySite; RDF_Resource RDF_HistoryBySite;
RDF_Resource RDF_HistoryByDate; RDF_Resource RDF_HistoryByDate;
RDF_Resource RDF_HistoryMostVisited; RDF_Resource RDF_HistoryMostVisited;
/* IE items */
RDF_Resource RDF_IEBookmarkFolderCategory;
RDF_Resource RDF_IEHistory;
RDF_Resource RDF_bookmarkAddDate; RDF_Resource RDF_bookmarkAddDate;
RDF_Resource RDF_PersonalToolbarFolderCategory; RDF_Resource RDF_PersonalToolbarFolderCategory;
RDF_Resource RDF_Column; RDF_Resource RDF_Column;

Двоичные данные
modules/rdf/macbuild/RDF.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -161,18 +161,22 @@ parseNextBkToken (RDFFile f, char* token)
if ((f->status == IN_TITLE) || (f->status == IN_H3) || if ((f->status == IN_TITLE) || (f->status == IN_H3) ||
(f->status == IN_ITEM_TITLE)) { (f->status == IN_ITEM_TITLE)) {
if (IN_H3 && gBkFolderDate) { if (IN_H3 && gBkFolderDate) {
char url[150]; char *url;
RDF_Resource newFolder; RDF_Resource newFolder;
sprintf(url, "%s%s.rdf", gBkFolderDate, token); url = PR_smprintf("%s%s.rdf", gBkFolderDate, token);
newFolder = createContainer(url); newFolder = createContainer(url);
XP_FREE(url);
addSlotValue(f,newFolder, gCoreVocab->RDF_parent, f->stack[f->depth-1], addSlotValue(f,newFolder, gCoreVocab->RDF_parent, f->stack[f->depth-1],
RDF_RESOURCE_TYPE, true); RDF_RESOURCE_TYPE, true);
freeMem(gBkFolderDate); freeMem(gBkFolderDate);
gBkFolderDate = NULL; gBkFolderDate = NULL;
f->lastItem = newFolder; f->lastItem = newFolder;
} }
if ((f->db == gLocalStore) || (f->status != IN_TITLE))
{
addSlotValue(f, f->lastItem, gCoreVocab->RDF_name, addSlotValue(f, f->lastItem, gCoreVocab->RDF_name,
copyString(token), RDF_STRING_TYPE, true); copyString(token), RDF_STRING_TYPE, true);
}
if (startsWith("Personal Toolbar", token) && (containerp(f->lastItem))) if (startsWith("Personal Toolbar", token) && (containerp(f->lastItem)))
nlocalStoreAssert(gLocalStore, f->lastItem, gCoreVocab->RDF_instanceOf, nlocalStoreAssert(gLocalStore, f->lastItem, gCoreVocab->RDF_instanceOf,
gNavCenter->RDF_PersonalToolbarFolderCategory, gNavCenter->RDF_PersonalToolbarFolderCategory,

Просмотреть файл

@ -30,6 +30,8 @@
/* external string references in allxpstr */ /* external string references in allxpstr */
extern int RDF_UNABLETODELETEFILE, RDF_UNABLETODELETEFOLDER; extern int RDF_UNABLETODELETEFILE, RDF_UNABLETODELETEFOLDER;
extern RDF gNCDB;
#define IMPORT_LIST_SIZE 12 #define IMPORT_LIST_SIZE 12
/* XXX localization */ /* XXX localization */
@ -122,6 +124,89 @@ GuessIEBookmarks (void)
importForProfile("file:///c|/windows/", NULL); importForProfile("file:///c|/windows/", NULL);
} }
XP_FREE(nativePath); 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 #endif
} }

Просмотреть файл

@ -25,13 +25,18 @@
#include "client.h" #include "client.h"
#include "prio.h" #include "prio.h"
#include "prlong.h" #include "prlong.h"
#include "nlcstore.h"
#include "remstore.h"
#ifdef XP_MAC #ifdef XP_MAC
#include <Appletalk.h> #include <Appletalk.h>
#include <Devices.h> #include <Devices.h>
#include <Files.h> #include <Files.h>
#include <FinderRegistry.h> #include <FinderRegistry.h>
#include <Folders.h>
#include <Processes.h> #include <Processes.h>
#include "FullPath.h"
#endif #endif

Просмотреть файл

@ -9006,12 +9006,22 @@ dropOn (HT_Resource dropTarget, HT_Resource dropObject, PRBool justAction)
break; break;
case LDAP_RT: case LDAP_RT:
return DROP_NOT_ALLOWED;
break;
case RDF_RT : case RDF_RT :
if (justAction) if (justAction)
{
if (HT_IsLocalData(dropTarget))
{ {
return COPY_MOVE_LINK; return COPY_MOVE_LINK;
} }
else else
{
return DROP_NOT_ALLOWED;
}
}
else
{ {
return copyMoveRDFLink(dropTarget, dropObject); return copyMoveRDFLink(dropTarget, dropObject);
} }

Просмотреть файл

@ -95,6 +95,8 @@ readInBookmarksOnInit(RDFFile f)
parseNextBkBlob(f, buf, len); parseNextBkBlob(f, buf, len);
} }
if (f->db == gLocalStore)
{
/* if no personal toolbar was specified in bookmark file, create one */ /* if no personal toolbar was specified in bookmark file, create one */
ptFolder = nlocalStoreGetSlotValue(f->db, gNavCenter->RDF_PersonalToolbarFolderCategory, ptFolder = nlocalStoreGetSlotValue(f->db, gNavCenter->RDF_PersonalToolbarFolderCategory,
@ -113,7 +115,7 @@ readInBookmarksOnInit(RDFFile f)
RDFUtil_SetPTFolder(ptFolder); RDFUtil_SetPTFolder(ptFolder);
} }
} }
}
PR_Close(fp); PR_Close(fp);
freeMem(f->line); freeMem(f->line);
freeMem(f->currentSlot); freeMem(f->currentSlot);
@ -177,6 +179,7 @@ DBM_OpenDBMStore (DBMRDF store, char* directory)
newFile->db = gLocalStore; newFile->db = gLocalStore;
newFile->assert = nlocalStoreAssert1; newFile->assert = nlocalStoreAssert1;
readInBookmarksOnInit(newFile); readInBookmarksOnInit(newFile);
doingFirstTimeInitp = 0; doingFirstTimeInitp = 0;
(*store->propDB->sync)(store->propDB, 0); (*store->propDB->sync)(store->propDB, 0);
(*store->invPropDB->sync)(store->invPropDB, 0); (*store->invPropDB->sync)(store->invPropDB, 0);

Просмотреть файл

@ -127,9 +127,9 @@ RDF_Init(RDF_InitParams params)
freeMem(navCenterURL); freeMem(navCenterURL);
HT_Startup(); HT_Startup();
#ifdef XP_WIN
GuessIEBookmarks(); GuessIEBookmarks();
#endif
#endif #endif
walkThroughAllBookmarks(RDF_GetResource(NULL, "NC:Bookmarks", true)); walkThroughAllBookmarks(RDF_GetResource(NULL, "NC:Bookmarks", true));
return 0; return 0;

Просмотреть файл

@ -140,6 +140,12 @@ createNavCenterVocab () {
setResourceType(gNavCenter->RDF_HistoryBySite, HISTORY_RT); setResourceType(gNavCenter->RDF_HistoryBySite, HISTORY_RT);
setResourceType(gNavCenter->RDF_HistoryByDate, HISTORY_RT); setResourceType(gNavCenter->RDF_HistoryByDate, HISTORY_RT);
setResourceType(gNavCenter->RDF_HistoryMostVisited, 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_bookmarkAddDate = newResource("bookmarkAddDate", RDF_ADDED_ON_STR);
gNavCenter->RDF_PersonalToolbarFolderCategory = gNavCenter->RDF_PersonalToolbarFolderCategory =
RDF_GetResource(gCoreDB, "PersonalToolbarCat", true); RDF_GetResource(gCoreDB, "PersonalToolbarCat", true);
@ -375,6 +381,16 @@ getResourceDefaultName(RDF_Resource node)
{ {
defaultName = XP_GetString(strID); 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 */ #endif /* MOZILLA_CLIENT */
return(defaultName); return(defaultName);
} }