┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/informationpanelcontent.cpp
diff options
context:
space:
mode:
authorNathaniel Graham <[email protected]>2018-04-02 16:52:08 -0600
committerNathaniel Graham <[email protected]>2018-04-03 16:39:32 -0600
commit993c47f30923e39b33dbd47a2a62e3dde5ccdbe4 (patch)
tree723e503e97c51eac55f78bb47b641beb4f265db9 /src/panels/information/informationpanelcontent.cpp
parenteab70b2ac4a8be16a05a015f973527686ed65ae7 (diff)
Show folder previews for items that have a Places Panel entry
Summary: informationpanelcontent.cpp currently has an explicit check for whether or not a URL has a Places panel entry, and if it does, no folder preview is generated. It's not clear why this is done, but it was reported as a bug: https://bugs.kde.org/show_bug.cgi?id=392621. Removing the logic fixes the bug. BUG: 392621 FIXED-IN: 18.08.0 Test Plan: Before: {F5782793} After: {F5782794} Detailed test procedure: - Open the Information Panel - Turn on previews - Put some pictures in ~/Pictures - Hover over it and see that the Information Panel shows a preview of its contents - Add ~/Pictures to the Places panel - Hover over it again and see that previews are no longer displayed - Apply the patch and restart Dolphin - Hover over it once more and see that there are now previews, yay! Reviewers: #dolphin, markg, elvisangelaccio Reviewed By: markg, elvisangelaccio Subscribers: markg, broulik Differential Revision: https://phabricator.kde.org/D11894
Diffstat (limited to 'src/panels/information/informationpanelcontent.cpp')
-rw-r--r--src/panels/information/informationpanelcontent.cpp79
1 files changed, 30 insertions, 49 deletions
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index f44a3feb7..5dcf8612e 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -160,38 +160,36 @@ void InformationPanelContent::showItem(const KFileItem& item)
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();
- }
+ 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...
- 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);
- }
+ // 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::configureSettings(const QList<QAction*>& customCon
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 @@ void InformationPanelContent::refreshMetaData()
}
}
-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;