16 from .BookmarksImporter import BookmarksImporter |
16 from .BookmarksImporter import BookmarksImporter |
17 |
17 |
18 import UI.PixmapCache |
18 import UI.PixmapCache |
19 |
19 |
20 |
20 |
21 def getImporterInfo(id): |
21 def getImporterInfo(sourceId): |
22 """ |
22 """ |
23 Module function to get information for the given HTML source id. |
23 Module function to get information for the given HTML source id. |
24 |
24 |
25 @param id id of the browser ("chrome" or "chromium") |
25 @param sourceId id of the browser ("chrome" or "chromium") |
26 @return tuple with an icon (QPixmap), readable name (string), name of |
26 @return tuple with an icon (QPixmap), readable name (string), name of |
27 the default bookmarks file (string), an info text (string), |
27 the default bookmarks file (string), an info text (string), |
28 a prompt (string) and the default directory of the bookmarks file |
28 a prompt (string) and the default directory of the bookmarks file |
29 (string) |
29 (string) |
30 @exception ValueError raised to indicate an invalid browser ID |
30 @exception ValueError raised to indicate an invalid browser ID |
31 """ |
31 """ |
32 if id == "html": |
32 if sourceId == "html": |
33 return ( |
33 return ( |
34 UI.PixmapCache.getPixmap("html.png"), |
34 UI.PixmapCache.getPixmap("html.png"), |
35 "HTML Netscape Bookmarks", |
35 "HTML Netscape Bookmarks", |
36 QCoreApplication.translate( |
36 QCoreApplication.translate( |
37 "HtmlImporter", |
37 "HtmlImporter", |
45 "HtmlImporter", |
45 "HtmlImporter", |
46 """Please choose the file to begin importing bookmarks."""), |
46 """Please choose the file to begin importing bookmarks."""), |
47 "", |
47 "", |
48 ) |
48 ) |
49 else: |
49 else: |
50 raise ValueError("Unsupported browser ID given ({0}).".format(id)) |
50 raise ValueError( |
|
51 "Unsupported browser ID given ({0}).".format(sourceId)) |
51 |
52 |
52 |
53 |
53 class HtmlImporter(BookmarksImporter): |
54 class HtmlImporter(BookmarksImporter): |
54 """ |
55 """ |
55 Class implementing the HTML bookmarks importer. |
56 Class implementing the HTML bookmarks importer. |
56 """ |
57 """ |
57 def __init__(self, id="", parent=None): |
58 def __init__(self, sourceId="", parent=None): |
58 """ |
59 """ |
59 Constructor |
60 Constructor |
60 |
61 |
61 @param id source ID (string) |
62 @param sourceId source ID (string) |
62 @param parent reference to the parent object (QObject) |
63 @param parent reference to the parent object (QObject) |
63 """ |
64 """ |
64 super(HtmlImporter, self).__init__(id, parent) |
65 super(HtmlImporter, self).__init__(sourceId, parent) |
65 |
66 |
66 self.__fileName = "" |
67 self.__fileName = "" |
67 self.__inFile = None |
68 self.__inFile = None |
68 |
69 |
69 def setPath(self, path): |
70 def setPath(self, path): |