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

Method dockBarContextMenuRequested

kdevplatform/shell/mainwindow_p.cpp:407–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407void MainWindowPrivate::dockBarContextMenuRequested(Qt::DockWidgetArea area, const QPoint& position)
408{
409 QMenu menu(m_mainWindow);
410 menu.addSection(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Add Tool View"));
411 QHash<IToolViewFactory*, Sublime::ToolDocument*> factories =
412 Core::self()->uiControllerInternal()->factoryDocuments();
413 QHash<QAction*, IToolViewFactory*> actionToFactory;
414 if ( !factories.isEmpty() ) {
415 // sorted actions
416 QMap<QString, QAction*> actionMap;
417 for (QHash<IToolViewFactory*, Sublime::ToolDocument*>::const_iterator it = factories.constBegin();
418 it != factories.constEnd(); ++it)
419 {
420 auto* action = new QAction(it.value()->statusIcon(), it.value()->title(), &menu);
421 action->setIcon(it.value()->statusIcon());
422 if (Core::self()->uiControllerInternal()->toolViewPresent(it.value(), m_mainWindow->area())) {
423 action->setDisabled(true);
424 }
425 actionToFactory.insert(action, it.key());
426 actionMap[action->text()] = action;
427 }
428 menu.addActions(actionMap.values());
429 }
430
431 auto* const lockAction = new QAction(&menu);
432 lockAction->setCheckable(true);
433 lockAction->setText(i18nc("@action:inmenu", "Lock the Panel from Hiding"));
434
435 KConfigGroup config = KSharedConfig::openConfig()->group(QStringLiteral("UI"));
436 lockAction->setChecked(config.readEntry(QStringLiteral("Toolview Bar (%1) Is Locked").arg(area), false));
437
438 menu.addSeparator();
439 menu.addAction(lockAction);
440
441 QAction* triggered = menu.exec(position);
442 if ( !triggered ) {
443 return;
444 }
445
446 if (triggered == lockAction) {
447 KConfigGroup config = KSharedConfig::openConfig()->group(QStringLiteral("UI"));
448 config.writeEntry(QStringLiteral("Toolview Bar (%1) Is Locked").arg(area), lockAction->isChecked());
449 return;
450 }
451
452 Core::self()->uiControllerInternal()->addToolViewToDockArea(
453 actionToFactory[triggered],
454 area
455 );
456}
457
458KTextEditorIntegration::MainWindow *MainWindowPrivate::kateWrapper() const
459{

Callers

nothing calls this directly

Calls 15

uiControllerInternalMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
statusIconMethod · 0.80
setIconMethod · 0.80
toolViewPresentMethod · 0.80
readEntryMethod · 0.80
execMethod · 0.80
writeEntryMethod · 0.80
addToolViewToDockAreaMethod · 0.80
isEmptyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected