diff --git a/src/panels/information/informationpanelcontent.h b/src/panels/information/informationpanelcontent.h --- a/src/panels/information/informationpanelcontent.h +++ b/src/panels/information/informationpanelcontent.h @@ -116,14 +116,6 @@ private: /** - * Checks whether the an URL is repesented by a place. If yes, - * then the place icon and name are shown instead of a preview. - * @return True, if the URL represents exactly a place. - * @param url The url to check. - */ - bool applyPlace(const QUrl& url); - - /** * Sets the text for the label \a m_nameLabel and assures that the * text is split in a way that it can be wrapped within the * label width (QLabel::setWordWrap() does not work if the diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -160,38 +160,36 @@ const QUrl itemUrl = item.url(); const bool isSearchUrl = itemUrl.scheme().contains(QStringLiteral("search")) && item.localPath().isEmpty(); - if (!applyPlace(itemUrl)) { - 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(); - } - - m_previewJob = new KIO::PreviewJob(KFileItemList() << item, QSize(m_preview->width(), m_preview->height())); - m_previewJob->setScaleType(KIO::PreviewJob::Unscaled); - m_previewJob->setIgnoreMaximumSize(item.isLocalFile()); - if (m_previewJob->uiDelegate()) { - KJobWidgets::setWindow(m_previewJob, this); - } + 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(); + } - connect(m_previewJob.data(), &KIO::PreviewJob::gotPreview, - this, &InformationPanelContent::showPreview); - connect(m_previewJob.data(), &KIO::PreviewJob::failed, - this, &InformationPanelContent::showIcon); + m_previewJob = new KIO::PreviewJob(KFileItemList() << item, QSize(m_preview->width(), m_preview->height())); + m_previewJob->setScaleType(KIO::PreviewJob::Unscaled); + m_previewJob->setIgnoreMaximumSize(item.isLocalFile()); + if (m_previewJob->uiDelegate()) { + KJobWidgets::setWindow(m_previewJob, this); } + + connect(m_previewJob.data(), &KIO::PreviewJob::gotPreview, + this, &InformationPanelContent::showPreview); + connect(m_previewJob.data(), &KIO::PreviewJob::failed, + this, &InformationPanelContent::showIcon); } if (m_metaDataWidget) { @@ -313,11 +311,9 @@ void InformationPanelContent::showIcon(const KFileItem& item) { m_outdatedPreviewTimer->stop(); - if (!applyPlace(item.targetUrl())) { - QPixmap pixmap = QIcon::fromTheme(item.iconName()).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous); - KIconLoader::global()->drawOverlays(item.overlays(), pixmap, KIconLoader::Desktop); - m_preview->setPixmap(pixmap); - } + QPixmap pixmap = QIcon::fromTheme(item.iconName()).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous); + KIconLoader::global()->drawOverlays(item.overlays(), pixmap, KIconLoader::Desktop); + m_preview->setPixmap(pixmap); } void InformationPanelContent::showPreview(const KFileItem& item, @@ -352,21 +348,6 @@ } } -bool InformationPanelContent::applyPlace(const QUrl& url) -{ - const int count = m_placesItemModel->count(); - for (int i = 0; i < count; ++i) { - const PlacesItem* item = m_placesItemModel->placesItem(i); - if (item->url().matches(url, QUrl::StripTrailingSlash)) { - setNameLabelText(item->text()); - m_preview->setPixmap(QIcon::fromTheme(item->icon()).pixmap(128, 128)); - return true; - } - } - - return false; -} - void InformationPanelContent::setNameLabelText(const QString& text) { QTextOption textOption;