]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't block unmounting when terminal panel's cwd is the mountpoint
authorMiklos Marton <martonmiklosqdev@gmail.com>
Thu, 12 Oct 2017 21:17:51 +0000 (23:17 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Thu, 12 Oct 2017 21:21:49 +0000 (23:21 +0200)
When unmounting a removable media Dolphin checks if there are
some files open on the device before performing the unmount.
If the terminal window in dolphin is open and the to be unmounted path is open,
 the unmount process will be blocked.

This patch sets the terminal window current path to the home directory upon unmount request
 if the terminal directory is set to the mount path.

The unmount request could came from two sources:

    The user could hit right click on the media in the dolphin's places panel and hit unmount.
    The user could request an unmount from the indicator applet

This patch was originally written by Arjun AK for the kdelibs4 version
of Dolphin: https://git.reviewboard.kde.org/r/121613/

BUG: 158264
FIXED-IN: 17.11.80

Differential Revision: https://phabricator.kde.org/D7847

12 files changed:
src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placesitemsignalhandler.cpp
src/panels/places/placesitemsignalhandler.h
src/panels/places/placespanel.cpp
src/panels/places/placespanel.h
src/panels/terminal/terminalpanel.cpp
src/panels/terminal/terminalpanel.h

index 3df25001c986407440743d7d694b6cdc319db878..cd232577d19e24016a6abce63717f5ce8ec82105 100644 (file)
@@ -99,7 +99,10 @@ DolphinMainWindow::DolphinMainWindow() :
     m_settingsDialog(),
     m_controlButton(0),
     m_updateToolBarTimer(0),
-    m_lastHandleUrlStatJob(0)
+    m_lastHandleUrlStatJob(0),
+    m_terminalPanel(0),
+    m_placesPanel(0),
+    m_tearDownFromPlacesRequested(false)
 {
     Q_INIT_RESOURCE(dolphin);
 
@@ -247,6 +250,11 @@ void DolphinMainWindow::changeUrl(const QUrl &url)
 
 void DolphinMainWindow::slotTerminalDirectoryChanged(const QUrl& url)
 {
+    if (m_tearDownFromPlacesRequested && url == QUrl::fromLocalFile(QDir::homePath())) {
+        m_placesPanel->proceedWithTearDown();
+        m_tearDownFromPlacesRequested = false;
+    }
+
     m_activeViewContainer->setAutoGrabFocus(false);
     changeUrl(url);
     m_activeViewContainer->setAutoGrabFocus(true);
@@ -994,6 +1002,25 @@ void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
     setWindowTitle(schemePrefix + fileName);
 }
 
+void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath)
+{
+    if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
+        m_tearDownFromPlacesRequested = true;
+        m_terminalPanel->goHome();
+        // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
+    } else {
+        m_placesPanel->proceedWithTearDown();
+    }
+}
+
+void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString& mountPath)
+{
+    if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
+        m_tearDownFromPlacesRequested = false;
+        m_terminalPanel->goHome();
+    }
+}
+
 void DolphinMainWindow::setupActions()
 {
     // setup 'File' menu
@@ -1246,21 +1273,21 @@ void DolphinMainWindow::setupDockWidgets()
         terminalDock->setLocked(lock);
         terminalDock->setObjectName(QStringLiteral("terminalDock"));
         terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
-        TerminalPanel* terminalPanel = new TerminalPanel(terminalDock);
-        terminalPanel->setCustomContextMenuActions({lockLayoutAction});
-        terminalDock->setWidget(terminalPanel);
+        m_terminalPanel = new TerminalPanel(terminalDock);
+        m_terminalPanel->setCustomContextMenuActions({lockLayoutAction});
+        terminalDock->setWidget(m_terminalPanel);
 
-        connect(terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
-        connect(terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
+        connect(m_terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
+        connect(m_terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
         connect(terminalDock, &DolphinDockWidget::visibilityChanged,
-                terminalPanel, &TerminalPanel::dockVisibilityChanged);
+                m_terminalPanel, &TerminalPanel::dockVisibilityChanged);
 
         QAction* terminalAction = terminalDock->toggleViewAction();
         createPanelAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), Qt::Key_F4, terminalAction, QStringLiteral("show_terminal_panel"));
 
         addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
         connect(this, &DolphinMainWindow::urlChanged,
-                terminalPanel, &TerminalPanel::setUrl);
+                m_terminalPanel, &TerminalPanel::setUrl);
 
         if (GeneralSettings::version() < 200) {
             terminalDock->hide();
@@ -1279,28 +1306,31 @@ void DolphinMainWindow::setupDockWidgets()
     placesDock->setObjectName(QStringLiteral("placesDock"));
     placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
 
-    PlacesPanel* placesPanel = new PlacesPanel(placesDock);
-    placesPanel->setCustomContextMenuActions({lockLayoutAction});
-    placesDock->setWidget(placesPanel);
+    m_placesPanel = new PlacesPanel(placesDock);
+    m_placesPanel->setCustomContextMenuActions({lockLayoutAction});
+    placesDock->setWidget(m_placesPanel);
 
-    QActionplacesAction = placesDock->toggleViewAction();
+    QAction *placesAction = placesDock->toggleViewAction();
     createPanelAction(QIcon::fromTheme(QStringLiteral("bookmarks")), Qt::Key_F9, placesAction, QStringLiteral("show_places_panel"));
 
     addDockWidget(Qt::LeftDockWidgetArea, placesDock);
-    connect(placesPanel, &PlacesPanel::placeActivated,
+    connect(m_placesPanel, &PlacesPanel::placeActivated,
             this, &DolphinMainWindow::slotPlaceActivated);
-    connect(placesPanel, &PlacesPanel::placeMiddleClicked,
+    connect(m_placesPanel, &PlacesPanel::placeMiddleClicked,
             this, &DolphinMainWindow::openNewTab);
-    connect(placesPanel, &PlacesPanel::errorMessage,
+    connect(m_placesPanel, &PlacesPanel::errorMessage,
             this, &DolphinMainWindow::showErrorMessage);
     connect(this, &DolphinMainWindow::urlChanged,
-            placesPanel, &PlacesPanel::setUrl);
+            m_placesPanel, &PlacesPanel::setUrl);
     connect(placesDock, &DolphinDockWidget::visibilityChanged,
             m_tabWidget, &DolphinTabWidget::slotPlacesPanelVisibilityChanged);
     connect(this, &DolphinMainWindow::settingsChanged,
-           placesPanel, &PlacesPanel::readSettings);
-
-    m_tabWidget->slotPlacesPanelVisibilityChanged(placesPanel->isVisible());
+        m_placesPanel, &PlacesPanel::readSettings);
+    connect(m_placesPanel, &PlacesPanel::storageTearDownRequested,
+            this, &DolphinMainWindow::slotStorageTearDownFromPlacesRequested);
+    connect(m_placesPanel, &PlacesPanel::storageTearDownExternallyRequested,
+            this, &DolphinMainWindow::slotStorageTearDownExternallyRequested);
+    m_tabWidget->slotPlacesPanelVisibilityChanged(m_placesPanel->isVisible());
 
     // Add actions into the "Panels" menu
     KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
index 06eb5a7a50ab3de51aca6b02cc38cd0478f0ab45..634c2a9e79635d0c6c3bf8405c44501ad08a7084 100644 (file)
@@ -46,6 +46,8 @@ class KJob;
 class KNewFileMenu;
 class QToolButton;
 class QIcon;
+class PlacesPanel;
+class TerminalPanel;
 
 /**
  * @short Main window for Dolphin.
@@ -90,6 +92,8 @@ public:
      */
     KNewFileMenu* newFileMenu() const;
 
+    void setTabsToHomeIfMountPathOpen(const QString& mountPath);
+
 public slots:
     /**
      * Pastes the clipboard data into the currently selected folder
@@ -409,6 +413,21 @@ private slots:
      */
     void setUrlAsCaption(const QUrl& url);
 
+    /**
+     * This slot is called when the user requested to unmount a removable media
+     * from the places menu
+     */
+    void slotStorageTearDownFromPlacesRequested(const QString& mountPath);
+
+    /**
+     * This slot is called when the user requested to unmount a removable media
+     * _not_ from the dolphin's places menu (from the notification area for e.g.)
+     * This slot is basically connected to each removable device's
+     * Solid::StorageAccess::teardownRequested(const QString & udi)
+     * signal through the places panel.
+     */
+    void slotStorageTearDownExternallyRequested(const QString& mountPath);
+
     /**
      * Is called when the view has finished loading the directory.
      */
@@ -496,6 +515,10 @@ private:
     QTimer* m_updateToolBarTimer;
 
     KIO::Job* m_lastHandleUrlStatJob;
+
+    TerminalPanel* m_terminalPanel;
+    PlacesPanel* m_placesPanel;
+    bool m_tearDownFromPlacesRequested;
 };
 
 inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const
index 4ba1217f01bebeb1a360ae1073ab38649264ba26..5b8e5dbefb05c15064e438aae5a573da78396463 100644 (file)
@@ -272,6 +272,8 @@ void PlacesItem::initializeDevice(const QString& udi)
         setUrl(QUrl::fromLocalFile(m_access->filePath()));
         QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged,
                          m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged);
+        QObject::connect(m_access.data(), &Solid::StorageAccess::teardownRequested,
+                         m_signalHandler.data(), &PlacesItemSignalHandler::onTearDownRequested);
     } else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) {
         Solid::Block *block = m_device.as<Solid::Block>();
         if (block) {
@@ -335,3 +337,8 @@ QString PlacesItem::generateNewId()
     return QString::number(QDateTime::currentDateTimeUtc().toTime_t()) +
             '/' + QString::number(count++) + " (V2)";
 }
+
+PlacesItemSignalHandler *PlacesItem::signalHandler() const
+{
+    return m_signalHandler.data();
+}
index 4ae4fd677ba8f05756e8ef649adb79a69c9f1bfa..d1b5b5d96e343c84d97f23b1215298727a084bdb 100644 (file)
@@ -79,6 +79,8 @@ public:
     static KBookmark createDeviceBookmark(KBookmarkManager* manager,
                                           const QString& udi);
 
+    PlacesItemSignalHandler* signalHandler() const;
+
 protected:
     virtual void onDataValueChanged(const QByteArray& role,
                                     const QVariant& current,
index 04dac81b73dd00cf7d15212e0d966051116cd7bf..abd6bc925f5397ebecf73d30a6d5bda6b9e480a6 100644 (file)
@@ -22,6 +22,7 @@
  ***************************************************************************/
 
 #include "placesitemmodel.h"
+#include "placesitemsignalhandler.h"
 
 #include "dolphin_generalsettings.h"
 
@@ -77,6 +78,7 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
     m_systemBookmarksIndexes(),
     m_bookmarkedItems(),
     m_hiddenItemToRemove(-1),
+    m_deviceToTearDown(0),
     m_updateBookmarksTimer(0),
     m_storageSetupInProgress()
 {
@@ -306,7 +308,7 @@ void PlacesItemModel::requestEject(int index)
         Solid::OpticalDrive* drive = item->device().parent().as<Solid::OpticalDrive>();
         if (drive) {
             connect(drive, &Solid::OpticalDrive::ejectDone,
-                    this, &PlacesItemModel::slotStorageTeardownDone);
+                    this, &PlacesItemModel::slotStorageTearDownDone);
             drive->eject();
         } else {
             const QString label = item->text();
@@ -316,15 +318,19 @@ void PlacesItemModel::requestEject(int index)
     }
 }
 
-void PlacesItemModel::requestTeardown(int index)
+void PlacesItemModel::requestTearDown(int index)
 {
     const PlacesItem* item = placesItem(index);
     if (item) {
-        Solid::StorageAccess* access = item->device().as<Solid::StorageAccess>();
-        if (access) {
-            connect(access, &Solid::StorageAccess::teardownDone,
-                    this, &PlacesItemModel::slotStorageTeardownDone);
-            access->teardown();
+        Solid::StorageAccess *tmp = item->device().as<Solid::StorageAccess>();
+        if (tmp) {
+            m_deviceToTearDown = tmp;
+            // disconnect the Solid::StorageAccess::teardownRequested
+            // to prevent emitting PlacesItemModel::storageTearDownExternallyRequested
+            // after we have emitted PlacesItemModel::storageTearDownRequested
+            disconnect(tmp, &Solid::StorageAccess::teardownRequested,
+                       item->signalHandler(), &PlacesItemSignalHandler::onTearDownRequested);
+            emit storageTearDownRequested(tmp->filePath());
         }
     }
 }
@@ -550,7 +556,11 @@ void PlacesItemModel::slotDeviceAdded(const QString& udi)
 
     m_availableDevices << udi;
     const KBookmark bookmark = PlacesItem::createDeviceBookmark(m_bookmarkManager, udi);
-    appendItem(new PlacesItem(bookmark));
+
+    PlacesItem *item = new PlacesItem(bookmark);
+    appendItem(item);
+    connect(item->signalHandler(), &PlacesItemSignalHandler::tearDownExternallyRequested,
+            this, &PlacesItemModel::storageTearDownExternallyRequested);
 }
 
 void PlacesItemModel::slotDeviceRemoved(const QString& udi)
@@ -576,11 +586,13 @@ void PlacesItemModel::slotDeviceRemoved(const QString& udi)
     }
 }
 
