127 |
127 |
128 bookmarkFile = self.getFileName() |
128 bookmarkFile = self.getFileName() |
129 if not QFile.exists(bookmarkFile): |
129 if not QFile.exists(bookmarkFile): |
130 bookmarkFile = QFile(os.path.join( |
130 bookmarkFile = QFile(os.path.join( |
131 os.path.dirname(__file__), "DefaultBookmarks.xbel")) |
131 os.path.dirname(__file__), "DefaultBookmarks.xbel")) |
132 bookmarkFile.open(QIODevice.ReadOnly) |
132 bookmarkFile.open(QIODevice.OpenModeFlag.ReadOnly) |
133 |
133 |
134 from .XbelReader import XbelReader |
134 from .XbelReader import XbelReader |
135 reader = XbelReader() |
135 reader = XbelReader() |
136 self.__bookmarkRootNode = reader.read(bookmarkFile) |
136 self.__bookmarkRootNode = reader.read(bookmarkFile) |
137 if reader.error() != QXmlStreamReader.NoError: |
137 if reader.error() != QXmlStreamReader.Error.NoError: |
138 E5MessageBox.warning( |
138 E5MessageBox.warning( |
139 None, |
139 None, |
140 self.tr("Loading Bookmarks"), |
140 self.tr("Loading Bookmarks"), |
141 self.tr( |
141 self.tr( |
142 """Error when loading bookmarks on line {0},""" |
142 """Error when loading bookmarks on line {0},""" |
378 """ |
378 """ |
379 Public method to import bookmarks. |
379 Public method to import bookmarks. |
380 """ |
380 """ |
381 from .BookmarksImportDialog import BookmarksImportDialog |
381 from .BookmarksImportDialog import BookmarksImportDialog |
382 dlg = BookmarksImportDialog() |
382 dlg = BookmarksImportDialog() |
383 if dlg.exec() == QDialog.Accepted: |
383 if dlg.exec() == QDialog.DialogCode.Accepted: |
384 importRootNode = dlg.getImportedBookmarks() |
384 importRootNode = dlg.getImportedBookmarks() |
385 if importRootNode is not None: |
385 if importRootNode is not None: |
386 self.addBookmark(self.menu(), importRootNode) |
386 self.addBookmark(self.menu(), importRootNode) |
387 |
387 |
388 def exportBookmarks(self): |
388 def exportBookmarks(self): |