]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Add the KFilePlacesModel class. It allows to list user's "places" (a mix
[dolphin.git] / src / dolphinmainwindow.cpp
index 4090d69399bda93fc877eb0f8f35b19a93935e2c..767db820d2468b7d32dcb8582635f77fd39e4efe 100644 (file)
@@ -35,6 +35,7 @@
 #include "urlnavigator.h"
 #include "viewpropertiesdialog.h"
 #include "viewproperties.h"
+#include "kfileplacesmodel.h"
 
 #include "dolphin_generalsettings.h"
 
@@ -460,36 +461,12 @@ void DolphinMainWindow::deleteItems()
 {
     clearStatusBar();
 
-    // TODO: if KonqOperations::askDeleteConfirmation() would indicate when
-    // the operation has been finished, this method should be used.
+    const KUrl::List list = m_activeView->selectedUrls();
+    const bool del = KonqOperations::askDeleteConfirmation(list,
+                                                           KonqOperations::DEL,
+                                                           KonqOperations::FORCE_CONFIRMATION,
+                                                           this);
 
-    KUrl::List list = m_activeView->selectedUrls();
-    const uint itemCount = list.count();
-    Q_ASSERT(itemCount >= 1);
-
-    QString text;
-    if (itemCount > 1) {
-        text = i18n("Do you really want to delete the %1 selected items?", itemCount);
-    }
-    else {
-        const KUrl& url = list.first();
-        QString itemName;
-        if (url.protocol() == "trash" ) {
-            itemName = url.path();
-            // TODO: check comment in konq_undo.cc in the method askDeleteConfirmation()
-            itemName.remove(QRegExp("^/[0-9]*-"));
-        }
-        else {
-           itemName = url.pathOrUrl();
-        }
-        text = i18n("Do you really want to delete '%1'?", itemName);
-    }
-
-    const bool del = KMessageBox::warningContinueCancel(this,
-                                                        text,
-                                                        QString(),
-                                                        KGuiItem(i18n("Delete"), KIcon("edit-delete"))
-                                                       ) == KMessageBox::Continue;
     if (del) {
         KIO::Job* job = KIO::del(list);
         connect(job, SIGNAL(result(KJob*)),
@@ -1356,6 +1333,15 @@ void DolphinMainWindow::setupDockWidgets()
         infoDock->hide();
         treeViewDock->hide();
     }
+
+    // FIXME: To merge with the current bookmark sidebar
+    QDockWidget *placesDock = new QDockWidget(i18n("Places"));
+    placesDock->setObjectName("placesDock");
+    placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+    QListView *listView = new QListView(placesDock);
+    placesDock->setWidget(listView);
+    listView->setModel(new KFilePlacesModel(listView));
+    addDockWidget(Qt::LeftDockWidgetArea, placesDock);
 }
 
 void DolphinMainWindow::updateHistory()