]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge branch 'release/20.12'
authorNate Graham <nate@kde.org>
Fri, 20 Nov 2020 18:32:49 +0000 (11:32 -0700)
committerNate Graham <nate@kde.org>
Fri, 20 Nov 2020 18:32:49 +0000 (11:32 -0700)
1  2 
src/dolphinmainwindow.cpp

index 64311ea15a8d091847803589e45e7f7abd53884b,b72f2eb90ced1460776083c148219163b9c1abd3..64268542d7af5606aa2cad3160f02c375245f997
@@@ -169,11 -169,6 +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);
          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);
@@@ -1631,7 -1628,7 +1628,7 @@@ void DolphinMainWindow::setupActions(
          openTerminal->setWhatsThis(xi18nc("@info:whatsthis",
              "<para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para>"
              "<para>To learn more about terminals use the help in the terminal application.</para>"));
 -        openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("dialog-scripts")));
 +        openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
          actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT + Qt::Key_F4);
          connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
  
@@@ -2217,6 -2214,21 +2214,21 @@@ void DolphinMainWindow::updateSplitActi
      }
  }
  
+ 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 +2436,19 @@@ bool DolphinMainWindow::eventFilter(QOb
      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()) {