]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Increase default window size
[dolphin.git] / src / dolphinmainwindow.cpp
index beec95c6c6ef3adc3df528e770088f3d01da8d0e..a126a0bf4bd8102f590a32d39cca1158df5b2609 100644 (file)
@@ -134,10 +134,9 @@ DolphinMainWindow::DolphinMainWindow() :
     connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished,
             this, &DolphinMainWindow::showCommand);
 
-    GeneralSettings* generalSettings = GeneralSettings::self();
-    const bool firstRun = (generalSettings->version() < 200);
+    const bool firstRun = (GeneralSettings::version() < 200);
     if (firstRun) {
-        generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
+        GeneralSettings::setViewPropsTimestamp(QDateTime::currentDateTime());
     }
 
     setAcceptDrops(true);
@@ -174,12 +173,12 @@ DolphinMainWindow::DolphinMainWindow() :
             this, &DolphinMainWindow::updatePasteAction);
 
     QAction* toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter"));
-    toggleFilterBarAction->setChecked(generalSettings->filterBar());
+    toggleFilterBarAction->setChecked(GeneralSettings::filterBar());
 
     if (firstRun) {
         menuBar()->setVisible(false);
         // Assure a proper default size if Dolphin runs the first time
-        resize(750, 500);
+        resize(760, 550);
     }
 
     const bool showMenu = !menuBar()->isHidden();
@@ -258,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)
@@ -394,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()
@@ -423,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()
@@ -446,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;
         }
     }
@@ -454,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());
     }
 }
 
@@ -756,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>()));
     }
 }
 
@@ -808,7 +805,7 @@ void DolphinMainWindow::invertSelection()
 void DolphinMainWindow::toggleSplitView()
 {
     DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
-    tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled());
+    tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), WithAnimation);
 
     updateViewActions();
 }
@@ -816,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()
@@ -935,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()
@@ -1039,7 +1036,7 @@ void DolphinMainWindow::openTerminal()
     const QUrl url = m_activeViewContainer->url();
 
     if (url.isLocalFile()) {
-        KToolInvocation::invokeTerminal(QString(), url.toLocalFile());
+        KToolInvocation::invokeTerminal(QString(), {}, url.toLocalFile());
         return;
     }
 
@@ -1053,14 +1050,14 @@ void DolphinMainWindow::openTerminal()
                 statUrl = job->mostLocalUrl();
             }
 
-            KToolInvocation::invokeTerminal(QString(), statUrl.isLocalFile() ? statUrl.toLocalFile() : QDir::homePath());
+            KToolInvocation::invokeTerminal(QString(), {}, statUrl.isLocalFile() ? statUrl.toLocalFile() : QDir::homePath());
         });
 
         return;
     }
 
     // Nothing worked, just use $HOME
-    KToolInvocation::invokeTerminal(QString(), QDir::homePath());
+    KToolInvocation::invokeTerminal(QString(), {}, QDir::homePath());
 }
 
 void DolphinMainWindow::editSettings()
@@ -1070,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);
@@ -1092,7 +1089,7 @@ void DolphinMainWindow::handleUrl(const QUrl& url)
     } else {
         m_lastHandleUrlOpenJob = new KIO::OpenUrlJob(url);
         m_lastHandleUrlOpenJob->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
-        m_lastHandleUrlOpenJob->setRunExecutables(true);
+        m_lastHandleUrlOpenJob->setShowOpenOrExecuteDialog(true);
 
         connect(m_lastHandleUrlOpenJob, &KIO::OpenUrlJob::mimeTypeFound, this,
                 [this, url](const QString &mimetype) {
@@ -1140,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:
@@ -1246,7 +1243,9 @@ void DolphinMainWindow::slotPlaceActivated(const QUrl& url)
         // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
         reloadView();
     } else {
+        view->disableUrlNavigatorSelectionRequests();
         changeUrl(url);
+        view->enableUrlNavigatorSelectionRequests();
     }
 }
 
@@ -1524,7 +1523,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());
@@ -1829,7 +1828,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);
 
@@ -1906,13 +1905,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,
@@ -2144,7 +2143,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();
     }
@@ -2207,7 +2206,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(