19 |
19 |
20 def getImporterInfo(sourceId): |
20 def getImporterInfo(sourceId): |
21 """ |
21 """ |
22 Module function to get information for the given XBEL source id. |
22 Module function to get information for the given XBEL source id. |
23 |
23 |
24 @param sourceId id of the browser ("chrome" or "chromium") |
24 @param sourceId id of the browser |
25 @return tuple with an icon (QPixmap), readable name (string), name of |
25 @type str |
26 the default bookmarks file (string), an info text (string), |
26 @return tuple with an icon, readable name, name of the default |
27 a prompt (string) and the default directory of the bookmarks file |
27 bookmarks file, an info text, a prompt and the default directory |
28 (string) |
28 of the bookmarks file |
|
29 @rtype tuple of (QPixmap, str, str, str, str, str) |
29 @exception ValueError raised to indicate an invalid browser ID |
30 @exception ValueError raised to indicate an invalid browser ID |
30 """ |
31 """ |
31 if sourceId not in ("e5browser", "konqueror", "xbel"): |
32 if sourceId not in ("e5browser", "konqueror", "xbel"): |
32 raise ValueError("Unsupported browser ID given ({0}).".format(sourceId)) |
33 raise ValueError("Unsupported browser ID given ({0}).".format(sourceId)) |
33 |
34 |
111 |
112 |
112 def setPath(self, path): |
113 def setPath(self, path): |
113 """ |
114 """ |
114 Public method to set the path of the bookmarks file or directory. |
115 Public method to set the path of the bookmarks file or directory. |
115 |
116 |
116 @param path bookmarks file or directory (string) |
117 @param path bookmarks file or directory |
|
118 @type str |
117 """ |
119 """ |
118 self.__fileName = path |
120 self.__fileName = path |
119 |
121 |
120 def open(self): |
122 def open(self): |
121 """ |
123 """ |
122 Public method to open the bookmarks file. |
124 Public method to open the bookmarks file. |
123 |
125 |
124 @return flag indicating success (boolean) |
126 @return flag indicating success |
|
127 @rtype bool |
125 """ |
128 """ |
126 if not os.path.exists(self.__fileName): |
129 if not os.path.exists(self.__fileName): |
127 self._error = True |
130 self._error = True |
128 self._errorString = self.tr("File '{0}' does not exist.").format( |
131 self._errorString = self.tr("File '{0}' does not exist.").format( |
129 self.__fileName |
132 self.__fileName |
133 |
136 |
134 def importedBookmarks(self): |
137 def importedBookmarks(self): |
135 """ |
138 """ |
136 Public method to get the imported bookmarks. |
139 Public method to get the imported bookmarks. |
137 |
140 |
138 @return imported bookmarks (BookmarkNode) |
141 @return imported bookmarks |
|
142 @rtype BookmarkNode |
139 """ |
143 """ |
140 from ..BookmarkNode import BookmarkNode |
144 from ..BookmarkNode import BookmarkNode |
141 from ..XbelReader import XbelReader |
145 from ..XbelReader import XbelReader |
142 |
146 |
143 reader = XbelReader() |
147 reader = XbelReader() |