21 |
21 |
22 def getImporterInfo(id): |
22 def getImporterInfo(id): |
23 """ |
23 """ |
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 @return tuple with an icon (QPixmap), readable name (string), name of |
27 @return tuple with an icon (QPixmap), readable name (string), name of |
27 the default bookmarks file (string), an info text (string), |
28 the default bookmarks file (string), an info text (string), |
28 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) |
|
31 @exception ValueError raised to indicate an invalid browser ID |
29 """ |
32 """ |
30 if id == "opera": |
33 if id == "opera": |
31 if Globals.isWindowsPlatform(): |
34 if Globals.isWindowsPlatform(): |
32 standardDir = os.path.expandvars("%APPDATA%\\Opera\\Opera") |
35 standardDir = os.path.expandvars("%APPDATA%\\Opera\\Opera") |
33 elif Globals.isMacPlatform(): |
36 elif Globals.isMacPlatform(): |
96 f = open(self.__fileName, "r", encoding="utf-8") |
99 f = open(self.__fileName, "r", encoding="utf-8") |
97 contents = f.read() |
100 contents = f.read() |
98 f.close() |
101 f.close() |
99 except IOError as err: |
102 except IOError as err: |
100 self._error = True |
103 self._error = True |
101 self._errorString = self.trUtf8("File '{0}' cannot be read.\nReason: {1}")\ |
104 self._errorString = self.trUtf8( |
|
105 "File '{0}' cannot be read.\nReason: {1}")\ |
102 .format(self.__fileName, str(err)) |
106 .format(self.__fileName, str(err)) |
103 return None |
107 return None |
104 |
108 |
105 folderStack = [] |
109 folderStack = [] |
106 |
110 |