1 /*  SPDX-License-Identifier: LGPL-2.0-or-later
2 
3     SPDX-FileCopyrightText: 2007, 2009 Joseph Wenninger <jowenn@kde.org>
4     SPDX-FileCopyrightText: 2021 Waqar Ahmed <waqar.17a@gmail.com>
5 
6     SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KATE_QUICK_OPEN_H
10 #define KATE_QUICK_OPEN_H
11 
12 #include <QMenu>
13 
14 #include "katequickopenlineedit.h"
15 
16 class KateMainWindow;
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 class QuickOpenFilterProxyModel;
27 
28 class KateQuickOpen : public QMenu
29 {
30     Q_OBJECT
31 public:
32     KateQuickOpen(KateMainWindow *mainWindow);
33 
34     /**
35      * update state
36      * will fill model with current open documents, project documents, ...
37      */
38     void updateState();
39     void updateViewGeometry();
40 
41 protected:
42     bool eventFilter(QObject *obj, QEvent *event) override;
43 
44 private Q_SLOTS:
45     void reselectFirst();
46 
47     /**
48      * Return pressed, activate the selected document
49      * and go back to background
50      */
51     void slotReturnPressed();
52 
53     void slotListModeChanged(KateQuickOpenModelList mode);
54 
55 private:
56     KateMainWindow *m_mainWindow;
57     QTreeView *m_listView;
58     QuickOpenLineEdit *m_inputLine;
59     QuickOpenStyleDelegate *m_styleDelegate;
60 
61     /**
62      * our model we search in
63      */
64     KateQuickOpenModel *m_base_model;
65 
66     /**
67      * filtered model we search in
68      */
69     QuickOpenFilterProxyModel *m_model;
70 };
71 
72 #endif
73