- m_pendingPreview = false;
-
- const KUrl itemUrl = item.url();
- const bool isNepomukSearchUrl = itemUrl.protocol().startsWith("nepomuk") && item.nepomukUri().isEmpty();
- if (!applyPlace(itemUrl)) {
- setNameLabelText(item.text());
- if (isNepomukSearchUrl) {
- // in the case of a Nepomuk query-URL the URL is not readable for humans
- // (at least not useful to show in the Information Panel)
- KIconLoader iconLoader;
- QPixmap icon = iconLoader.loadIcon("nepomuk",
- KIconLoader::NoGroup,
- KIconLoader::SizeEnormous);
- m_preview->setPixmap(icon);
- } else {
- // try to get a preview pixmap from the item...
- m_pendingPreview = true;
-
- // Mark the currently shown preview as outdated. This is done
- // with a small delay to prevent a flickering when the next preview
- // can be shown within a short timeframe. This timer is not started
- // for directories, as directory previews might fail and return the
- // same icon.
- if (!item.isDir()) {
- m_outdatedPreviewTimer->start();
- }
+ // If there is a preview job, kill it to prevent that we have jobs for
+ // multiple items running, and thus a race condition (bug 250787).
+ if (m_previewJob) {
+ m_previewJob->kill();
+ }
+
+ const QUrl itemUrl = item.url();
+ const bool isSearchUrl = itemUrl.scheme().contains(QStringLiteral("search")) && item.localPath().isEmpty();
+ setNameLabelText(item.text());
+ if (isSearchUrl) {
+ // in the case of a search-URL the URL is not readable for humans
+ // (at least not useful to show in the Information Panel)
+ m_preview->setPixmap(
+ QIcon::fromTheme(QStringLiteral("nepomuk")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous)
+ );
+ } else {
+ // try to get a preview pixmap from the item...
+
+ // Mark the currently shown preview as outdated. This is done
+ // with a small delay to prevent a flickering when the next preview
+ // can be shown within a short timeframe. This timer is not started
+ // for directories, as directory previews might fail and return the
+ // same icon.
+ if (!item.isDir()) {
+ m_outdatedPreviewTimer->start();
+ }