Helpviewer/Bookmarks/BookmarksImporters/SafariImporter.py

changeset 3002
6ffc581f00f1
parent 2954
bf0215fe12d1
child 3022
57179e4cdadd
child 3057
10516539f238
equal deleted inserted replaced
3001:3674ff5fa8f8 3002:6ffc581f00f1
24 Module function to get information for the given source id. 24 Module function to get information for the given source id.
25 25
26 @param id id of the browser ("chrome" or "chromium") 26 @param id id of the browser ("chrome" or "chromium")
27 @return tuple with an icon (QPixmap), readable name (string), name of 27 @return tuple with an icon (QPixmap), readable name (string), name of
28 the default bookmarks file (string), an info text (string), 28 the default bookmarks file (string), an info text (string),
29 a prompt (string) and the default directory of the bookmarks file (string) 29 a prompt (string) and the default directory of the bookmarks file
30 (string)
30 @exception ValueError raised to indicate an invalid browser ID 31 @exception ValueError raised to indicate an invalid browser ID
31 """ 32 """
32 if id == "safari": 33 if id == "safari":
33 if Globals.isWindowsPlatform(): 34 if Globals.isWindowsPlatform():
34 standardDir = os.path.expandvars( 35 standardDir = os.path.expandvars(
39 standardDir = "" 40 standardDir = ""
40 return ( 41 return (
41 UI.PixmapCache.getPixmap("safari.png"), 42 UI.PixmapCache.getPixmap("safari.png"),
42 "Apple Safari", 43 "Apple Safari",
43 "Bookmarks.plist", 44 "Bookmarks.plist",
44 QCoreApplication.translate("SafariImporter", 45 QCoreApplication.translate(
45 """Apple Safari stores its bookmarks in the <b>Bookmarks.plist</b> """ 46 "SafariImporter",
46 """file. This file is usually located in"""), 47 """Apple Safari stores its bookmarks in the"""
48 """ <b>Bookmarks.plist</b> file. This file is usually"""
49 """ located in"""),
47 QCoreApplication.translate("SafariImporter", 50 QCoreApplication.translate("SafariImporter",
48 """Please choose the file to begin importing bookmarks."""), 51 """Please choose the file to begin importing bookmarks."""),
49 standardDir, 52 standardDir,
50 ) 53 )
51 else: 54 else:
134 if url.startswith(("place:", "about:")): 137 if url.startswith(("place:", "about:")):
135 continue 138 continue
136 139
137 bookmark = BookmarkNode(BookmarkNode.Bookmark, rootNode) 140 bookmark = BookmarkNode(BookmarkNode.Bookmark, rootNode)
138 bookmark.url = url 141 bookmark.url = url
139 bookmark.title = child["URIDictionary"]["title"].replace("&", "&&") 142 bookmark.title = child["URIDictionary"]["title"]\
143 .replace("&", "&&")

eric ide

mercurial