Commits

Steve Borho committed 1cc18a9

fileview: add an integrated search bar, add its action to the toolbar

Comments (0)

Files changed (1)

tortoisehg/hgqt/fileview.py

         self._annotate.setAnnotationEnabled(True)
         self._stacked.addWidget(self._annotate)
 
+        self.searchbar = qscilib.SearchToolBar(hidable=True)
+        self.searchbar.hide()
+        self.searchbar.searchRequested.connect(self.find)
+        self.searchbar.conditionChanged.connect(self.highlightText)
+        self.layout().addWidget(self.searchbar)
+
         self._ctx = None
         self._filename = None
         self._status = None
 
         self.forceMode('diff')
 
+        self.actionFind = self.searchbar.toggleViewAction()
+        self.actionFind.setIcon(qtlib.geticon('edit-find'))
+        self.actionFind.setShortcut(QKeySequence.Find)
+
         tb = self.diffToolbar
         tb.addAction(self.actionDiffMode)
         tb.addAction(self.actionFileMode)
         tb.addSeparator()
         tb.addAction(self.actionNextDiff)
         tb.addAction(self.actionPrevDiff)
+        tb.addSeparator()
+        tb.addAction(self.actionFind)
 
         self.actionNextLine = QAction('Next line', self)
         self.actionNextLine.setShortcut(Qt.SHIFT + Qt.Key_Down)