| 405 | } |
| 406 | |
| 407 | void 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 | |
| 458 | KTextEditorIntegration::MainWindow *MainWindowPrivate::kateWrapper() const |
| 459 | { |
nothing calls this directly
no test coverage detected