Changeset View
Changeset View
Standalone View
Standalone View
addons/close-except-like/close_except_plugin.h
Show All 31 Lines | |||||
32 | # include <KTextEditor/Plugin> | 32 | # include <KTextEditor/Plugin> | ||
33 | # include <ktexteditor/sessionconfiginterface.h> | 33 | # include <ktexteditor/sessionconfiginterface.h> | ||
34 | # include <KActionMenu> | 34 | # include <KActionMenu> | ||
35 | # include <KTextEditor/Document> | 35 | # include <KTextEditor/Document> | ||
36 | # include <KTextEditor/View> | 36 | # include <KTextEditor/View> | ||
37 | # include <KTextEditor/Message> | 37 | # include <KTextEditor/Message> | ||
38 | # include <KToggleAction> | 38 | # include <KToggleAction> | ||
39 | # include <KConfigGroup> | 39 | # include <KConfigGroup> | ||
40 | # include <QtCore/QSignalMapper> | | |||
41 | # include <QPointer> | 40 | # include <QPointer> | ||
42 | # include <cassert> | 41 | # include <cassert> | ||
43 | # include <set> | 42 | # include <set> | ||
44 | 43 | | |||
45 | namespace kate { | 44 | namespace kate { | ||
46 | class CloseExceptPlugin; // forward declaration | 45 | class CloseExceptPlugin; // forward declaration | ||
47 | 46 | | |||
48 | /** | 47 | /** | ||
Show All 25 Lines | 63 | private Q_SLOTS: | |||
74 | { | 73 | { | ||
75 | close(item, true); | 74 | close(item, true); | ||
76 | } | 75 | } | ||
77 | 76 | | |||
78 | private: | 77 | private: | ||
79 | void displayMessage(const QString&, const QString&, KTextEditor::Message::MessageType); | 78 | void displayMessage(const QString&, const QString&, KTextEditor::Message::MessageType); | ||
80 | void connectToDocument(KTextEditor::Document*); | 79 | void connectToDocument(KTextEditor::Document*); | ||
81 | void updateMenu(); | 80 | void updateMenu(); | ||
82 | QPointer<QSignalMapper> updateMenu( | 81 | using CloseFunction = void (CloseExceptPluginView::*)(const QString &); | ||
anthonyfieroni: Make it lambda too. | |||||
volkov: Why? | |||||
The parameter of appendActionsFrom() still needs a type. It doesn't seem better if the type will be a type for lambda. volkov: The parameter of appendActionsFrom() still needs a type. It doesn't seem better if the type… | |||||
std::function<void(const QString &)> it's a type, function that returns noting and get 1 parameter. anthonyfieroni: std::function<void(const QString &)> it's a type, function that returns noting and get 1… | |||||
volkov: Why is it better than CloseFunction type? | |||||
82 | void updateMenu( | ||||
83 | const std::set<QUrl>& | 83 | const std::set<QUrl>& | ||
84 | , const std::set<QString>& | 84 | , const std::set<QString>& | ||
85 | , actions_map_type& | 85 | , actions_map_type& | ||
86 | , KActionMenu* | 86 | , KActionMenu* | ||
87 | , CloseFunction | ||||
87 | ); | 88 | ); | ||
88 | void appendActionsFrom( | 89 | void appendActionsFrom( | ||
89 | const std::set<QUrl>& | 90 | const std::set<QUrl>& | ||
90 | , actions_map_type& | 91 | , actions_map_type& | ||
91 | , KActionMenu* | 92 | , KActionMenu* | ||
92 | , QSignalMapper* | 93 | , CloseFunction | ||
93 | ); | 94 | ); | ||
94 | void appendActionsFrom( | 95 | void appendActionsFrom( | ||
95 | const std::set<QString>& masks | 96 | const std::set<QString>& masks | ||
96 | , actions_map_type& actions | 97 | , actions_map_type& actions | ||
97 | , KActionMenu* menu | 98 | , KActionMenu* menu | ||
98 | , QSignalMapper* mapper | 99 | , CloseFunction | ||
99 | ); | 100 | ); | ||
100 | 101 | | |||
101 | CloseExceptPlugin* m_plugin; | 102 | CloseExceptPlugin* m_plugin; | ||
102 | QPointer<KToggleAction> m_show_confirmation_action; | 103 | QPointer<KToggleAction> m_show_confirmation_action; | ||
103 | QPointer<KActionMenu> m_except_menu; | 104 | QPointer<KActionMenu> m_except_menu; | ||
104 | QPointer<KActionMenu> m_like_menu; | 105 | QPointer<KActionMenu> m_like_menu; | ||
105 | QPointer<QSignalMapper> m_except_mapper; | | |||
106 | QPointer<QSignalMapper> m_like_mapper; | | |||
107 | actions_map_type m_except_actions; | 106 | actions_map_type m_except_actions; | ||
108 | actions_map_type m_like_actions; | 107 | actions_map_type m_like_actions; | ||
109 | KTextEditor::MainWindow *m_mainWindow; | 108 | KTextEditor::MainWindow *m_mainWindow; | ||
110 | QPointer<KTextEditor::Message> m_infoMessage; | 109 | QPointer<KTextEditor::Message> m_infoMessage; | ||
111 | }; | 110 | }; | ||
112 | 111 | | |||
113 | /** | 112 | /** | ||
114 | * \brief Plugin view class | 113 | * \brief Plugin view class | ||
Show All 34 Lines |
Make it lambda too.