MCPcopy Create free account
hub / github.com/KDE/kdevelop / setupActions

Method setupActions

plugins/scratchpad/scratchpadview.cpp:136–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void ScratchpadView::setupActions()
137{
138 auto* action = new QAction(QIcon::fromTheme(QStringLiteral("list-add")), i18nc("@action", "New Scratch"), this);
139 connect(action, &QAction::triggered, this, &ScratchpadView::createScratch);
140 addAction(action);
141
142 action = new QAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@action", "Remove Scratch"), this);
143 connect(action, &QAction::triggered, this, [this] {
144 const QPointer thisGuard(this);
145 m_scratchpad->removeScratch(proxyModel()->mapToSource(currentIndex()));
146 if (thisGuard) {
147 validateItemActions();
148 } // else: already destroyed (KDevelop is probably exiting now)
149 });
150 addAction(action);
151 m_itemActions.push_back(action);
152
153 action = new QAction(QIcon::fromTheme(QStringLiteral("edit-rename")), i18nc("@action", "Rename Scratch"), this);
154 connect(action, &QAction::triggered, this, [this] {
155 scratchView->edit(scratchView->currentIndex());
156 });
157 addAction(action);
158 m_itemActions.push_back(action);
159
160 action = m_scratchpad->runAction();
161 action->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
162 action->setText(i18nc("@action", "Run Scratch"));
163 connect(action, &QAction::triggered, this, &ScratchpadView::runSelectedScratch);
164 addAction(action);
165 m_itemActions.push_back(action);
166
167 m_filter = new QLineEdit(this);
168 m_filter->setPlaceholderText(i18nc("@info:placeholder", "Filter..."));
169 auto filterAction = new QWidgetAction(this);
170 filterAction->setDefaultWidget(m_filter);
171 addAction(filterAction);
172}
173
174void ScratchpadView::validateItemActions()
175{

Callers

nothing calls this directly

Calls 9

removeScratchMethod · 0.80
runActionMethod · 0.80
setIconMethod · 0.80
setPlaceholderTextMethod · 0.80
mapToSourceMethod · 0.45
push_backMethod · 0.45
editMethod · 0.45
currentIndexMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected