]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
resize the pixmap in a smooth way instead of using a blending effect
[dolphin.git] / src / dolphinview.cpp
index b3148e7d95da97563038d1aa3bd86e2da4377ae0..e06bc72f279c784aff3d27f28419f9aec04d428c 100644 (file)
@@ -64,26 +64,26 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow,
                          const KUrl& url,
                          Mode mode,
                          bool showHiddenFiles) :
-        QWidget(parent),
-        m_showProgress(false),
-        m_blockContentsMovedSignal(false),
-        m_mode(mode),
-        m_iconSize(0),
-        m_folderCount(0),
-        m_fileCount(0),
-        m_mainWindow(mainWindow),
-        m_topLayout(0),
-        m_urlNavigator(0),
-        m_controller(0),
-        m_iconsView(0),
-        m_detailsView(0),
-        m_columnView(0),
-        m_fileItemDelegate(0),
-        m_filterBar(0),
-        m_statusBar(0),
-        m_dirModel(0),
-        m_dirLister(0),
-        m_proxyModel(0)
+    QWidget(parent),
+    m_showProgress(false),
+    m_blockContentsMovedSignal(false),
+    m_mode(mode),
+    m_iconSize(0),
+    m_folderCount(0),
+    m_fileCount(0),
+    m_mainWindow(mainWindow),
+    m_topLayout(0),
+    m_urlNavigator(0),
+    m_controller(0),
+    m_iconsView(0),
+    m_detailsView(0),
+    m_columnView(0),
+    m_fileItemDelegate(0),
+    m_filterBar(0),
+    m_statusBar(0),
+    m_dirModel(0),
+    m_dirLister(0),
+    m_proxyModel(0)
 {
     hide();
     setFocusPolicy(Qt::StrongFocus);
@@ -205,6 +205,14 @@ void DolphinView::setMode(Mode mode)
 
     m_mode = mode;
 
+    if (isColumnViewActive()) {
+        // When changing the mode in the column view, it makes sense
+        // to go back to the root URL of the column view automatically.
+        // Otherwise there it would not be possible to turn off the column view
+        // without focusing the first column.
+        setUrl(m_dirLister->url());
+    }
+
     ViewProperties props(m_urlNavigator->url());
     props.setViewMode(m_mode);
 
@@ -225,9 +233,9 @@ void DolphinView::setShowPreview(bool show)
     props.setShowPreview(show);
 
     m_controller->setShowPreview(show);
-
     emit showPreviewChanged();
-    reload();
+
+    startDirLister(m_urlNavigator->url(), true);
 }
 
 bool DolphinView::showPreview() const
@@ -243,12 +251,11 @@ void DolphinView::setShowHiddenFiles(bool show)
 
     ViewProperties props(m_urlNavigator->url());
     props.setShowHiddenFiles(show);
-    props.save();
 
     m_dirLister->setShowingDotFiles(show);
     emit showHiddenFilesChanged();
 
-    reload();
+    startDirLister(m_urlNavigator->url(), true);
 }
 
 bool DolphinView::showHiddenFiles() const
@@ -456,7 +463,7 @@ void DolphinView::setAdditionalInfo(KFileItemDelegate::AdditionalInformation inf
     m_fileItemDelegate->setAdditionalInformation(info);
 
     emit additionalInfoChanged(info);
-    reload();
+    startDirLister(m_urlNavigator->url(), true);
 }
 
 KFileItemDelegate::AdditionalInformation DolphinView::additionalInfo() const
@@ -583,7 +590,6 @@ void DolphinView::rename(const KUrl& source, const QString& newName)
 
         default:
             // the renaming operation has been canceled
-            reload();
             return;
         }
     } else {
@@ -601,7 +607,6 @@ void DolphinView::rename(const KUrl& source, const QString& newName)
     } else {
         m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.", source.fileName(), destFileName),
                                 DolphinStatusBar::Error);
-        reload();
     }
 }
 
@@ -804,6 +809,12 @@ void DolphinView::generatePreviews(const KFileItemList& items)
 void DolphinView::showPreview(const KFileItem* item, const QPixmap& pixmap)
 {
     Q_ASSERT(item != 0);
+    if (item->url().directory() != m_dirLister->url().path()) {
+        // the preview job is still working on items of an older URL, hence
+        // the item is not part of the directory model anymore
+        return;
+    }
+
     const QModelIndex idx = m_dirModel->indexForItem(*item);
     if (idx.isValid() && (idx.column() == 0)) {
         const QMimeData* mimeData = QApplication::clipboard()->mimeData();