From: Peter Penz Date: Sat, 14 Apr 2007 20:01:47 +0000 (+0000) Subject: Revert last commit and exchange it by a more straight forward solution: just check... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/4f6b9c72d35e7b4638cbc28df66ecbde0e903136 Revert last commit and exchange it by a more straight forward solution: just check the URL of the file item to find out whether the item is still part of the model. By this there is no need of keeping tracks for ongoing preview jobs. svn path=/trunk/KDE/kdebase/apps/; revision=653989 --- diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 47664da62..e450da339 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -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 diff --git a/src/dolphinview.h b/src/dolphinview.h index aacb5e178..f6b85f96b 100644 --- a/src/dolphinview.h +++ b/src/dolphinview.h @@ -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 m_cutItemsCache; };