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

Method contextMenuExtension

plugins/subversion/kdevsvnplugin.cpp:309–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307
308
309KDevelop::ContextMenuExtension KDevSvnPlugin::contextMenuExtension(KDevelop::Context* context, QWidget* parent)
310{
311 m_common->setupFromContext(context);
312
313 const QList<QUrl> & ctxUrlList = m_common->contextUrlList();
314
315 bool hasVersionControlledEntries = false;
316 for (const QUrl& url : ctxUrlList) {
317 if (isVersionControlled(url) || isVersionControlled(KIO::upUrl(url))) {
318 hasVersionControlledEntries = true;
319 break;
320 }
321 }
322
323 qCDebug(PLUGIN_SVN) << "version controlled?" << hasVersionControlledEntries;
324
325 if (!hasVersionControlledEntries)
326 return IPlugin::contextMenuExtension(context, parent);
327
328
329 QMenu* svnmenu = m_common->commonActions(parent);
330 svnmenu->addSeparator();
331
332 if( !copy_action )
333 {
334 copy_action = new QAction(i18nc("@action:inmenu", "Copy..."), this);
335 connect(copy_action, &QAction::triggered, this, &KDevSvnPlugin::ctxCopy);
336 }
337 svnmenu->addAction(copy_action);
338
339 if( !move_action )
340 {
341 move_action = new QAction(i18nc("@action:inmenu", "Move..."), this);
342 connect(move_action, &QAction::triggered, this, &KDevSvnPlugin::ctxMove);
343 }
344 svnmenu->addAction(move_action);
345
346 KDevelop::ContextMenuExtension menuExt;
347 menuExt.addAction(KDevelop::ContextMenuExtension::VcsGroup, svnmenu->menuAction());
348
349 return menuExt;
350}
351
352void KDevSvnPlugin::ctxCopy()
353{

Callers

nothing calls this directly

Calls 4

setupFromContextMethod · 0.80
contextUrlListMethod · 0.80
commonActionsMethod · 0.80
addActionMethod · 0.45

Tested by

no test coverage detected