]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Build with QT_NO_KEYWORDS
[dolphin.git] / src / dolphinmainwindow.cpp
index 96ca3d448eac67fb4d4a4783ee444f7b14eafcc0..bbb809cceca42072ada8c8d830f508a3aceb672c 100644 (file)
@@ -257,7 +257,11 @@ bool DolphinMainWindow::isFoldersPanelEnabled() const
 
 bool DolphinMainWindow::isInformationPanelEnabled() const
 {
+#ifdef HAVE_BALOO
     return actionCollection()->action(QStringLiteral("show_information_panel"))->isChecked();
+#else
+    return false;
+#endif
 }
 
 void DolphinMainWindow::openFiles(const QStringList& files, bool splitView)
@@ -393,7 +397,11 @@ void DolphinMainWindow::openNewMainWindow()
 
 void DolphinMainWindow::openNewActivatedTab()
 {
+    // keep browsers compatibility, new tab is always after last one
+    auto openNewTabAfterLastTabConfigured = GeneralSettings::openNewTabAfterLastTab();
+    GeneralSettings::setOpenNewTabAfterLastTab(true);
     m_tabWidget->openNewActivatedTab();
+    GeneralSettings::setOpenNewTabAfterLastTab(openNewTabAfterLastTabConfigured);
 }
 
 void DolphinMainWindow::addToPlaces()
@@ -422,19 +430,9 @@ void DolphinMainWindow::addToPlaces()
     }
 }
 
-void DolphinMainWindow::openNewTab(const QUrl& url, DolphinTabWidget::TabPlacement tabPlacement)
-{
-    m_tabWidget->openNewTab(url, QUrl(), tabPlacement);
-}
-
-void DolphinMainWindow::openNewTabAfterCurrentTab(const QUrl& url)
+void DolphinMainWindow::openNewTab(const QUrl& url)
 {
-    m_tabWidget->openNewTab(url, QUrl(), DolphinTabWidget::AfterCurrentTab);
-}
-
-void DolphinMainWindow::openNewTabAfterLastTab(const QUrl& url)
-{
-    m_tabWidget->openNewTab(url, QUrl(), DolphinTabWidget::AfterLastTab);
+    m_tabWidget->openNewTab(url, QUrl());
 }
 
 void DolphinMainWindow::openInNewTab()
@@ -445,7 +443,7 @@ void DolphinMainWindow::openInNewTab()
     for (const KFileItem& item : list) {
         const QUrl& url = DolphinView::openItemAsFolderUrl(item);
         if (!url.isEmpty()) {
-            openNewTabAfterCurrentTab(url);
+            openNewTab(url);
             tabCreated = true;
         }
     }
@@ -453,7 +451,7 @@ void DolphinMainWindow::openInNewTab()
     // if no new tab has been created from the selection
     // open the current directory in a new tab
     if (!tabCreated) {
-        openNewTabAfterCurrentTab(m_activeViewContainer->url());
+        openNewTab(m_activeViewContainer->url());
     }
 }
 
@@ -755,7 +753,7 @@ void DolphinMainWindow::slotBackForwardActionMiddleClicked(QAction* action)
 {
     if (action) {
         const KUrlNavigator *urlNavigator = activeViewContainer()->urlNavigatorInternalWithHistory();
-        openNewTabAfterCurrentTab(urlNavigator->locationUrl(action->data().value<int>()));
+        openNewTab(urlNavigator->locationUrl(action->data().value<int>()));
     }
 }
 
@@ -807,7 +805,7 @@ void DolphinMainWindow::invertSelection()
 void DolphinMainWindow::toggleSplitView()
 {
     DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
-    tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled());
+    tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), WithAnimation);
 
     updateViewActions();
 }
@@ -815,8 +813,8 @@ void DolphinMainWindow::toggleSplitView()
 void DolphinMainWindow::toggleSplitStash()
 {
     DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
-    tabPage->setSplitViewEnabled(false);
-    tabPage->setSplitViewEnabled(true, QUrl("stash:/"));
+    tabPage->setSplitViewEnabled(false, WithAnimation);
+    tabPage->setSplitViewEnabled(true, WithAnimation, QUrl("stash:/"));
 }
 
 void DolphinMainWindow::reloadView()
