File indexing completed on 2024-04-28 17:06:14

0001 /*
0002     SPDX-FileCopyrightText: 2004 Csaba Karai <krusader@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef LOCATE_H
0009 #define LOCATE_H
0010 
0011 // QtGui
0012 #include <QKeyEvent>
0013 // QtWidgets
0014 #include <QCheckBox>
0015 #include <QDialog>
0016 
0017 #include <KCompletion/KComboBox>
0018 
0019 #include "../GUI/krhistorycombobox.h"
0020 
0021 class KProcess;
0022 class KrTreeWidget;
0023 class QTreeWidgetItem;
0024 
0025 class LocateDlg : public QDialog
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit LocateDlg(QWidget *parent);
0031     ~LocateDlg() override;
0032 
0033     static LocateDlg *LocateDialog;
0034 
0035     virtual void feedToListBox();
0036 
0037     void reset();
0038 
0039 public slots:
0040     void slotFeedStop();
0041     void slotUpdateDb();
0042     void slotLocate();
0043 
0044     void processStdout();
0045     void processStderr();
0046     void locateFinished();
0047     void locateError();
0048     void slotRightClick(QTreeWidgetItem *, const QPoint &);
0049     void slotDoubleClick(QTreeWidgetItem *);
0050     void updateFinished();
0051 
0052 protected:
0053     void keyPressEvent(QKeyEvent *) override;
0054 
0055 private:
0056     void operate(QTreeWidgetItem *item, int task);
0057 
0058     bool find();
0059     void nextLine();
0060 
0061     void updateButtons(bool locateIsRunning);
0062 
0063     bool dontSearchPath;
0064     bool onlyExist;
0065     bool isCs;
0066 
0067     bool isFeedToListBox;
0068 
0069     QString pattern;
0070 
0071     KrHistoryComboBox *locateSearchFor;
0072     KrTreeWidget *resultList;
0073     QString remaining;
0074     QTreeWidgetItem *lastItem;
0075 
0076     QString collectedErr;
0077 
0078     long findOptions;
0079     QString findPattern;
0080     QTreeWidgetItem *findCurrentItem;
0081 
0082     QCheckBox *dontSearchInPath;
0083     QCheckBox *existingFiles;
0084     QCheckBox *caseSensitive;
0085 
0086     QPushButton *feedStopButton;
0087     QPushButton *updateDbButton;
0088     QPushButton *locateButton;
0089 
0090     KProcess *locateProc;
0091     static KProcess *updateProcess;
0092 };
0093 
0094 #endif /* __LOCATE_H__ */