]> cloud.milkyroute.net Git - dolphin.git/commitdiff
- When showing the trash content, use the details view with path as default view
authorPeter Penz <peter.penz19@gmail.com>
Thu, 18 Nov 2010 16:18:07 +0000 (16:18 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 18 Nov 2010 16:18:07 +0000 (16:18 +0000)
- Assure that the original path is shown for the trash protocol within Dolphin

svn path=/trunk/KDE/kdebase/apps/; revision=1198481

src/views/dolphinmodel.cpp
src/views/viewproperties.cpp

index 5e62881a8aeaab13011e3323dedeee947bf542c6..6474a4f3c639940227b49e667ea443bbfbb8d650 100644 (file)
@@ -104,7 +104,12 @@ QVariant DolphinModel::data(const QModelIndex& index, int role) const
         case DolphinModel::LocalPathOrUrl:
             const KDirModel *dirModel = qobject_cast<const KDirModel*>(index.model());
             const KFileItem item = dirModel->itemForIndex(index);
-            return item.mostLocalUrl().directory();
+            const KUrl url = item.mostLocalUrl();
+            if (url.protocol() == QLatin1String("trash")) {
+                const KIO::UDSEntry udsEntry = item.entry();
+                return udsEntry.stringValue(KIO::UDSEntry::UDS_EXTRA);
+            }
+            return url.directory();
         }
         break;
 
index d5330ffaaffa1e8bb84d4bc5f08c62bd8ef7327d..ed055e09e2f7fc93a4e2bdd2f781537f31d8bf6a 100644 (file)
@@ -53,9 +53,13 @@ ViewProperties::ViewProperties(const KUrl& url) :
     // We try and save it to the file .directory in the directory being viewed.
     // If the directory is not writable by the user or the directory is not local,
     // we store the properties information in a local file.
-    const bool isSearchUrl = url.protocol().contains("search");
-    if (isSearchUrl) {
+    bool useDetailsViewWithPath = false;
+    if (url.protocol().contains("search")) {
         m_filePath = destinationDir("search");
+        useDetailsViewWithPath = true;
+    } else if (url.protocol() == QLatin1String("trash")) {
+        m_filePath = destinationDir("trash");
+        useDetailsViewWithPath = true;
     } else if (useGlobalViewProps) {
         m_filePath = destinationDir("global");
     } else if (url.isLocalFile()) {
@@ -73,11 +77,11 @@ ViewProperties::ViewProperties(const KUrl& url) :
 
     // If the .directory file does not exist or the timestamp is too old,
     // use default values instead.
-    const bool useDefaultProps = (!useGlobalViewProps || isSearchUrl) &&
+    const bool useDefaultProps = (!useGlobalViewProps || useDetailsViewWithPath) &&
                                  (!QFileInfo(file).exists() ||
                                   (m_node->timestamp() < settings->viewPropsTimestamp()));
     if (useDefaultProps) {
-        if (isSearchUrl) {
+        if (useDetailsViewWithPath) {
             setViewMode(DolphinView::DetailsView);
             setAdditionalInfo(KFileItemDelegate::InformationList() << KFileItemDelegate::LocalPathOrUrl);
         } else {