909 """ |
909 """ |
910 menu = QMenu(self) |
910 menu = QMenu(self) |
911 |
911 |
912 menu.addAction(self.tr("Open"), self.__openFile) |
912 menu.addAction(self.tr("Open"), self.__openFile) |
913 menu.addAction(self.tr("Copy Path to Clipboard"), self.__copyToClipboard) |
913 menu.addAction(self.tr("Copy Path to Clipboard"), self.__copyToClipboard) |
|
914 if self.__replaceMode: |
|
915 menu.addSeparator() |
|
916 menu.addAction(self.tr("Select All"), self.__selectAll) |
|
917 menu.addAction(self.tr("Deselect All"), self.__deselectAll) |
914 |
918 |
915 menu.exec(QCursor.pos()) |
919 menu.exec(QCursor.pos()) |
916 |
920 |
917 @pyqtSlot() |
921 @pyqtSlot() |
918 def __openFile(self): |
922 def __openFile(self): |
930 itm = self.findList.selectedItems()[0] |
934 itm = self.findList.selectedItems()[0] |
931 fn = itm.parent().text(0) if itm.parent() else itm.text(0) |
935 fn = itm.parent().text(0) if itm.parent() else itm.text(0) |
932 |
936 |
933 cb = QApplication.clipboard() |
937 cb = QApplication.clipboard() |
934 cb.setText(fn) |
938 cb.setText(fn) |
|
939 |
|
940 @pyqtSlot() |
|
941 def __deselectAll(self): |
|
942 """ |
|
943 Private slot to deselect all entries. |
|
944 """ |
|
945 self.__selectAll(check=False) |
|
946 |
|
947 @pyqtSlot() |
|
948 def __selectAll(self, check=True): |
|
949 """ |
|
950 Private slot to select all entries. |
|
951 """ |
|
952 if self.__replaceMode: |
|
953 for index in range(self.findList.topLevelItemCount()): |
|
954 itm = self.findList.topLevelItem(index) |
|
955 itm.setCheckState( |
|
956 0, |
|
957 Qt.CheckState.Checked if check else Qt.CheckState.Unchecked, |
|
958 ) |
935 |
959 |
936 |
960 |
937 class FindFileDialog(QDialog): |
961 class FindFileDialog(QDialog): |
938 """ |
962 """ |
939 Class implementing a dialog to search for text in files and replace it |
963 Class implementing a dialog to search for text in files and replace it |