17 |
17 |
18 import UI.PixmapCache |
18 import UI.PixmapCache |
19 import Globals |
19 import Globals |
20 |
20 |
21 |
21 |
22 def getImporterInfo(id): |
22 def getImporterInfo(sourceId): |
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 @param sourceId 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 |
29 a prompt (string) and the default directory of the bookmarks file |
30 (string) |
30 (string) |
31 @exception ValueError raised to indicate an invalid browser ID |
31 @exception ValueError raised to indicate an invalid browser ID |
32 """ |
32 """ |
33 if id == "ie": |
33 if sourceId == "ie": |
34 if Globals.isWindowsPlatform(): |
34 if Globals.isWindowsPlatform(): |
35 standardDir = os.path.expandvars( |
35 standardDir = os.path.expandvars( |
36 "%USERPROFILE%\\Favorites") |
36 "%USERPROFILE%\\Favorites") |
37 else: |
37 else: |
38 standardDir = "" |
38 standardDir = "" |
49 "IExplorerImporter", |
49 "IExplorerImporter", |
50 """Please choose the folder to begin importing bookmarks."""), |
50 """Please choose the folder to begin importing bookmarks."""), |
51 standardDir, |
51 standardDir, |
52 ) |
52 ) |
53 else: |
53 else: |
54 raise ValueError("Unsupported browser ID given ({0}).".format(id)) |
54 raise ValueError( |
|
55 "Unsupported browser ID given ({0}).".format(sourceId)) |
55 |
56 |
56 |
57 |
57 class IExplorerImporter(BookmarksImporter): |
58 class IExplorerImporter(BookmarksImporter): |
58 """ |
59 """ |
59 Class implementing the Chrome bookmarks importer. |
60 Class implementing the Chrome bookmarks importer. |
60 """ |
61 """ |
61 def __init__(self, id="", parent=None): |
62 def __init__(self, sourceId="", parent=None): |
62 """ |
63 """ |
63 Constructor |
64 Constructor |
64 |
65 |
65 @param id source ID (string) |
66 @param sourceId source ID (string) |
66 @param parent reference to the parent object (QObject) |
67 @param parent reference to the parent object (QObject) |
67 """ |
68 """ |
68 super(IExplorerImporter, self).__init__(id, parent) |
69 super(IExplorerImporter, self).__init__(sourceId, parent) |
69 |
70 |
70 self.__fileName = "" |
71 self.__fileName = "" |
71 |
72 |
72 def setPath(self, path): |
73 def setPath(self, path): |
73 """ |
74 """ |