]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
* get rid of magic values like QSize(20 + 5, 5)
[dolphin.git] / src / dolphinview.cpp
index b74cbea530eaf6ff25d9e734811d1d7cd2e15a2b..31b9de78591c53236c5a46118cec1907c8f0b187 100644 (file)
@@ -222,7 +222,11 @@ void DolphinView::setMode(Mode mode)
     }
 
     emit modeChanged();
+    
     updateZoomLevel(oldZoomLevel);
+    if (m_showPreview) {
+        loadDirectory(viewPropsUrl);
+    }
 }
 
 DolphinView::Mode DolphinView::mode() const
@@ -530,16 +534,25 @@ QString DolphinView::statusBarText() const
             ++it;
         }
         
-        const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
-        const QString filesText = i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount);
-        if ((folderCount > 0) && (fileCount > 0)) {
-            text = i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
-                         foldersText, filesText, KIO::convertSize(totalFileSize));
-        } else if (fileCount > 0) {
-            text = i18nc("@info:status files (size)", "%1 (%2)", filesText, KIO::convertSize(totalFileSize));
+        if (folderCount + fileCount == 1) {
+            // if only one item is selected, show the filename
+            const QString name = list.first().name();
+            text = (folderCount == 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name) :
+                                        i18nc("@info:status", "<filename>%1</filename> selected (%2)",
+                                              name, KIO::convertSize(totalFileSize));                                            
         } else {
-            Q_ASSERT(folderCount > 0);
-            text = foldersText;
+            // at least 2 items are selected
+            const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
+            const QString filesText = i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount);
+            if ((folderCount > 0) && (fileCount > 0)) {
+                text = i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
+                             foldersText, filesText, KIO::convertSize(totalFileSize));
+            } else if (fileCount > 0) {
+                text = i18nc("@info:status files (size)", "%1 (%2)", filesText, KIO::convertSize(totalFileSize));
+            } else {
+                Q_ASSERT(folderCount > 0);
+                text = foldersText;
+            }
         }
     } else {
         calculateItemCount(fileCount, folderCount, totalFileSize);
@@ -900,7 +913,7 @@ void DolphinView::dropUrls(const KFileItem& destItem,
                            const KUrl& destPath,
                            QDropEvent* event)
 {
-    DragAndDropHelper::dropUrls(destItem, destPath, event, this);
+    DragAndDropHelper::instance().dropUrls(destItem, destPath, event, this);
 }
 
 void DolphinView::updateSorting(DolphinView::Sorting sorting)
@@ -1292,6 +1305,10 @@ void DolphinView::deleteView()
         m_topLayout->removeWidget(view);
         view->close();
         
+        disconnect(view);
+        m_controller->disconnect(view);
+        view->disconnect();
+        
         bool deleteView = true;
         foreach (const QAbstractItemView* expandedView, m_expandedViews) {
             if (view == expandedView) {