1396 """ |
1396 """ |
1397 Private slot called in order to show the history menu. |
1397 Private slot called in order to show the history menu. |
1398 """ |
1398 """ |
1399 self.historyMenu.clear() |
1399 self.historyMenu.clear() |
1400 self.historyMenu.addAction(self.clearHistoryAct) |
1400 self.historyMenu.addAction(self.clearHistoryAct) |
1401 self.clearHistoryAct.setData(QVariant(-1)) |
1401 self.clearHistoryAct.setData(-1) |
1402 self.historyMenu.addSeparator() |
1402 self.historyMenu.addSeparator() |
1403 idx = 0 |
1403 idx = 0 |
1404 for hist in self.mHistory: |
1404 for hist in self.mHistory: |
1405 act = self.historyMenu.addAction( |
1405 act = self.historyMenu.addAction( |
1406 Utilities.compactPath(hist, self.maxMenuFilePathLen)) |
1406 Utilities.compactPath(hist, self.maxMenuFilePathLen)) |
1407 act.setData(QVariant(idx)) |
1407 act.setData(idx) |
1408 idx += 1 |
1408 idx += 1 |
1409 act.setIcon(HelpWindow.__getWebIcon(QUrl(hist))) |
1409 act.setIcon(HelpWindow.__getWebIcon(QUrl(hist))) |
1410 |
1410 |
1411 def __pathEdited(self): |
1411 def __pathEdited(self): |
1412 """ |
1412 """ |
2575 """ |
2575 """ |
2576 self.__navigationMenu.clear() |
2576 self.__navigationMenu.clear() |
2577 for index in range(self.tabWidget.count()): |
2577 for index in range(self.tabWidget.count()): |
2578 act = self.__navigationMenu.addAction(self.tabWidget.tabIcon(index), |
2578 act = self.__navigationMenu.addAction(self.tabWidget.tabIcon(index), |
2579 self.tabWidget.tabText(index)) |
2579 self.tabWidget.tabText(index)) |
2580 act.setData(QVariant(index)) |
2580 act.setData(index) |
2581 |
2581 |
2582 def __navigationMenuTriggered(self, act): |
2582 def __navigationMenuTriggered(self, act): |
2583 """ |
2583 """ |
2584 Private slot called to handle the navigation button menu selection. |
2584 Private slot called to handle the navigation button menu selection. |
2585 |
2585 |
2586 @param act reference to the selected action (QAction) |
2586 @param act reference to the selected action (QAction) |
2587 """ |
2587 """ |
2588 index, ok = act.data().toInt() |
2588 index = act.data() |
2589 if ok: |
2589 if ok: |
2590 self.tabWidget.setCurrentIndex(index) |
2590 self.tabWidget.setCurrentIndex(index) |
2591 |
2591 |
2592 def __showBackMenu(self): |
2592 def __showBackMenu(self): |
2593 """ |
2593 """ |
2598 historyCount = history.count() |
2598 historyCount = history.count() |
2599 backItems = history.backItems(historyCount) |
2599 backItems = history.backItems(historyCount) |
2600 for index in range(len(backItems) - 1, -1, -1): |
2600 for index in range(len(backItems) - 1, -1, -1): |
2601 item = backItems[index] |
2601 item = backItems[index] |
2602 act = QAction(self) |
2602 act = QAction(self) |
2603 act.setData(QVariant(-1 * (index + 1))) |
2603 act.setData(-1 * (index + 1)) |
2604 icon = HelpWindow.__getWebIcon(item.url()) |
2604 icon = HelpWindow.__getWebIcon(item.url()) |
2605 act.setIcon(icon) |
2605 act.setIcon(icon) |
2606 act.setText(item.title()) |
2606 act.setText(item.title()) |
2607 self.backMenu.addAction(act) |
2607 self.backMenu.addAction(act) |
2608 |
2608 |
2615 historyCount = history.count() |
2615 historyCount = history.count() |
2616 forwardItems = history.forwardItems(historyCount) |
2616 forwardItems = history.forwardItems(historyCount) |
2617 for index in range(len(forwardItems)): |
2617 for index in range(len(forwardItems)): |
2618 item = forwardItems[index] |
2618 item = forwardItems[index] |
2619 act = QAction(self) |
2619 act = QAction(self) |
2620 act.setData(QVariant(index + 1)) |
2620 act.setData(index + 1) |
2621 icon = HelpWindow.__getWebIcon(item.url()) |
2621 icon = HelpWindow.__getWebIcon(item.url()) |
2622 act.setIcon(icon) |
2622 act.setIcon(icon) |
2623 act.setText(item.title()) |
2623 act.setText(item.title()) |
2624 self.forwardMenu.addAction(act) |
2624 self.forwardMenu.addAction(act) |
2625 |
2625 |
2627 """ |
2627 """ |
2628 Private slot to go to the selected page. |
2628 Private slot to go to the selected page. |
2629 |
2629 |
2630 @param act reference to the action selected in the navigation menu (QAction) |
2630 @param act reference to the action selected in the navigation menu (QAction) |
2631 """ |
2631 """ |
2632 offset = act.data().toInt()[0] |
2632 offset = act.data() |
2633 history = self.currentBrowser().history() |
2633 history = self.currentBrowser().history() |
2634 historyCount = history.count() |
2634 historyCount = history.count() |
2635 if offset < 0: |
2635 if offset < 0: |
2636 # go back |
2636 # go back |
2637 history.goToItem(history.backItems(historyCount)[-1 * offset - 1]) |
2637 history.goToItem(history.backItems(historyCount)[-1 * offset - 1]) |