Changeset View
Changeset View
Standalone View
Standalone View
plugins/quickopen/quickopenwidget.h
Show All 22 Lines | |||||
23 | #ifndef KDEVPLATFORM_PLUGIN_QUICKOPENWIDGET_H | 23 | #ifndef KDEVPLATFORM_PLUGIN_QUICKOPENWIDGET_H | ||
24 | #define KDEVPLATFORM_PLUGIN_QUICKOPENWIDGET_H | 24 | #define KDEVPLATFORM_PLUGIN_QUICKOPENWIDGET_H | ||
25 | 25 | | |||
26 | #include "ui_quickopenwidget.h" | 26 | #include "ui_quickopenwidget.h" | ||
27 | 27 | | |||
28 | #include <QMenu> | 28 | #include <QMenu> | ||
29 | #include <QTime> | 29 | #include <QTime> | ||
30 | #include <QTimer> | 30 | #include <QTimer> | ||
31 | #include <QSortFilterProxyModel> | ||||
31 | 32 | | |||
32 | class QuickOpenModel; | 33 | class QuickOpenModel; | ||
33 | 34 | | |||
34 | class QLineEdit; | 35 | class QLineEdit; | ||
35 | 36 | | |||
36 | ///Will delete itself once the dialog is closed, so use QPointer when referencing it permanently | 37 | ///Will delete itself once the dialog is closed, so use QPointer when referencing it permanently | ||
37 | class QuickOpenWidget : public QMenu { | 38 | class QuickOpenWidget : public QMenu { | ||
38 | Q_OBJECT | 39 | Q_OBJECT | ||
39 | public: | 40 | public: | ||
40 | /** | 41 | /** | ||
41 | * @param initialItems List of items that should initially be enabled in the quickopen-list. If empty, all are enabled. | 42 | * @param initialItems List of items that should initially be enabled in the quickopen-list. If empty, all are enabled. | ||
42 | * @param initialScopes List of scopes that should initially be enabled in the quickopen-list. If empty, all are enabled. | 43 | * @param initialScopes List of scopes that should initially be enabled in the quickopen-list. If empty, all are enabled. | ||
43 | * @param listOnly when this is true, the given items will be listed, but all filtering using checkboxes is disabled. | 44 | * @param listOnly when this is true, the given items will be listed, but all filtering using checkboxes is disabled. | ||
44 | * @param noSearchFied when this is true, no search-line is shown. | 45 | * @param noSearchFied when this is true, no search-line is shown. | ||
45 | * */ | 46 | * */ | ||
46 | QuickOpenWidget( QString title, QuickOpenModel* model, const QStringList& initialItems, const QStringList& initialScopes, bool listOnly = false, bool noSearchField = false ); | 47 | QuickOpenWidget( QString title, QuickOpenModel* model, const QStringList& initialItems, const QStringList& initialScopes, bool listOnly = false, bool noSearchField = false ); | ||
47 | ~QuickOpenWidget() override; | 48 | ~QuickOpenWidget() override; | ||
48 | void setPreselectedText(const QString &text); | 49 | void setPreselectedText(const QString &text); | ||
49 | void prepareShow(); | 50 | void prepareShow(); | ||
50 | 51 | | |||
51 | void setAlternativeSearchField(QLineEdit* alterantiveSearchField); | 52 | void setAlternativeSearchField(QLineEdit* alterantiveSearchField); | ||
52 | 53 | | |||
54 | bool sortingEnabled() const; | ||||
55 | void setSortingEnabled(bool enabled); | ||||
56 | | ||||
53 | //Shows OK + Cancel. By default they are hidden | 57 | //Shows OK + Cancel. By default they are hidden | ||
54 | void showStandardButtons(bool show); | 58 | void showStandardButtons(bool show); | ||
55 | void showSearchField(bool show); | 59 | void showSearchField(bool show); | ||
56 | 60 | | |||
57 | signals: | 61 | signals: | ||
58 | void scopesChanged( const QStringList& scopes ); | 62 | void scopesChanged( const QStringList& scopes ); | ||
59 | void itemsChanged( const QStringList& scopes ); | 63 | void itemsChanged( const QStringList& scopes ); | ||
60 | void ready(); | 64 | void ready(); | ||
Show All 13 Lines | |||||
74 | private: | 78 | private: | ||
75 | void showEvent(QShowEvent *) override; | 79 | void showEvent(QShowEvent *) override; | ||
76 | 80 | | |||
77 | bool eventFilter ( QObject * watched, QEvent * event ) override; | 81 | bool eventFilter ( QObject * watched, QEvent * event ) override; | ||
78 | 82 | | |||
79 | void avoidMenuAltFocus(); | 83 | void avoidMenuAltFocus(); | ||
80 | 84 | | |||
81 | QuickOpenModel* m_model; | 85 | QuickOpenModel* m_model; | ||
86 | QAbstractProxyModel* m_proxy = nullptr; | ||||
87 | bool m_sortingEnabled = false; | ||||
82 | bool m_expandedTemporary, m_hadNoCommandSinceAlt; | 88 | bool m_expandedTemporary, m_hadNoCommandSinceAlt; | ||
83 | QTime m_altDownTime; | 89 | QTime m_altDownTime; | ||
84 | QString m_preselectedText; | 90 | QString m_preselectedText; | ||
85 | QTimer m_filterTimer; | 91 | QTimer m_filterTimer; | ||
86 | QString m_filter; | 92 | QString m_filter; | ||
87 | public: | 93 | public: | ||
88 | Ui::QuickOpenWidget ui; | 94 | Ui::QuickOpenWidget ui; | ||
89 | 95 | | |||
Show All 21 Lines |