Helpviewer/Bookmarks/BookmarksImporters/XbelImporter.py

changeset 1729
66b9dc45f2bd
parent 1713
56fdde8a2441
child 1965
96f5a76e1845
equal deleted inserted replaced
1727:9355815a4403 1729:66b9dc45f2bd
39 """This file is usually located in""" 39 """This file is usually located in"""
40 ).format(os.path.basename(bookmarksFile)), 40 ).format(os.path.basename(bookmarksFile)),
41 QCoreApplication.translate("XbelImporter", 41 QCoreApplication.translate("XbelImporter",
42 """Please choose the file to begin importing bookmarks."""), 42 """Please choose the file to begin importing bookmarks."""),
43 os.path.dirname(bookmarksFile), 43 os.path.dirname(bookmarksFile),
44 )
45 elif id == "konqueror":
46 if os.path.exists(os.path.expanduser("~/.kde4")):
47 standardDir = os.path.expanduser("~/.kde4/share/apps/konqueror")
48 elif os.path.exists(os.path.expanduser("~/.kde")):
49 standardDir = os.path.expanduser("~/.kde/share/apps/konqueror")
50 else:
51 standardDir = ""
52 return (
53 UI.PixmapCache.getPixmap("konqueror.png"),
54 "Konqueror",
55 "bookmarks.xml",
56 QCoreApplication.translate("XbelImporter",
57 """Konqueror stores its bookmarks in the <b>bookmarks.xml</b> XML """
58 """file. This file is usually located in"""),
59 QCoreApplication.translate("XbelImporter",
60 """Please choose the file to begin importing bookmarks."""),
61 standardDir,
44 ) 62 )
45 elif id == "xbel": 63 elif id == "xbel":
46 return ( 64 return (
47 UI.PixmapCache.getPixmap("xbel.png"), 65 UI.PixmapCache.getPixmap("xbel.png"),
48 "XBEL Bookmarks", 66 "XBEL Bookmarks",
105 importRootNode = reader.read(self.__fileName) 123 importRootNode = reader.read(self.__fileName)
106 124
107 if reader.error() != QXmlStreamReader.NoError: 125 if reader.error() != QXmlStreamReader.NoError:
108 self._error = True 126 self._error = True
109 self._errorString = self.trUtf8( 127 self._errorString = self.trUtf8(
110 """Error when importing bookmarks on line {0}, column [1}:\n{2}""")\ 128 """Error when importing bookmarks on line {0}, column {1}:\n{2}""")\
111 .format(reader.lineNumber(), 129 .format(reader.lineNumber(),
112 reader.columnNumber(), 130 reader.columnNumber(),
113 reader.errorString()) 131 reader.errorString())
114 return None 132 return None
115 133
116 importRootNode.setType(BookmarkNode.Folder) 134 importRootNode.setType(BookmarkNode.Folder)
117 if self._id == "e5browser": 135 if self._id == "e5browser":
118 importRootNode.title = self.trUtf8("eric5 Web Browser Import") 136 importRootNode.title = self.trUtf8("eric5 Web Browser Import")
137 elif self._id == "konqueror":
138 importRootNode.title = self.trUtf8("Konqueror Import")
119 elif self._id == "xbel": 139 elif self._id == "xbel":
120 importRootNode.title = self.trUtf8("XBEL Import") 140 importRootNode.title = self.trUtf8("XBEL Import")
121 else: 141 else:
122 importRootNode.title = self.trUtf8("Imported {0}")\ 142 importRootNode.title = self.trUtf8("Imported {0}")\
123 .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) 143 .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate))

eric ide

mercurial