nsIPlacesImportExportService 编辑

toolkit/components/places/nsIPlacesImportExportService.idlScriptable Provides methods for exporting Places data. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11)

In the past, this interface also offered methods for importing Places data, but those methods are now part of the BookmarkHTMLUtils.jsm JavaScript code module. The interface name has been kept for compatibility reasons for code using the export service.

Implemented by: @mozilla.org/import-export-service;1 as a service:

var placesImportExportService = Components.classes["@mozilla.org/import-export-service;1"]
                                .getService(Components.interfaces.nsIPlacesImportExportService);

Method overview

void backupBookmarksFile();
void exportHTMLToFile(in nsILocalFile aFile);
void importHTMLFromFile(in nsILocalFile aFile, in boolean aIsInitialImport); Obsolete since Gecko 14.0
void importHTMLFromFileToFolder(in nsILocalFile aFile, in PRInt64 aFolder, in boolean aIsInitialImport); Obsolete since Gecko 14.0
void importHTMLFromURI(in nsIURI aURI, in boolean aIsInitialImport); Obsolete since Gecko 14.0

Methods

backupBookmarksFile()

Backs up the bookmarks.html file.

void backupBookmarksFile();
Parameters

None.

exportHTMLToFile()

Saves the current bookmarks hierarchy to a bookmarks.html file.

void exportHTMLToFile(
  in nsILocalFile aFile
);
Parameters
aFile
An nsILocalFile indicating where to save the new bookmarks.html file.

importHTMLFromFile()

Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code module instead.

Loads the given bookmarks.html file and replaces it with the current bookmarks hierarchy (if aIsInitialImport is true) or appends it (if aIsInitialImport is false).

Three nsIObserverService notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks. Observers will be passed through their data parameters either "html" if aIsInitialImport is false or "html-initial" if aIsInitialImport is true. The observer subject will be null.

void importHTMLFromFile(
  in nsILocalFile aFile,
  in boolean aIsInitialImport
);
Parameters
aFile
The HTML file to import into Places.
aIsInitialImport
Whether this is an initial import or not.

importHTMLFromFileToFolder()

Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code module instead.Loads the given bookmarks.html file and puts it in the given folder.

Three nsIObserverService notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks. Observers will be passed through their data parameters either "html" if aIsInitialImport is false or "html-initial" if aIsInitialImport is true. The observer subject will be an nsISupportsPRInt64 whose value is aFolder.

void importHTMLFromFileToFolder(
  in nsILocalFile aFile,
  in PRInt64 aFolder,
  in boolean aIsInitialImport
);
Parameters
aFile
The file to import.
aFolder
The ID of the bookmarks folder into which to import the bookmarks.
aIsInitialImport
Whether or not this is an initial import.

importHTMLFromURI()

Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code module instead.

Same thing as importHTMLFromFile(), but takes a URI instead.

void importHTMLFromURI(
  in nsIURI aURI,
  in boolean aIsInitialImport
);
Parameters
aURI
The URI from which to import bookmarks.
aIsInitialImport
Whether or not this is an initial import.

See also

  • BookmarkHTMLUtils.jsm

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:51 次

字数:7610

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文