зеркало из https://github.com/mozilla/pjs.git
Import IE favorites and history on Mac might like how its also done on Windows.
This commit is contained in:
Родитель
81b9b5804b
Коммит
19feb29e00
|
@ -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;
|
||||
|
|
Двоичные данные
modules/rdf/macbuild/RDF.mcp
Двоичные данные
modules/rdf/macbuild/RDF.mcp
Двоичный файл не отображается.
|
@ -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;
|
||||
}
|
||||
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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,18 @@
|
|||
#include "client.h"
|
||||
#include "prio.h"
|
||||
#include "prlong.h"
|
||||
#include "nlcstore.h"
|
||||
#include "remstore.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <Appletalk.h>
|
||||
#include <Devices.h>
|
||||
#include <Files.h>
|
||||
#include <FinderRegistry.h>
|
||||
#include <Folders.h>
|
||||
#include <Processes.h>
|
||||
|
||||
#include "FullPath.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -9006,12 +9006,22 @@ dropOn (HT_Resource dropTarget, HT_Resource dropObject, PRBool justAction)
|
|||
break;
|
||||
|
||||
case LDAP_RT:
|
||||
return DROP_NOT_ALLOWED;
|
||||
break;
|
||||
|
||||
case RDF_RT :
|
||||
if (justAction)
|
||||
{
|
||||
if (HT_IsLocalData(dropTarget))
|
||||
{
|
||||
return COPY_MOVE_LINK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DROP_NOT_ALLOWED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return copyMoveRDFLink(dropTarget, dropObject);
|
||||
}
|
||||
|
|
|
@ -95,6 +95,8 @@ readInBookmarksOnInit(RDFFile f)
|
|||
parseNextBkBlob(f, buf, len);
|
||||
}
|
||||
|
||||
if (f->db == gLocalStore)
|
||||
{
|
||||
/* if no personal toolbar was specified in bookmark file, create one */
|
||||
|
||||
ptFolder = nlocalStoreGetSlotValue(f->db, gNavCenter->RDF_PersonalToolbarFolderCategory,
|
||||
|
@ -113,7 +115,7 @@ readInBookmarksOnInit(RDFFile f)
|
|||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче