katequickopen.h 1.47 KB
Newer Older
Christoph Cullmann's avatar
Christoph Cullmann committed
1
2
/*  SPDX-License-Identifier: LGPL-2.0-or-later

3
    SPDX-FileCopyrightText: 2007, 2009 Joseph Wenninger <jowenn@kde.org>
Waqar Ahmed's avatar
Waqar Ahmed committed
4
    SPDX-FileCopyrightText: 2021 Waqar Ahmed <waqar.17a@gmail.com>
Christoph Cullmann's avatar
Christoph Cullmann committed
5

6
    SPDX-License-Identifier: LGPL-2.0-or-later
7
8
9
10
11
*/

#ifndef KATE_QUICK_OPEN_H
#define KATE_QUICK_OPEN_H

12
#include <QMenu>
13

14
15
#include "katequickopenlineedit.h"

Christoph Cullmann's avatar
Christoph Cullmann committed
16
class KateMainWindow;
Alex Turbov's avatar
Alex Turbov committed
17
18

class QModelIndex;
19
class QStandardItemModel;
20
class QSortFilterProxyModel;
21
class QuickOpenStyleDelegate;
22
class QTreeView;
23
class KateQuickOpenModel;
24
enum KateQuickOpenModelList : int;
25

26
27
class QuickOpenFilterProxyModel;

28
class KateQuickOpen : public QMenu
29
{
30
    Q_OBJECT
31
public:
Waqar Ahmed's avatar
Waqar Ahmed committed
32
    KateQuickOpen(KateMainWindow *mainWindow);
Waqar Ahmed's avatar
Waqar Ahmed committed
33

34
35
36
37
    /**
     * update state
     * will fill model with current open documents, project documents, ...
     */
38
    void updateState();
39
    void updateViewGeometry();
40

41
protected:
Kevin Funk's avatar
Kevin Funk committed
42
    bool eventFilter(QObject *obj, QEvent *event) override;
43

44
45
private Q_SLOTS:
    void reselectFirst();
Christoph Cullmann's avatar
Christoph Cullmann committed
46

47
48
49
50
51
    /**
     * Return pressed, activate the selected document
     * and go back to background
     */
    void slotReturnPressed();
52

53
54
    void slotListModeChanged(KateQuickOpenModelList mode);

55
56
57
private:
    KateMainWindow *m_mainWindow;
    QTreeView *m_listView;
58
    QuickOpenLineEdit *m_inputLine;
Waqar Ahmed's avatar
Waqar Ahmed committed
59
    QuickOpenStyleDelegate *m_styleDelegate;
60

61
62
63
    /**
     * our model we search in
     */
64
    KateQuickOpenModel *m_base_model;
65

66
67
68
    /**
     * filtered model we search in
     */
69
    QuickOpenFilterProxyModel *m_model;
70
71
};

72
#endif