diff options
| author | Felix Ernst <[email protected]> | 2020-11-19 21:22:27 +0000 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2020-11-19 21:22:27 +0000 |
| commit | 50ca5af7e0ec460f9f004a3660efa10bb1dd8cb1 (patch) | |
| tree | f87dde47243cd134a1d106f06e7a2b650cb2edc9 /src/dolphinmainwindow.cpp | |
| parent | f2d2f325b628f8b831cce076c1a5f5dc43ac21ee (diff) | |
Allow having the UrlNavigators below the tab bar
This commit restores the possibility to have the UrlNavigators below
the tab bar. This will happen automatically whenever the UrlNavigator
is removed from the toolbar.
It is also now again possible to have the toolbar on the side. This
option is disabled while the toolbar contains the UrlNavigators.
This commit makes no changes to the new default which is having the
UrlNavigators in the toolbar but makes sure that upgrading users won't
be affected.
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 0c4c3c881..b72f2eb90 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -169,11 +169,6 @@ DolphinMainWindow::DolphinMainWindow() : setupGUI(Keys | Save | Create | ToolBar); stateChanged(QStringLiteral("new_file")); - toolBar()->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); - toolBar()->setFloatable(false); - if (!toolBar()->actions().contains(navigatorsWidgetAction)) { - navigatorsWidgetAction->addToToolbarAndSave(this); - } QClipboard* clipboard = QApplication::clipboard(); connect(clipboard, &QClipboard::dataChanged, this, &DolphinMainWindow::updatePasteAction); @@ -194,6 +189,8 @@ DolphinMainWindow::DolphinMainWindow() : createControlButton(); } + updateAllowedToolbarAreas(); + // enable middle-click on back/forward/up to open in a new tab auto *middleClickEventFilter = new MiddleClickActionEventFilter(this); connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked); @@ -2217,6 +2214,21 @@ void DolphinMainWindow::updateSplitAction() } } +void DolphinMainWindow::updateAllowedToolbarAreas() +{ + auto navigators = static_cast<DolphinNavigatorsWidgetAction *> + (actionCollection()->action(QStringLiteral("url_navigators"))); + if (toolBar()->actions().contains(navigators)) { + toolBar()->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); + if (toolBarArea(toolBar()) == Qt::LeftToolBarArea || + toolBarArea(toolBar()) == Qt::RightToolBarArea) { + addToolBar(Qt::TopToolBarArea, toolBar()); + } + } else { + toolBar()->setAllowedAreas(Qt::AllToolBarAreas); + } +} + bool DolphinMainWindow::isKompareInstalled() const { static bool initialized = false; @@ -2424,6 +2436,19 @@ bool DolphinMainWindow::eventFilter(QObject* obj, QEvent* event) return false; } +void DolphinMainWindow::saveNewToolbarConfig() +{ + KXmlGuiWindow::saveNewToolbarConfig(); // Applies the new config. This has to be called first + // because the rest of this method decides things + // based on the new config. + auto navigators = static_cast<DolphinNavigatorsWidgetAction *> + (actionCollection()->action(QStringLiteral("url_navigators"))); + if (!toolBar()->actions().contains(navigators)) { + m_tabWidget->currentTabPage()->insertNavigatorsWidget(navigators); + } + updateAllowedToolbarAreas(); +} + void DolphinMainWindow::focusTerminalPanel() { if (m_terminalPanel->isVisible()) { |
