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/shell/settings/uiconfig.kcfg b/shell/settings/uiconfig.kcfg
--- a/shell/settings/uiconfig.kcfg
+++ b/shell/settings/uiconfig.kcfg
@@ -21,5 +21,11 @@
true
+
+ false
+
+
+ true
+
diff --git a/shell/settings/uiconfig.ui b/shell/settings/uiconfig.ui
--- a/shell/settings/uiconfig.ui
+++ b/shell/settings/uiconfig.ui
@@ -6,15 +6,24 @@
0
0
- 521
- 399
+ 503
+ 481
User Interface
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -92,7 +101,7 @@
- -
+
-
Qt::Vertical
@@ -173,6 +182,32 @@
+ -
+
+
+ 'Focus Editor' command behavior
+
+
+
-
+
+
+ Also hide unlocked docks
+
+
+
+ -
+
+
+ false
+
+
+ Hide docks only if editor is already focused
+
+
+
+
+
+
@@ -184,12 +219,12 @@
setEnabled(bool)
- 260
- 133
+ 268
+ 193
- 260
- 158
+ 268
+ 225
@@ -200,12 +235,28 @@
setEnabled(bool)
- 260
- 133
+ 268
+ 193
+
+
+ 268
+ 257
+
+
+
+
+ kcfg_HideUnlockedDocksOnEditorFocus
+ toggled(bool)
+ kcfg_HideUnlockedDocksOnlyIfEditorHasFocus
+ setEnabled(bool)
+
+
+ 119
+ 405
- 260
- 183
+ 126
+ 434
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.h b/sublime/idealcontroller.h
--- a/sublime/idealcontroller.h
+++ b/sublime/idealcontroller.h
@@ -70,7 +70,7 @@
void showLeftDock(bool show);
void showRightDock(bool show);
void showBottomDock(bool show);
- void toggleDocksShown();
+ void toggleDocksShown(bool hideUnlocked = false);
IdealButtonBarWidget* barForDockArea(Qt::DockWidgetArea area) const;
QAction* actionForArea(Qt::DockWidgetArea area) const;
@@ -106,7 +106,7 @@
private:
void hideDocks(IdealButtonBarWidget *bar);
void showDock(Qt::DockWidgetArea area, bool show);
- void toggleDocksShown(IdealButtonBarWidget *bar, bool show);
+ void toggleDocksShown(IdealButtonBarWidget *bar, bool anyBarShown, bool hideUnlocked);
Sublime::MainWindow *m_mainWindow;
diff --git a/sublime/idealcontroller.cpp b/sublime/idealcontroller.cpp
--- a/sublime/idealcontroller.cpp
+++ b/sublime/idealcontroller.cpp
@@ -450,30 +450,30 @@
bar->actions().at(index)->setChecked(true);
}
-void IdealController::toggleDocksShown()
+void IdealController::toggleDocksShown(bool hideUnlocked)
{
- bool anyBarShown = leftBarWidget->isShown() || bottomBarWidget->isShown() || rightBarWidget->isShown();
-
- if (anyBarShown) {
- leftBarWidget->saveShowState();
- bottomBarWidget->saveShowState();
- rightBarWidget->saveShowState();
- }
-
- toggleDocksShown(leftBarWidget, !anyBarShown && leftBarWidget->lastShowState());
- toggleDocksShown(bottomBarWidget, !anyBarShown && bottomBarWidget->lastShowState());
- toggleDocksShown(rightBarWidget, !anyBarShown && rightBarWidget->lastShowState());
+ bool anyBarShown =
+ (leftBarWidget->isShown() && !leftBarWidget->isLocked()) ||
+ (bottomBarWidget->isShown() && !bottomBarWidget->isLocked()) ||
+ (rightBarWidget->isShown() && !rightBarWidget->isLocked());
+
+ toggleDocksShown(leftBarWidget, anyBarShown, hideUnlocked);
+ toggleDocksShown(bottomBarWidget, anyBarShown, hideUnlocked);
+ toggleDocksShown(rightBarWidget, anyBarShown, hideUnlocked);
}
-void IdealController::toggleDocksShown(IdealButtonBarWidget* bar, bool show)
+void IdealController::toggleDocksShown(IdealButtonBarWidget* bar, bool anyBarShown, bool hideUnlocked)
{
- if (!show) {
+ if (bar->isLocked())
+ return;
+
+ if (anyBarShown)
+ bar->saveShowState();
+
+ if (hideUnlocked || anyBarShown || !bar->lastShowState())
hideDocks(bar);
- } else {
- IdealDockWidget *lastDock = lastDockWidget[bar->area()].data();
- if (lastDock)
- m_dockwidget_to_action[lastDock]->setChecked(true);
- }
+ else if (IdealDockWidget* lastDock = lastDockWidget[bar->area()].data())
+ m_dockwidget_to_action[lastDock]->setChecked(true);
}
void IdealController::loadSettings()
diff --git a/sublime/mainwindow_p.h b/sublime/mainwindow_p.h
--- a/sublime/mainwindow_p.h
+++ b/sublime/mainwindow_p.h
@@ -140,6 +140,7 @@
private:
void restoreConcentrationMode();
+ void hideUnlockedDocks();
void setBackgroundVisible(bool v);
Qt::DockWidgetArea positionToDockArea(Position position);
diff --git a/sublime/mainwindow_p.cpp b/sublime/mainwindow_p.cpp
--- a/sublime/mainwindow_p.cpp
+++ b/sublime/mainwindow_p.cpp
@@ -277,9 +277,16 @@
void MainWindowPrivate::focusEditor()
{
- if (View* view = m_mainWindow->activeView())
- if (view->hasWidget())
- view->widget()->setFocus(Qt::ShortcutFocusReason);
+ KConfigGroup config = KSharedConfig::openConfig()->group("UiSettings");
+ bool hideDocks = config.readEntry(QStringLiteral("HideUnlockedDocksOnEditorFocus"), false);
+ bool hideOnlyWhenFocused = config.readEntry(QStringLiteral("HideUnlockedDocksOnlyIfEditorHasFocus"), true);
+
+ View* view = m_mainWindow->activeView();
+ if (hideDocks && (!view || !view->hasWidget() || view->widget()->hasFocus() || !hideOnlyWhenFocused))
+ idealController->toggleDocksShown(true);
+
+ if (view && view->hasWidget())
+ view->widget()->setFocus(Qt::ShortcutFocusReason);
}
void MainWindowPrivate::toggleDocksShown()