Helpviewer/History/HistoryDialog.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3002
6ffc581f00f1
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
40 self.setupUi(self) 40 self.setupUi(self)
41 41
42 self.__historyManager = manager 42 self.__historyManager = manager
43 if self.__historyManager is None: 43 if self.__historyManager is None:
44 import Helpviewer.HelpWindow 44 import Helpviewer.HelpWindow
45 self.__historyManager = Helpviewer.HelpWindow.HelpWindow.historyManager() 45 self.__historyManager = \
46 Helpviewer.HelpWindow.HelpWindow.historyManager()
46 47
47 self.__model = self.__historyManager.historyTreeModel() 48 self.__model = self.__historyManager.historyTreeModel()
48 self.__proxyModel = E5TreeSortFilterProxyModel(self) 49 self.__proxyModel = E5TreeSortFilterProxyModel(self)
49 self.__proxyModel.setSortRole(HistoryModel.DateTimeRole) 50 self.__proxyModel.setSortRole(HistoryModel.DateTimeRole)
50 self.__proxyModel.setFilterKeyColumn(-1) 51 self.__proxyModel.setFilterKeyColumn(-1)
59 60
60 self.historyTree.activated.connect(self.__activated) 61 self.historyTree.activated.connect(self.__activated)
61 self.historyTree.customContextMenuRequested.connect( 62 self.historyTree.customContextMenuRequested.connect(
62 self.__customContextMenuRequested) 63 self.__customContextMenuRequested)
63 64
64 self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) 65 self.searchEdit.textChanged.connect(
66 self.__proxyModel.setFilterFixedString)
65 self.removeButton.clicked[()].connect(self.historyTree.removeSelected) 67 self.removeButton.clicked[()].connect(self.historyTree.removeSelected)
66 self.removeAllButton.clicked[()].connect(self.__historyManager.clear) 68 self.removeAllButton.clicked[()].connect(self.__historyManager.clear)
67 69
68 self.__proxyModel.modelReset.connect(self.__modelReset) 70 self.__proxyModel.modelReset.connect(self.__modelReset)
69 71
81 """ 83 """
82 menu = QMenu() 84 menu = QMenu()
83 idx = self.historyTree.indexAt(pos) 85 idx = self.historyTree.indexAt(pos)
84 idx = idx.sibling(idx.row(), 0) 86 idx = idx.sibling(idx.row(), 0)
85 if idx.isValid() and not self.historyTree.model().hasChildren(idx): 87 if idx.isValid() and not self.historyTree.model().hasChildren(idx):
86 menu.addAction(self.trUtf8("&Open"), self.__openHistoryInCurrentTab) 88 menu.addAction(
87 menu.addAction(self.trUtf8("Open in New &Tab"), self.__openHistoryInNewTab) 89 self.trUtf8("&Open"), self.__openHistoryInCurrentTab)
90 menu.addAction(
91 self.trUtf8("Open in New &Tab"), self.__openHistoryInNewTab)
88 menu.addSeparator() 92 menu.addSeparator()
89 menu.addAction(self.trUtf8("&Copy"), self.__copyHistory) 93 menu.addAction(self.trUtf8("&Copy"), self.__copyHistory)
90 menu.addAction(self.trUtf8("&Remove"), self.historyTree.removeSelected) 94 menu.addAction(self.trUtf8("&Remove"), self.historyTree.removeSelected)
91 menu.exec_(QCursor.pos()) 95 menu.exec_(QCursor.pos())
92 96
94 """ 98 """
95 Private slot to handle the activation of an entry. 99 Private slot to handle the activation of an entry.
96 100
97 @param idx reference to the entry index (QModelIndex) 101 @param idx reference to the entry index (QModelIndex)
98 """ 102 """
99 self.__openHistory(QApplication.keyboardModifiers() & Qt.ControlModifier) 103 self.__openHistory(
104 QApplication.keyboardModifiers() & Qt.ControlModifier)
100 105
101 def __openHistoryInCurrentTab(self): 106 def __openHistoryInCurrentTab(self):
102 """ 107 """
103 Private slot to open a history entry in the current browser tab. 108 Private slot to open a history entry in the current browser tab.
104 """ 109 """
112 117
113 def __openHistory(self, newTab): 118 def __openHistory(self, newTab):
114 """ 119 """
115 Private method to open a history entry. 120 Private method to open a history entry.
116 121
117 @param newTab flag indicating to open the history entry in a new tab (boolean) 122 @param newTab flag indicating to open the history entry in a new tab
123 (boolean)
118 """ 124 """
119 idx = self.historyTree.currentIndex() 125 idx = self.historyTree.currentIndex()
120 if newTab: 126 if newTab:
121 self.newUrl.emit( 127 self.newUrl.emit(
122 idx.data(HistoryModel.UrlRole), 128 idx.data(HistoryModel.UrlRole),

eric ide

mercurial