diff --git a/shell/mainwindow_p.cpp b/shell/mainwindow_p.cpp --- a/shell/mainwindow_p.cpp +++ b/shell/mainwindow_p.cpp @@ -431,10 +431,27 @@ menu.addActions(actionMap.values()); } + QAction* lockAction = new QAction(this); + lockAction->setCheckable(true); + lockAction->setText(i18n("Lock the Panel from Hiding")); + + KConfigGroup config = KSharedConfig::openConfig()->group("UI"); + lockAction->setChecked(config.readEntry(QStringLiteral("Toolview Bar (%1) Is Locked").arg(area), false)); + + menu.addSeparator(); + menu.addAction(lockAction); + QAction* triggered = menu.exec(position); if ( !triggered ) { return; } + + if (triggered == lockAction) { + KConfigGroup config = KSharedConfig::openConfig()->group("UI"); + config.writeEntry(QStringLiteral("Toolview Bar (%1) Is Locked").arg(area), lockAction->isChecked()); + return; + } + Core::self()->uiControllerInternal()->addToolViewToDockArea( actionToFactory[triggered], area diff --git a/sublime/idealbuttonbarwidget.h b/sublime/idealbuttonbarwidget.h --- a/sublime/idealbuttonbarwidget.h +++ b/sublime/idealbuttonbarwidget.h @@ -73,6 +73,8 @@ void loadOrderSettings(const KConfigGroup& configGroup); void saveOrderSettings(KConfigGroup& configGroup); + bool isLocked(); + signals: void emptyChanged(); diff --git a/sublime/idealbuttonbarwidget.cpp b/sublime/idealbuttonbarwidget.cpp --- a/sublime/idealbuttonbarwidget.cpp +++ b/sublime/idealbuttonbarwidget.cpp @@ -269,6 +269,12 @@ configGroup.writeEntry(QStringLiteral("(%1) Tool Views Order").arg(_area), _buttonsOrder); } +bool IdealButtonBarWidget::isLocked() +{ + KConfigGroup config = KSharedConfig::openConfig()->group("UI"); + return config.readEntry(QStringLiteral("Toolview Bar (%1) Is Locked").arg(_area), false); +} + void IdealButtonBarWidget::applyOrderToLayout() { // If widget already have some buttons in the layout then calling loadOrderSettings() may leads diff --git a/sublime/idealcontroller.cpp b/sublime/idealcontroller.cpp --- a/sublime/idealcontroller.cpp +++ b/sublime/idealcontroller.cpp @@ -452,17 +452,25 @@ void IdealController::toggleDocksShown() { - bool anyBarShown = leftBarWidget->isShown() || bottomBarWidget->isShown() || rightBarWidget->isShown(); + bool anyBarShown = + (leftBarWidget->isShown() && !leftBarWidget->isLocked()) || + (bottomBarWidget->isShown() && !bottomBarWidget->isLocked()) || + (rightBarWidget->isShown() && !rightBarWidget->isLocked()); if (anyBarShown) { leftBarWidget->saveShowState(); bottomBarWidget->saveShowState(); rightBarWidget->saveShowState(); } - toggleDocksShown(leftBarWidget, !anyBarShown && leftBarWidget->lastShowState()); - toggleDocksShown(bottomBarWidget, !anyBarShown && bottomBarWidget->lastShowState()); - toggleDocksShown(rightBarWidget, !anyBarShown && rightBarWidget->lastShowState()); + if (!leftBarWidget->isLocked()) + toggleDocksShown(leftBarWidget, !anyBarShown && leftBarWidget->lastShowState()); + + if (!bottomBarWidget->isLocked()) + toggleDocksShown(bottomBarWidget, !anyBarShown && bottomBarWidget->lastShowState()); + + if (!rightBarWidget->isLocked()) + toggleDocksShown(rightBarWidget, !anyBarShown && rightBarWidget->lastShowState()); } void IdealController::toggleDocksShown(IdealButtonBarWidget* bar, bool show)