]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Revert last commit and exchange it by a more straight forward solution: just check...
authorPeter Penz <peter.penz19@gmail.com>
Sat, 14 Apr 2007 20:01:47 +0000 (20:01 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 14 Apr 2007 20:01:47 +0000 (20:01 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=653989

src/dolphinview.cpp
src/dolphinview.h

index 47664da62f600b59f8deb3a2131187717edb1b0d..e450da3395b0096cc08c4e27bfa88ea96229d793 100644 (file)
@@ -83,8 +83,7 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow,
     m_statusBar(0),
     m_dirModel(0),
     m_dirLister(0),
-    m_proxyModel(0),
-    m_previewJob(0)
+    m_proxyModel(0)
 {
     hide();
     setFocusPolicy(Qt::StrongFocus);
@@ -178,11 +177,6 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow,
 
 DolphinView::~DolphinView()
 {
-    if (m_previewJob != 0) {
-        m_previewJob->doKill();
-        m_previewJob = 0;
-    }
-
     delete m_dirLister;
     m_dirLister = 0;
 }
@@ -802,20 +796,21 @@ void DolphinView::updateItemCount()
 void DolphinView::generatePreviews(const KFileItemList& items)
 {
     if (m_controller->showPreview()) {
-        if (m_previewJob != 0) {
-            m_previewJob->doKill();
-        }
-        m_previewJob = KIO::filePreview(items, 128);
-        connect(m_previewJob, SIGNAL(gotPreview(const KFileItem*, const QPixmap&)),
+        KIO::PreviewJob* job = KIO::filePreview(items, 128);
+        connect(job, SIGNAL(gotPreview(const KFileItem*, const QPixmap&)),
                 this, SLOT(showPreview(const KFileItem*, const QPixmap&)));
-        connect(m_previewJob, SIGNAL(result(KJob*)),
-                this, SLOT(slotPreviewResult(KJob*)));
     }
 }
 
 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();
@@ -890,11 +885,6 @@ void DolphinView::startDirLister(const KUrl& url, bool reload)
     m_blockContentsMovedSignal = true;
     m_dirLister->stop();
 
-    if (m_previewJob != 0) {
-        m_previewJob->doKill();
-        m_previewJob = 0;
-    }
-
     bool openDir = true;
     bool keepOldDirs = isColumnViewActive();
     if (keepOldDirs) {
@@ -1163,12 +1153,6 @@ void DolphinView::updateCutItems()
     applyCutItemEffect();
 }
 
-void DolphinView::slotPreviewResult(KJob* job)
-{
-    Q_UNUSED(job);
-    m_previewJob = 0;
-}
-
 void DolphinView::createView()
 {
     // delete current view
index aacb5e1787efe9cdffe072334b6075422afec899..f6b85f96b74e9cee4d9abdb2a889328934d7f39f 100644 (file)
@@ -54,11 +54,6 @@ class QPainter;
 class QTimer;
 class ViewProperties;
 
-namespace KIO
-{
-    class PreviewJob;
-}
-
 /**
  * @short Represents a view for the directory content
  *        including the navigation bar, filter bar and status bar.
@@ -526,9 +521,6 @@ private slots:
     /** Applies an item effect to all cut items of the clipboard. */
     void updateCutItems();
 
-    /** Is invoked when the preview job has been finished. */
-    void slotPreviewResult(KJob* job);
-
 private:
     void startDirLister(const KUrl& url, bool reload = false);
 
@@ -623,8 +615,6 @@ private:
     DolphinDirLister* m_dirLister;
     DolphinSortFilterProxyModel* m_proxyModel;
 
-    KIO::PreviewJob* m_previewJob;
-
     QList<CutItem> m_cutItemsCache;
 };