summaryrefslogtreecommitdiffstats
path: root/kate/app/kategrepdialog.h
blob: 23ba005405661c55b26b4d4168dd17c31a5d2d3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* This file is part of the KDE project
   Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
   Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
   Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef _GREPDIALOG_H_
#define _GREPDIALOG_H_

#include <kdialog.h>
#include <tqstringlist.h>

class QLineEdit;
class KComboBox;
class QCheckBox;
class QListBox;
class KPushButton;
class QLabel;
class KProcess;
class KConfig;
class KURLRequester;
class QEvent;

class GrepTool : public QWidget
{
    Q_OBJECT

public:
    GrepTool(TQWidget *parent, const char *name=0);
    ~GrepTool();

    // only updates if the dir you give to it differs from the last one given to it !
    void updateDirName(const TQString &);

    void setDirName(const TQString &);


signals:
    void itemSelected(const TQString &abs_filename, int line);

public slots:
    void slotSearchFor(const TQString &pattern);

protected:
    bool eventFilter( TQObject *, TQEvent * );
    void focusInEvent ( TQFocusEvent * ); 
    void showEvent( TQShowEvent * );
    bool m_fixFocus;

private slots:
    void templateActivated(int index);
    void childExited();
    void receivedOutput(KProcess *proc, char *buffer, int buflen);
    void receivedErrOutput(KProcess *proc, char *buffer, int buflen);
    void itemSelected(const TQString&);
    void slotSearch();
    void slotCancel();
    void slotClear();
    void patternTextChanged( const TQString &);
private:
    void processOutput();
    void finish();

    TQLineEdit *leTemplate;
    KComboBox *cmbFiles, *cmbPattern;
    KURLRequester *cmbDir;
    TQCheckBox *cbRecursive;
    TQCheckBox *cbCasesensitive, *cbRegex;
    TQListBox *lbResult;
    KPushButton *btnSearch, *btnClear;
    KProcess *childproc;
    TQString buf;
    TQString errbuf;
    KConfig* config;
    TQStringList lastSearchItems;
    TQStringList lastSearchPaths;
    TQStringList lastSearchFiles;
    TQString m_lastUpdatedDir;
    TQString m_workingDir;
};


#endif