18 |
18 |
19 import UI.PixmapCache |
19 import UI.PixmapCache |
20 import Globals |
20 import Globals |
21 |
21 |
22 |
22 |
23 def getImporterInfo(id): |
23 def getImporterInfo(sourceId): |
24 """ |
24 """ |
25 Module function to get information for the given source id. |
25 Module function to get information for the given source id. |
26 |
26 |
27 @param id id of the browser ("chrome" or "chromium") |
27 @param sourceId id of the browser ("chrome" or "chromium") |
28 @return tuple with an icon (QPixmap), readable name (string), name of |
28 @return tuple with an icon (QPixmap), readable name (string), name of |
29 the default bookmarks file (string), an info text (string), |
29 the default bookmarks file (string), an info text (string), |
30 a prompt (string) and the default directory of the bookmarks file |
30 a prompt (string) and the default directory of the bookmarks file |
31 (string) |
31 (string) |
32 @exception ValueError raised to indicate an invalid browser ID |
32 @exception ValueError raised to indicate an invalid browser ID |
33 """ |
33 """ |
34 if id == "firefox": |
34 if sourceId == "firefox": |
35 if Globals.isWindowsPlatform(): |
35 if Globals.isWindowsPlatform(): |
36 standardDir = os.path.expandvars( |
36 standardDir = os.path.expandvars( |
37 "%APPDATA%\\Mozilla\\Firefox\\Profiles") |
37 "%APPDATA%\\Mozilla\\Firefox\\Profiles") |
38 elif Globals.isMacPlatform(): |
38 elif Globals.isMacPlatform(): |
39 standardDir = os.path.expanduser( |
39 standardDir = os.path.expanduser( |
53 "FirefoxImporter", |
53 "FirefoxImporter", |
54 """Please choose the file to begin importing bookmarks."""), |
54 """Please choose the file to begin importing bookmarks."""), |
55 standardDir, |
55 standardDir, |
56 ) |
56 ) |
57 else: |
57 else: |
58 raise ValueError("Unsupported browser ID given ({0}).".format(id)) |
58 raise ValueError( |
|
59 "Unsupported browser ID given ({0}).".format(sourceId)) |
59 |
60 |
60 |
61 |
61 class FirefoxImporter(BookmarksImporter): |
62 class FirefoxImporter(BookmarksImporter): |
62 """ |
63 """ |
63 Class implementing the Chrome bookmarks importer. |
64 Class implementing the Chrome bookmarks importer. |
64 """ |
65 """ |
65 def __init__(self, id="", parent=None): |
66 def __init__(self, sourceId="", parent=None): |
66 """ |
67 """ |
67 Constructor |
68 Constructor |
68 |
69 |
69 @param id source ID (string) |
70 @param sourceId source ID (string) |
70 @param parent reference to the parent object (QObject) |
71 @param parent reference to the parent object (QObject) |
71 """ |
72 """ |
72 super(FirefoxImporter, self).__init__(id, parent) |
73 super(FirefoxImporter, self).__init__(sourceId, parent) |
73 |
74 |
74 self.__fileName = "" |
75 self.__fileName = "" |
75 self.__db = None |
76 self.__db = None |
76 |
77 |
77 def setPath(self, path): |
78 def setPath(self, path): |