]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Drop now unneeded QOverload statements
[dolphin.git] / src / dolphinmainwindow.cpp
index f3a5e3b4e89539fbc3d720b3f1874d7926701e65..4b7aba224a8f45846d408dbb6b877c56617d2dd8 100644 (file)
@@ -64,6 +64,7 @@
 #include <KUrlNavigator>
 #include <KWindowSystem>
 #include <KXMLGUIFactory>
+#include <kxmlgui_version.h>
 
 #include <kio_version.h>
 
@@ -122,13 +123,17 @@ DolphinMainWindow::DolphinMainWindow() :
     setComponentName(QStringLiteral("dolphin"), QGuiApplication::applicationDisplayName());
     setObjectName(QStringLiteral("Dolphin#"));
 
+#if KXMLGUI_VERSION >= QT_VERSION_CHECK(5, 88, 0)
+    setStateConfigGroup("State");
+#endif
+
     connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
             this, &DolphinMainWindow::showErrorMessage);
 
     KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
     undoManager->setUiInterface(new UndoUiInterface());
 
-    connect(undoManager, QOverload<bool>::of(&KIO::FileUndoManager::undoAvailable),
+    connect(undoManager, &KIO::FileUndoManager::undoAvailable,
             this, &DolphinMainWindow::slotUndoAvailable);
     connect(undoManager, &KIO::FileUndoManager::undoTextChanged,
             this, &DolphinMainWindow::slotUndoTextChanged);
@@ -206,7 +211,7 @@ DolphinMainWindow::DolphinMainWindow() :
 
     setupWhatsThis();
 
-    connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
+    connect(KSycoca::self(), &KSycoca::databaseChanged, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
 
     QTimer::singleShot(0, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
 
@@ -214,6 +219,9 @@ DolphinMainWindow::DolphinMainWindow() :
     connect(&m_fileItemActions, &KFileItemActions::error, this, [this](const QString &errorMessage) {
         showErrorMessage(errorMessage);
     });
+
+    connect(GeneralSettings::self(), &GeneralSettings::splitViewChanged,
+            this, &DolphinMainWindow::slotSplitViewChanged);
 }
 
 DolphinMainWindow::~DolphinMainWindow()
@@ -437,6 +445,12 @@ void DolphinMainWindow::openNewTab(const QUrl& url)
     m_tabWidget->openNewTab(url, QUrl());
 }
 
+void DolphinMainWindow::slotSplitViewChanged()
+{
+    m_tabWidget->currentTabPage()->setSplitViewEnabled(GeneralSettings::splitView(), WithAnimation);
+    updateSplitAction();
+}
+
 void DolphinMainWindow::openInNewTab()
 {
     const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
@@ -1011,7 +1025,11 @@ void DolphinMainWindow::updateOpenPreferredSearchToolAction()
     if (tool) {
         openPreferredSearchTool->setVisible(true);
         openPreferredSearchTool->setText(i18nc("@action:inmenu Tools", "Open %1", tool->text()));
-        openPreferredSearchTool->setIcon(tool->icon());
+        // Only override with the app icon if it is the default, i.e. the user hasn't configured one manually
+        // https://bugs.kde.org/show_bug.cgi?id=442815
+        if (openPreferredSearchTool->icon().name() == QLatin1String("search")) {
+            openPreferredSearchTool->setIcon(tool->icon());
+        }
     } else {
         openPreferredSearchTool->setVisible(false);
         // still visible in Shortcuts configuration window
@@ -1462,7 +1480,7 @@ void DolphinMainWindow::setupActions()
 
     QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar"));
     showFilterBar->setText(i18nc("@action:inmenu Tools", "Filter..."));
-    showFilterBar->setToolTip(i18nc("@info:tooltip", "Toggle Filter Bar"));
+    showFilterBar->setToolTip(i18nc("@info:tooltip", "Show Filter Bar"));
     showFilterBar->setWhatsThis(xi18nc("@info:whatsthis", "This opens the "
         "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
         "There you can enter a text to filter the files and folders currently displayed. "
@@ -2097,11 +2115,6 @@ 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, WithAnimation);
-        updateSplitAction();
         updateWindowTitle();
     }
 
@@ -2121,6 +2134,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, &DolphinMainWindow::slotWriteStateChanged);
     connect(container, &DolphinViewContainer::searchModeEnabledChanged,
             this, &DolphinMainWindow::updateSearchAction);
+    connect(container, &DolphinViewContainer::captionChanged,
+            this, &DolphinMainWindow::updateWindowTitle);
 
     const QAction* toggleSearchAction = actionCollection()->action(QStringLiteral("toggle_search"));
     connect(toggleSearchAction, &QAction::triggered, container, &DolphinViewContainer::setSearchModeEnabled);