-void PlacesItemModel::slotStorageTeardownDone(Solid::ErrorType error, const QVariant& errorData)
+void PlacesItemModel::slotStorageTearDownDone(Solid::ErrorType error, const QVariant& errorData)
 {
     if (error && errorData.isValid()) {
         emit errorMessage(errorData.toString());
     }
+    m_deviceToTearDown->disconnect();
+    m_deviceToTearDown = nullptr;
 }
 
 void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error,
@@ -786,7 +798,10 @@ void PlacesItemModel::loadBookmarks()
     devicesItems.reserve(devicesItems.count() + devices.count());
     foreach (const QString& udi, devices) {
         const KBookmark bookmark = PlacesItem::createDeviceBookmark(m_bookmarkManager, udi);
-        devicesItems.append(new PlacesItem(bookmark));
+        PlacesItem *item = new PlacesItem(bookmark);
+        devicesItems.append(item);
+        connect(item->signalHandler(), &PlacesItemSignalHandler::tearDownExternallyRequested,
+                this, &PlacesItemModel::storageTearDownExternallyRequested);
     }
 
     QList<PlacesItem*> items;
@@ -940,6 +955,15 @@ void PlacesItemModel::clear() {
     KStandardItemModel::clear();
 }
 
+void PlacesItemModel::proceedWithTearDown()
+{
+    Q_ASSERT(m_deviceToTearDown);
+
+    connect(m_deviceToTearDown, &Solid::StorageAccess::teardownDone,
+            this, &PlacesItemModel::slotStorageTearDownDone);
+    m_deviceToTearDown->teardown();
+}
+
 void PlacesItemModel::initializeAvailableDevices()
 {
     QString predicate(QStringLiteral("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]"
index aa8bb16fe51e8c09cbf7804af39088deff693911..dcc9759e6d5192cda427fb5b941834d309ad5196 100644 (file)
@@ -102,7 +102,7 @@ public:
     QAction* teardownAction(int index) const;
 
     void requestEject(int index);
-    void requestTeardown(int index);
+    void requestTearDown(int index);
 
     bool storageSetupNeeded(int index) const;
     void requestStorageSetup(int index);
@@ -123,6 +123,8 @@ public:
 
     virtual void clear() Q_DECL_OVERRIDE;
 
+    void proceedWithTearDown();
+
     /**
      * Saves the bookmarks and indicates to other applications that the
      * state of the bookmarks has been changed. Is only called by the
@@ -133,6 +135,8 @@ public:
 signals:
     void errorMessage(const QString& message);
     void storageSetupDone(int index, bool success);
+    void storageTearDownRequested(const QString& mountPath);
+    void storageTearDownExternallyRequested(const QString& mountPath);
 
 protected:
     virtual void onItemInserted(int index) Q_DECL_OVERRIDE;
@@ -142,7 +146,7 @@ protected:
 private slots:
     void slotDeviceAdded(const QString& udi);
     void slotDeviceRemoved(const QString& udi);
-    void slotStorageTeardownDone(Solid::ErrorType error, const QVariant& errorData);
+    void slotStorageTearDownDone(Solid::ErrorType error, const QVariant& errorData);
     void slotStorageSetupDone(Solid::ErrorType error, const QVariant& errorData, const QString& udi);
     void hideItem();
 
@@ -281,6 +285,8 @@ private:
     // removing an item is not allowed.
     int m_hiddenItemToRemove;
 
+    Solid::StorageAccess *m_deviceToTearDown;
+
     QTimer* m_updateBookmarksTimer;
 
     QHash<QObject*, int> m_storageSetupInProgress;
index c9bc0db3f7b29551365a9d221bfa134ce5b5b649..bd3fc9f72742631d23c166b3a85bb71e86f9423f 100644 (file)
@@ -47,3 +47,15 @@ void PlacesItemSignalHandler::onTrashDirListerCompleted()
     }
 }
 
+void PlacesItemSignalHandler::onTearDownRequested(const QString& udi)
+{
+    Q_UNUSED(udi)
+    if (m_item) {
+        Solid::StorageAccess *tmp = m_item->device().as<Solid::StorageAccess>();
+        if (tmp) {
+            QString mountPath = tmp->filePath();
+            emit tearDownExternallyRequested(mountPath);
+        }
+    }
+}
+
index af66568adc841b9bc8cbc1731a3d7755b7ef7183..f65b57fe1e39e24204f62c08b5bd2a55feffe291 100644 (file)
@@ -61,6 +61,11 @@ public slots:
      */
     void onTrashDirListerCompleted();
 
+    void onTearDownRequested(const QString& udi);
+
+signals:
+    void tearDownExternallyRequested(const QString& udi);
+
 private:
     PlacesItem* m_item;
 };
index 19a17be08e6d456a128efd253bb7fec99fa44903..0ce6d69a5f1c72e21446f69432dfc026610d1281 100644 (file)
@@ -72,6 +72,11 @@ PlacesPanel::~PlacesPanel()
 {
 }
 
+void PlacesPanel::proceedWithTearDown()
+{
+    m_model->proceedWithTearDown();
+}
+
 bool PlacesPanel::urlChanged()
 {
     if (!url().isValid() || url().scheme().contains(QStringLiteral("search"))) {
@@ -110,6 +115,10 @@ void PlacesPanel::showEvent(QShowEvent* event)
         m_model->setGroupedSorting(true);
         connect(m_model, &PlacesItemModel::errorMessage,
                 this, &PlacesPanel::errorMessage);
+        connect(m_model, &PlacesItemModel::storageTearDownRequested,
+                this, &PlacesPanel::storageTearDownRequested);
+        connect(m_model, &PlacesItemModel::storageTearDownExternallyRequested,
+                this, &PlacesPanel::storageTearDownExternallyRequested);
 
         m_view = new PlacesView();
         m_view->setWidgetCreator(new KItemListWidgetCreator<PlacesItemListWidget>());
@@ -241,7 +250,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
                 // emit the slotItemMiddleClicked signal, because of Qt::MiddleButton.
                 triggerItem(index, Qt::MiddleButton);
             } else if (action == teardownAction) {
-                m_model->requestTeardown(index);
+                m_model->requestTearDown(index);
             } else if (action == ejectAction) {
                 m_model->requestEject(index);
             }
index 0c8b5f7f23b746a218eb013e1a676d87a450a507..13a38df2d2cf6650b4bd184b2becac6be28cf809 100644 (file)
@@ -41,11 +41,14 @@ class PlacesPanel : public Panel
 public:
     PlacesPanel(QWidget* parent);
     virtual ~PlacesPanel();
+    void proceedWithTearDown();
 
 signals:
     void placeActivated(const QUrl& url);
     void placeMiddleClicked(const QUrl& url);
     void errorMessage(const QString& error);
+    void storageTearDownRequested(const QString& mountPath);
+    void storageTearDownExternallyRequested(const QString& mountPath);
 
 protected:
     virtual bool urlChanged() Q_DECL_OVERRIDE;
index e952f23a0a74f17c2df0af50f24dececa9f35127..b7d3605aa57ea147c67a1f772f1bf90825131e29 100644 (file)
@@ -54,6 +54,19 @@ TerminalPanel::~TerminalPanel()
 {
 }
 
+void TerminalPanel::goHome()
+{
+    sendCdToTerminal(QDir::homePath(), HistoryPolicy::SkipHistory);
+}
+
+QString TerminalPanel::currentWorkingDirectory()
+{
+    if (m_terminal) {
+        return m_terminal->currentWorkingDirectory();
+    }
+    return QString();
+}
+
 void TerminalPanel::terminalExited()
 {
     m_terminal = 0;
@@ -144,7 +157,7 @@ void TerminalPanel::changeDir(const QUrl& url)
     }
 }
 
-void TerminalPanel::sendCdToTerminal(const QString& dir)
+void TerminalPanel::sendCdToTerminal(const QString& dir, HistoryPolicy addToHistory)
 {
     if (dir == m_konsolePartCurrentDirectory) {
         m_clearTerminal = false;
@@ -168,7 +181,8 @@ void TerminalPanel::sendCdToTerminal(const QString& dir)
     // the directory change, because this directory change is not caused by a "cd" command that the
     // user entered in the panel. Therefore, we have to remember 'dir'. Note that it could also be
     // a symbolic link -> remember the 'canonical' path.
-    m_sendCdToTerminalHistory.enqueue(QDir(dir).canonicalPath());
+    if (addToHistory == HistoryPolicy::AddToHistory)
+        m_sendCdToTerminalHistory.enqueue(QDir(dir).canonicalPath());
 
     if (m_clearTerminal) {
         m_terminal->sendInput(QStringLiteral(" clear\n"));
index 75e198e1a525100f7b9eb779a1dea5bf23b6e811..3de3b6d305720015538302aa595b4597f5e7b21e 100644 (file)
@@ -48,6 +48,13 @@ public:
     TerminalPanel(QWidget* parent = 0);
     virtual ~TerminalPanel();
 
+    /**
+     * @brief This function is used to set the terminal panels's cwd to
+     *        home when an unmounting request is receieved.
+     */
+    void goHome();
+    QString currentWorkingDirectory();
+
 public slots:
     void terminalExited();
     void dockVisibilityChanged();
@@ -70,8 +77,13 @@ private slots:
     void slotKonsolePartCurrentDirectoryChanged(const QString& dir);
 
 private:
+    enum class HistoryPolicy {
+        AddToHistory,
+        SkipHistory
+    };
+
     void changeDir(const QUrl& url);
-    void sendCdToTerminal(const QString& path);
+    void sendCdToTerminal(const QString& path, HistoryPolicy addToHistory = HistoryPolicy::AddToHistory);
 
 private:
     bool m_clearTerminal;