]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/places/placespanel.cpp
Don't block unmounting when terminal panel's cwd is the mountpoint
[dolphin.git] / src / panels / places / placespanel.cpp
index 17367b865238f789d79e883d65a50c29aa122dd2..0ce6d69a5f1c72e21446f69432dfc026610d1281 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "dolphin_generalsettings.h"
 
+#include "global.h"
 #include <KFileItem>
 #include "dolphindebug.h"
 #include <KDirNotify>
@@ -71,6 +72,11 @@ PlacesPanel::~PlacesPanel()
 {
 }
 
+void PlacesPanel::proceedWithTearDown()
+{
+    m_model->proceedWithTearDown();
+}
+
 bool PlacesPanel::urlChanged()
 {
     if (!url().isValid() || url().scheme().contains(QStringLiteral("search"))) {
@@ -109,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>());
@@ -192,12 +202,15 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
         }
     }
 
+    QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme("window-new"), i18nc("@item:inmenu", "Open in New Window"));
     QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@item:inmenu", "Open in New Tab"));
     if (!isDevice && !isTrash) {
         menu.addSeparator();
     }
 
-    editAction = menu.addAction(QIcon::fromTheme("document-properties"), i18nc("@item:inmenu", "Edit..."));
+    if (!isDevice) {
+        editAction = menu.addAction(QIcon::fromTheme("document-properties"), i18nc("@item:inmenu", "Edit..."));
+    }
 
     QAction* removeAction = 0;
     if (!isDevice && !item->isSystemItem()) {
@@ -230,12 +243,14 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
             } else if (action == hideAction) {
                 item->setHidden(hideAction->isChecked());
                 m_model->saveBookmarks();
+            } else if (action == openInNewWindowAction) {
+                Dolphin::openNewWindow({PlacesItemModel::convertedUrl(m_model->data(index).value("url").toUrl())}, this);
             } else if (action == openInNewTabAction) {
                 // TriggerItem does set up the storage first and then it will
                 // 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);
             }