File indexing completed on 2024-05-12 05:52:07

0001 /*
0002     SPDX-FileCopyrightText: 2007, 2009 Joseph Wenninger <jowenn@kde.org>
0003     SPDX-FileCopyrightText: 2021 Waqar Ahmed <waqar.17a@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "katequickopenlineedit.h"
0011 
0012 class KateMainWindow;
0013 
0014 class QModelIndex;
0015 class QStandardItemModel;
0016 class QSortFilterProxyModel;
0017 class QuickOpenStyleDelegate;
0018 class QTreeView;
0019 class KateQuickOpenModel;
0020 enum KateQuickOpenModelList : int;
0021 
0022 class QuickOpenFilterProxyModel;
0023 
0024 class KateQuickOpen : public QFrame
0025 {
0026     Q_OBJECT
0027 public:
0028     KateQuickOpen(KateMainWindow *mainWindow);
0029 
0030     /**
0031      * update state
0032      * will fill model with current open documents, project documents, ...
0033      */
0034     void updateState();
0035     void updateViewGeometry();
0036 
0037 protected:
0038     bool eventFilter(QObject *obj, QEvent *event) override;
0039 
0040 private Q_SLOTS:
0041     void reselectFirst();
0042 
0043     /**
0044      * Return pressed, activate the selected document
0045      * and go back to background
0046      */
0047     void slotReturnPressed();
0048 
0049     void slotListModeChanged(KateQuickOpenModelList mode);
0050 
0051     void setFilterMode();
0052 
0053 private:
0054     KateMainWindow *m_mainWindow;
0055     QTreeView *m_listView;
0056     QuickOpenLineEdit *m_inputLine;
0057     QuickOpenStyleDelegate *m_styleDelegate;
0058 
0059     /**
0060      * our model we search in
0061      */
0062     KateQuickOpenModel *m_model = nullptr;
0063 
0064     /**
0065      * fuzzy filter model
0066      */
0067     QuickOpenFilterProxyModel *m_proxyModel = nullptr;
0068 };