+ const QUrl currentUrl = m_activeViewContainer->url();
+ goUpAction->setEnabled(KIO::upUrl(currentUrl) != currentUrl);
+}
+
+void DolphinMainWindow::createControlButton()
+{
+ if (m_controlButton) {
+ return;
+ }
+ Q_ASSERT(!m_controlButton);
+
+ m_controlButton = new QToolButton(this);
+ m_controlButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu")));
+ m_controlButton->setText(i18nc("@action", "Control"));
+ m_controlButton->setPopupMode(QToolButton::InstantPopup);
+ m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle());
+
+ QMenu* controlMenu = new QMenu(m_controlButton);
+ connect(controlMenu, &QMenu::aboutToShow, this, &DolphinMainWindow::updateControlMenu);
+
+ m_controlButton->setMenu(controlMenu);
+
+ toolBar()->addWidget(m_controlButton);
+ connect(toolBar(), &KToolBar::iconSizeChanged,
+ m_controlButton, &QToolButton::setIconSize);
+ connect(toolBar(), &KToolBar::toolButtonStyleChanged,
+ m_controlButton, &QToolButton::setToolButtonStyle);
+
+ // The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
+ // gets edited. In this case we must add them again. The adding is done asynchronously by
+ // m_updateToolBarTimer.
+ connect(m_controlButton, &QToolButton::destroyed, this, &DolphinMainWindow::slotControlButtonDeleted);
+ m_updateToolBarTimer = new QTimer(this);
+ m_updateToolBarTimer->setInterval(500);
+ connect(m_updateToolBarTimer, &QTimer::timeout, this, &DolphinMainWindow::updateToolBar);
+}
+
+void DolphinMainWindow::deleteControlButton()
+{
+ delete m_controlButton;
+ m_controlButton = nullptr;
+
+ delete m_updateToolBarTimer;
+ m_updateToolBarTimer = nullptr;
+}
+
+bool DolphinMainWindow::addActionToMenu(QAction* action, QMenu* menu)
+{
+ Q_ASSERT(action);
+ Q_ASSERT(menu);
+
+ const KToolBar* toolBarWidget = toolBar();
+ foreach (const QWidget* widget, action->associatedWidgets()) {
+ if (widget == toolBarWidget) {
+ return false;
+ }
+ }
+
+ menu->addAction(action);
+ return true;
+}
+
+void DolphinMainWindow::refreshViews()
+{
+ m_tabWidget->refreshViews();
+
+ if (GeneralSettings::modifiedStartupSettings()) {
+ // The startup settings have been changed by the user (see bug #254947).
+ // Synchronize the split-view setting with the active view:
+ const bool splitView = GeneralSettings::splitView();
+ m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView);
+ updateSplitAction();
+ setUrlAsCaption(activeViewContainer()->url());
+ }
+
+ emit settingsChanged();