katequickopen.h 1.99 KB
Newer Older
1
/*
Christoph Cullmann's avatar
Christoph Cullmann committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
   Copyright (C) 2007,2009 Joseph Wenninger <jowenn@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   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.
18 19 20 21 22
*/

#ifndef KATE_QUICK_OPEN_H
#define KATE_QUICK_OPEN_H

23
#include <QWidget>
24

25
class KateMainWindow;
Alex Turbov's avatar
Alex Turbov committed
26 27 28
class KLineEdit;

class QModelIndex;
29
class QStandardItemModel;
30
class QSortFilterProxyModel;
31
class QTreeView;
32
class KateQuickOpenModel;
33
enum KateQuickOpenModelList : int;
34

35 36
class KateQuickOpen : public QWidget
{
37
    Q_OBJECT
38 39 40 41 42 43 44
public:
    KateQuickOpen(QWidget *parent, KateMainWindow *mainWindow);
    /**
     * update state
     * will fill model with current open documents, project documents, ...
     */
    void update();
45

46 47
    int matchMode();
    void setMatchMode(int mode);
48

49 50
    KateQuickOpenModelList listMode() const;
    void setListMode(KateQuickOpenModelList mode);
51

52
protected:
Kevin Funk's avatar
Kevin Funk committed
53
    bool eventFilter(QObject *obj, QEvent *event) override;
54

55 56
private Q_SLOTS:
    void reselectFirst();
57

58 59 60 61 62
    /**
     * Return pressed, activate the selected document
     * and go back to background
     */
    void slotReturnPressed();
63

64 65 66 67
private:
    KateMainWindow *m_mainWindow;
    QTreeView *m_listView;
    KLineEdit *m_inputLine;
68

69 70 71
    /**
     * our model we search in
     */
72
    KateQuickOpenModel *m_base_model;
73

74 75 76 77
    /**
     * filtered model we search in
     */
    QSortFilterProxyModel *m_model;
78 79
};

80
#endif