diff options
| author | Peter Penz <[email protected]> | 2007-04-14 20:01:47 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-04-14 20:01:47 +0000 |
| commit | 4f6b9c72d35e7b4638cbc28df66ecbde0e903136 (patch) | |
| tree | ad49a19356d3ed1ff0fb19ffe32cd589d261325b /src/dolphinview.cpp | |
| parent | e0bd6f137d90fea9854427f57f8945ecf38991eb (diff) | |
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
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 34 |
1 files changed, 9 insertions, 25 deletions
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 |
