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
This commit is contained in:
Peter Penz 2007-04-14 20:01:47 +00:00
parent e0bd6f137d
commit 4f6b9c72d3
2 changed files with 9 additions and 35 deletions

View 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

View 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;
};