diff -r 4cc6c171ecf6 -r da9e08920e7c Helpviewer/Bookmarks/BookmarksToolBar.py --- a/Helpviewer/Bookmarks/BookmarksToolBar.py Tue Feb 06 19:18:24 2018 +0100 +++ b/Helpviewer/Bookmarks/BookmarksToolBar.py Tue Feb 06 19:18:43 2018 +0100 @@ -87,23 +87,24 @@ v = act.data() if act.menu() is None: - menuAction = menu.addAction( - self.tr("&Open"), self.__openBookmark) - menuAction.setData(v) - menuAction = menu.addAction( - self.tr("Open in New &Tab\tCtrl+LMB"), - self.__openBookmarkInNewTab) - menuAction.setData(v) + act2 = menu.addAction(self.tr("Open")) + act2.setData(v) + act2.triggered.connect( + lambda: self.__openBookmark(act2)) + act2 = menu.addAction(self.tr("Open in New Tab\tCtrl+LMB")) + act2.setData(v) + act2.triggered.connect( + lambda: self.__openBookmarkInNewTab(act2)) menu.addSeparator() - menuAction = menu.addAction( - self.tr("&Remove"), self.__removeBookmark) - menuAction.setData(v) + act2 = menu.addAction(self.tr("Remove")) + act2.setData(v) + act2.triggered.connect(lambda: self.__removeBookmark(act2)) menu.addSeparator() - menuAction = menu.addAction( - self.tr("&Properties..."), self.__edit) - menuAction.setData(v) + act2 = menu.addAction(self.tr("Properties...")) + act2.setData(v) + act2.triggered.connect(lambda: self.__edit(act2)) menu.addSeparator() menu.addAction(self.tr("Add &Bookmark..."), self.__newBookmark) @@ -133,47 +134,40 @@ idx.data(BookmarksModel.UrlRole), idx.data(Qt.DisplayRole)) - def __openToolBarBookmark(self): + def __openBookmark(self, act): """ Private slot to open a bookmark in the current browser tab. + + @param act reference to the triggering action + @type QAction """ - idx = self.index(self.sender()) - - if self._keyboardModifiers & Qt.ControlModifier: - self.newUrl.emit( - idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) - else: - self.openUrl.emit( - idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) - self.resetFlags() - - def __openBookmark(self): - """ - Private slot to open a bookmark in the current browser tab. - """ - idx = self.index(self.sender()) + idx = self.index(act) self.openUrl.emit( idx.data(BookmarksModel.UrlRole), idx.data(Qt.DisplayRole)) - def __openBookmarkInNewTab(self): + def __openBookmarkInNewTab(self, act): """ Private slot to open a bookmark in a new browser tab. + + @param act reference to the triggering action + @type QAction """ - idx = self.index(self.sender()) + idx = self.index(act) self.newUrl.emit( idx.data(BookmarksModel.UrlRole), idx.data(Qt.DisplayRole)) - def __removeBookmark(self): + def __removeBookmark(self, act): """ Private slot to remove a bookmark. + + @param act reference to the triggering action + @type QAction """ - idx = self.index(self.sender()) + idx = self.index(act) self.__bookmarksModel.removeRow(idx.row(), self.rootIndex()) @@ -208,12 +202,15 @@ menu.newUrl.connect(self.newUrl) return menu - def __edit(self): + def __edit(self, act): """ Private slot to edit a bookmarks properties. + + @param act reference to the triggering action + @type QAction """ from .BookmarkPropertiesDialog import BookmarkPropertiesDialog - idx = self.index(self.sender()) + idx = self.index(act) node = self.__bookmarksModel.node(idx) dlg = BookmarkPropertiesDialog(node) dlg.exec_()