only resolve the MIME-types asynchronously, if no preview is generated

CCMAIL: faure@kde.org
CCMAIL: ereslibre@kde.org

svn path=/trunk/KDE/kdebase/apps/; revision=819162
This commit is contained in:
Peter Penz 2008-06-10 18:38:28 +00:00
parent 82416aa5a5
commit 929b3c99c9
4 changed files with 15 additions and 3 deletions

View file

@ -37,7 +37,6 @@
#include <kio/previewjob.h>
#include <kiconeffect.h>
#include <kjob.h>
#include <kmimetyperesolver.h>
#include <konqmimedata.h>
#include "iconmanager.h"
@ -133,7 +132,6 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
m_selectionManager, SLOT(reset()));
}
new KMimeTypeResolver(this, m_dolphinModel);
m_iconManager = new IconManager(this, m_proxyModel);
m_iconManager->setShowPreview(m_view->m_controller->dolphinView()->showPreview());

View file

@ -1125,7 +1125,6 @@ void DolphinView::createView()
view->setSelectionMode(QAbstractItemView::ExtendedSelection);
new KMimeTypeResolver(view, m_dolphinModel);
m_iconManager = new IconManager(view, m_proxyModel);
m_iconManager->setShowPreview(m_showPreview);

View file

@ -25,6 +25,7 @@
#include <kiconeffect.h>
#include <kio/previewjob.h>
#include <kdirlister.h>
#include <kmimetyperesolver.h>
#include <konqmimedata.h>
#include <QApplication>
@ -45,6 +46,7 @@ IconManager::IconManager(QAbstractItemView* parent, DolphinSortFilterProxyModel*
m_previewJobs(),
m_dolphinModel(0),
m_proxyModel(model),
m_mimeTypeResolver(0),
m_cutItemsCache(),
m_previews(),
m_pendingItems(),
@ -97,6 +99,16 @@ void IconManager::setShowPreview(bool show)
updatePreviews();
}
}
if (show && (m_mimeTypeResolver != 0)) {
// don't resolve the MIME types if the preview is turned on
m_mimeTypeResolver->deleteLater();
m_mimeTypeResolver = 0;
} else if (!show && (m_mimeTypeResolver == 0)) {
// the preview is turned off: resolve the MIME-types so that
// the icons gets updated
m_mimeTypeResolver = new KMimeTypeResolver(m_view, m_dolphinModel);
}
}
void IconManager::updatePreviews()

View file

@ -30,6 +30,7 @@
class DolphinModel;
class DolphinSortFilterProxyModel;
class KJob;
class KMimeTypeResolver;
class QAbstractItemView;
/**
@ -166,6 +167,8 @@ private:
DolphinModel* m_dolphinModel;
DolphinSortFilterProxyModel* m_proxyModel;
KMimeTypeResolver* m_mimeTypeResolver;
QList<ItemInfo> m_cutItemsCache;
QList<ItemInfo> m_previews;