eric6/WebBrowser/Bookmarks/BookmarksImporters/FirefoxImporter.py

changeset 8205
4a0f1f896341
parent 8143
2c730d5fd177
child 8218
7c09585bd960
equal deleted inserted replaced
8204:fd477cded1c1 8205:4a0f1f896341
27 the default bookmarks file (string), an info text (string), 27 the default bookmarks file (string), an info text (string),
28 a prompt (string) and the default directory of the bookmarks file 28 a prompt (string) and the default directory of the bookmarks file
29 (string) 29 (string)
30 @exception ValueError raised to indicate an invalid browser ID 30 @exception ValueError raised to indicate an invalid browser ID
31 """ 31 """
32 if sourceId == "firefox": 32 if sourceId != "firefox":
33 if Globals.isWindowsPlatform():
34 standardDir = os.path.expandvars(
35 "%APPDATA%\\Mozilla\\Firefox\\Profiles")
36 elif Globals.isMacPlatform():
37 standardDir = os.path.expanduser(
38 "~/Library/Application Support/Firefox/Profiles")
39 else:
40 standardDir = os.path.expanduser("~/.mozilla/firefox")
41 return (
42 UI.PixmapCache.getPixmap("chrome"),
43 "Mozilla Firefox",
44 "places.sqlite",
45 QCoreApplication.translate(
46 "FirefoxImporter",
47 """Mozilla Firefox stores its bookmarks in the"""
48 """ <b>places.sqlite</b> SQLite database. This file is"""
49 """ usually located in"""),
50 QCoreApplication.translate(
51 "FirefoxImporter",
52 """Please choose the file to begin importing bookmarks."""),
53 standardDir,
54 )
55 else:
56 raise ValueError( 33 raise ValueError(
57 "Unsupported browser ID given ({0}).".format(sourceId)) 34 "Unsupported browser ID given ({0}).".format(sourceId))
35
36 if Globals.isWindowsPlatform():
37 standardDir = os.path.expandvars(
38 "%APPDATA%\\Mozilla\\Firefox\\Profiles")
39 elif Globals.isMacPlatform():
40 standardDir = os.path.expanduser(
41 "~/Library/Application Support/Firefox/Profiles")
42 else:
43 standardDir = os.path.expanduser("~/.mozilla/firefox")
44 return (
45 UI.PixmapCache.getPixmap("chrome"),
46 "Mozilla Firefox",
47 "places.sqlite",
48 QCoreApplication.translate(
49 "FirefoxImporter",
50 """Mozilla Firefox stores its bookmarks in the"""
51 """ <b>places.sqlite</b> SQLite database. This file is"""
52 """ usually located in"""),
53 QCoreApplication.translate(
54 "FirefoxImporter",
55 """Please choose the file to begin importing bookmarks."""),
56 standardDir,
57 )
58 58
59 59
60 class FirefoxImporter(BookmarksImporter): 60 class FirefoxImporter(BookmarksImporter):
61 """ 61 """
62 Class implementing the Chrome bookmarks importer. 62 Class implementing the Chrome bookmarks importer.

eric ide

mercurial