@@ -934,25 +932,25 @@ void DolphinMainWindow::goBackInNewTab()
 {
     const KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigatorInternalWithHistory();
     const int index = urlNavigator->historyIndex() + 1;
-    openNewTabAfterCurrentTab(urlNavigator->locationUrl(index));
+    openNewTab(urlNavigator->locationUrl(index));
 }
 
 void DolphinMainWindow::goForwardInNewTab()
 {
     const KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigatorInternalWithHistory();
     const int index = urlNavigator->historyIndex() - 1;
-    openNewTabAfterCurrentTab(urlNavigator->locationUrl(index));
+    openNewTab(urlNavigator->locationUrl(index));
 }
 
 void DolphinMainWindow::goUpInNewTab()
 {
     const QUrl currentUrl = activeViewContainer()->urlNavigator()->locationUrl();
-    openNewTabAfterCurrentTab(KIO::upUrl(currentUrl));
+    openNewTab(KIO::upUrl(currentUrl));
 }
 
 void DolphinMainWindow::goHomeInNewTab()
 {
-    openNewTabAfterCurrentTab(Dolphin::homeUrl());
+    openNewTab(Dolphin::homeUrl());
 }
 
 void DolphinMainWindow::compareFiles()
@@ -1069,7 +1067,7 @@ void DolphinMainWindow::editSettings()
         container->view()->writeSettings();
 
         const QUrl url = container->url();
-        DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this);
+        DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this, actionCollection());
         connect(settingsDialog, &DolphinSettingsDialog::settingsChanged, this, &DolphinMainWindow::refreshViews);
         connect(settingsDialog, &DolphinSettingsDialog::settingsChanged,
                 &DolphinUrlNavigatorsController::slotReadSettings);
@@ -1139,7 +1137,7 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
         break;
 
     case DolphinContextMenu::OpenParentFolderInNewTab:
-        openNewTabAfterLastTab(KIO::upUrl(item.url()));
+        openNewTab(KIO::upUrl(item.url()));
         break;
 
     case DolphinContextMenu::None:
@@ -1523,7 +1521,7 @@ void DolphinMainWindow::setupActions()
     stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
     stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
     stashSplit->setCheckable(false);
-    stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash"));
+    stashSplit->setVisible(QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier")));
     connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash);
 
     KStandardAction::redisplay(this, &DolphinMainWindow::reloadView, actionCollection());
@@ -1828,7 +1826,7 @@ void DolphinMainWindow::setupDockWidgets()
     connect(foldersPanel, &FoldersPanel::folderActivated,
             this, &DolphinMainWindow::changeUrl);
     connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
-            this, &DolphinMainWindow::openNewTabAfterCurrentTab);
+            this, &DolphinMainWindow::openNewTab);
     connect(foldersPanel, &FoldersPanel::errorMessage,
             this, &DolphinMainWindow::showErrorMessage);
 
@@ -1905,13 +1903,13 @@ void DolphinMainWindow::setupDockWidgets()
     placesDock->setWidget(m_placesPanel);
 
     QAction *placesAction = placesDock->toggleViewAction();
-    createPanelAction(QIcon::fromTheme(QStringLiteral("bookmarks")), Qt::Key_F9, placesAction, QStringLiteral("show_places_panel"));
+    createPanelAction(QIcon::fromTheme(QStringLiteral("compass")), Qt::Key_F9, placesAction, QStringLiteral("show_places_panel"));
 
     addDockWidget(Qt::LeftDockWidgetArea, placesDock);
     connect(m_placesPanel, &PlacesPanel::placeActivated,
             this, &DolphinMainWindow::slotPlaceActivated);
     connect(m_placesPanel, &PlacesPanel::placeMiddleClicked,
-            this, &DolphinMainWindow::openNewTabAfterCurrentTab);
+            this, &DolphinMainWindow::openNewTab);
     connect(m_placesPanel, &PlacesPanel::errorMessage,
             this, &DolphinMainWindow::showErrorMessage);
     connect(this, &DolphinMainWindow::urlChanged,
@@ -2143,7 +2141,7 @@ void DolphinMainWindow::refreshViews()
         // 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);
+        m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView, WithAnimation);
         updateSplitAction();
         updateWindowTitle();
     }
@@ -2206,7 +2204,7 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
     connect(navigator, &KUrlNavigator::editableStateChanged,
             this, &DolphinMainWindow::slotEditableStateChanged);
     connect(navigator, &KUrlNavigator::tabRequested,
-            this, &DolphinMainWindow::openNewTabAfterLastTab);
+            this, &DolphinMainWindow::openNewTab);
 
     disconnect(m_updateHistoryConnection);
     m_updateHistoryConnection = connect(