]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge branch 'Applications/18.04'
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Thu, 5 Apr 2018 21:29:29 +0000 (23:29 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Thu, 5 Apr 2018 21:29:29 +0000 (23:29 +0200)
19 files changed:
CMakeLists.txt
doc/index.docbook
src/dolphinmainwindow.cpp
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodel.h
src/kitemviews/kfileitemmodelrolesupdater.cpp
src/kitemviews/kitemlistgroupheader.cpp
src/kitemviews/kitemliststyleoption.cpp
src/kitemviews/kitemliststyleoption.h
src/kitemviews/kitemlistview.cpp
src/kitemviews/kitemlistwidget.cpp
src/kitemviews/kstandarditemlistview.cpp
src/kitemviews/kstandarditemlistwidget.cpp
src/kitemviews/private/kbaloorolesprovider.cpp
src/panels/information/informationpanelcontent.cpp
src/panels/information/informationpanelcontent.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placespanel.cpp
src/tests/placesitemmodeltest.cpp

index 2ab2114c348c0a0734e7cc1648bda476969d14d8..c71790e52094cd1d8c3d606feb06da05f95092ac 100644 (file)
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.0)
 
 # KDE Application Version, managed by release script
 set (KDE_APPLICATIONS_VERSION_MAJOR "18")
-set (KDE_APPLICATIONS_VERSION_MINOR "03")
-set (KDE_APPLICATIONS_VERSION_MICRO "90")
+set (KDE_APPLICATIONS_VERSION_MINOR "07")
+set (KDE_APPLICATIONS_VERSION_MICRO "70")
 set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
 project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION})
 
index 44af99503fb301fd23e150a1533d85152259656d..c2ed2854f480a7f6dab47ad9f3b20455e46889db 100644 (file)
@@ -70,8 +70,8 @@
 
 <legalnotice>&FDLNotice;</legalnotice>
 
-<date>2016-06-01</date>
-<releaseinfo>Applications 16.04</releaseinfo>
+<date>2018-03-26</date>
+<releaseinfo>Applications 18.04</releaseinfo>
 
 <abstract>
 <para>
@@ -281,6 +281,9 @@ the toolbar can be used to navigate in the history.
 </mediaobject>
 </screenshot>
 
+<para>If you click with the &MMB; the item in the history is opened in a new tab
+thus keeping the current tab with its content.
+</para>
 </sect2>
 
 <sect2 id="dolphin-view-appearance">
@@ -359,8 +362,8 @@ The details view allows you to view the current folder
 in a tree-like fashion if <link linkend="preferences-dialog-viewmodes-details">
 <guilabel>Expandable folders</guilabel></link> are enabled:
 Each subfolder of the current folder can be
-<quote>expanded</quote> or <quote>collapsed</quote> by clicking on the <guiicon>+</guiicon>
-or <guiicon>-</guiicon> icon next to it.</para></listitem>
+<quote>expanded</quote> or <quote>collapsed</quote> by clicking on the <guiicon>></guiicon>
+or <guiicon>v</guiicon> icon next to it.</para></listitem>
 </itemizedlist>
 </para>
 
@@ -723,7 +726,7 @@ over with the mouse, including size, type, and date of last modification. It als
 features a large preview of the selected item and allows you to assign a rating,
 tags, and comments to it.
 </para>
-
+<!--FIXME panel context menu-->
 </sect2>
 
 <sect2 id="folders-panel">
@@ -733,9 +736,10 @@ tags, and comments to it.
 The <guilabel>Folders</guilabel> panel shows a tree view structure of the file
 system. It only shows folders. Clicking a folder with the &LMB; opens this folder
 in the &dolphin; view.
-
 </para>
-
+<para>Use <guilabel>Limit to Home Directory</guilabel> to hide all folders from
+the tree view except your <guilabel>Home</guilabel>.
+</para>
 </sect2>
 
 <sect2 id="terminal-panel">
@@ -803,10 +807,6 @@ a KIOSlave is launched to provide the search results.</para>
 <para>The option from <guilabel>Everywhere</guilabel> with activated Baloo 
 services searches in all indexed folders, without Baloo this option  
 starts the search from the user's <replaceable>Home</replaceable> folder.</para>
-<!--FIXME 16.12
-https://git.reviewboard.kde.org/r/123883/
-Add prototype of a "More search tools..." button
--->
 <screenshot>
 <screeninfo>Search with More Options</screeninfo>
 <mediaobject>
@@ -832,6 +832,14 @@ the user to shrink the number of search results.</para>
 together with the <guilabel>Filter</guilabel> bar to find files using Baloo or limit 
 the search to files matching the filter expression.</para>
 
+<para>Use the Save icon to save a search to the <guilabel>Search For</guilabel>
+section in the <guilabel>Places</guilabel> panel to quickly access it again in the future.
+</para>
+<!--FIXME 16.12
+https://git.reviewboard.kde.org/r/123883/
+Add prototype of a "More search tools..." button
+-->
+
 </sect2>
 
 <sect2 id="mounting-storage-media">
@@ -856,7 +864,7 @@ in the menu, &eg; <guimenuitem>Undo: Rename</guimenuitem>.
 </para>
 
 </sect2>
-
+<!-- FIXME https://phabricator.kde.org/D10698-->
 <sect2 id="batch-rename">
 <title>Renaming A Batch Of Files</title>
 <para>
@@ -864,7 +872,7 @@ in the menu, &eg; <guimenuitem>Undo: Rename</guimenuitem>.
 will have the file name specified, including a number, &eg;, Image1.jpg,
 Image2.jpg, Image3.jpg. This can be useful, &eg;, for pictures taken with a digital camera.
 </para>
-
+<!--double click-->
 <para>
 If you wish to rename a batch of files, first select the files to be renamed.
 This can be done by pressing the &LMB; and drawing a rectangle around the files
@@ -1024,6 +1032,10 @@ startup or not. See the <link linkend="filter-files">section on the filter bar</
 for details.
 </para></listitem>
 
+<listitem><para>
+<guilabel>Show full path in title bar</guilabel> makes it easy to distinguish
+between files or folders with the same name in different folders.
+</para></listitem>
 </itemizedlist>
 
 </para>
@@ -1325,6 +1337,10 @@ Enable <guilabel>Rename inline</guilabel> to use this mode if only one item is c
 If this option is disabled or several items are selected, a dialog will be displayed for renaming.
 </para></listitem>
 
+<listitem><para><guilabel>Use tab for switching between left and right split view</guilabel>
+allows to switch without using the mouse.
+</para></listitem>
+
 </itemizedlist>
 
 </para>
@@ -1353,8 +1369,8 @@ are shown before potentially harmful actions .
 <warning><para>The confirmation settings for <guilabel>Moving files or folders to trash</guilabel> and
 <guilabel>Deleting files or folders</guilabel> affect file operations in &dolphin;, &konqueror;, 
 <application>Gwenview</application> and all &kde; applications using the default &kde; file dialog, 
-whereas <guilabel>Closing Dolphin windows 
-  with multiple tabs</guilabel> is a &dolphin; <!--and &konqueror;--> specific setting.</para></warning>
+whereas <guilabel>Closing Dolphin windows
+with multiple tabs</guilabel> is a &dolphin; specific setting.</para></warning>
 </sect3>
 
 <sect3 id="preferences-dialog-general-statusbar">
@@ -1575,6 +1591,15 @@ trash.</action></para></listitem>
 to the trash and cannot be restored.</action></para></listitem>
 </varlistentry>
 
+<varlistentry>
+<term><menuchoice>
+<guimenu>File</guimenu>
+<guimenuitem>Show Target</guimenuitem>
+</menuchoice></term>
+<listitem><para>This action highlights a link target in a new &dolphin; window.
+</para></listitem>
+</varlistentry>
+
 <varlistentry>
 <term><menuchoice>
 <shortcut>
@@ -1786,7 +1811,8 @@ current folder grouped by the option selected in <guimenuitem>Sort By</guimenuit
 <guimenuitem>Hidden Files</guimenuitem>
 </menuchoice></term>
 <listitem><para><action>Shows all the hidden files and sub-folders within the current
-folder.</action></para></listitem>
+folder.</action>There is an alternate shortcut <keycombo action="simul">&Ctrl;<keycap>H</keycap></keycombo>
+for this action.</para></listitem>
 </varlistentry>
 
 <varlistentry>
@@ -1954,7 +1980,9 @@ be reopened.</action></para></listitem>
 <guimenu>Tools</guimenu>
 <guimenuitem>Show Filter Bar</guimenuitem>
 </menuchoice></term>
-<listitem><para><action>Enables and disables the <link linkend="filter-files">filter bar</link>.</action></para></listitem>
+<listitem><para><action>Enables and disables the <link linkend="filter-files">filter bar</link>.</action>
+You can also use the alternate shortcut <keycombo action="simul">&Shift;<keycap>/</keycap></keycombo>
+for this action.</para></listitem>
 </varlistentry>
 
 <varlistentry>
index d112007bc542a66fc654f2cc973473c0c8cf7125..65c57ef7d242af69699f7f9c6fcd1e06511c5719 100644 (file)
@@ -48,6 +48,7 @@
 #include <KActionMenu>
 #include <KAuthorized>
 #include <KConfig>
+#include <KDesktopFile>
 #include <KFileItemListProperties>
 #include <KFilePlacesModel>
 #include <KHelpMenu>
@@ -402,7 +403,8 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
         dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
         dialog->setModal(true);
         QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
-        KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit());
+        KDesktopFile dolphinDesktopFile(QStringLiteral("%1.desktop").arg(QGuiApplication::desktopFileName()));
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KGuiItem(i18nc("@action:button 'Quit Dolphin' button", "&Quit %1", dolphinDesktopFile.readName()), QIcon::fromTheme(QStringLiteral("application-exit"))));
         KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close"))));
         KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
         buttons->button(QDialogButtonBox::Yes)->setDefault(true);
index b6a0016428a2110ce443e78e113e96784edfc408..844954d6a3e8883239190213f7b4c16f60cf8d81 100644 (file)
@@ -1846,16 +1846,10 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
         break;
     }
 
-    case RatingRole: {
-        result = a->values.value("rating").toInt() - b->values.value("rating").toInt();
-        break;
-    }
-
-    case ImageSizeRole: {
-        // Alway use a natural comparing to interpret the numbers of a string like
-        // "1600 x 1200" for having a correct sorting.
-        result = collator.compare(a->values.value("imageSize").toString(),
-                                  b->values.value("imageSize").toString());
+    case RatingRole:
+    case WidthRole:
+    case HeightRole: {
+        result = a->values.value(roleForType(m_sortRole)).toInt() - b->values.value(roleForType(m_sortRole)).toInt();
         break;
     }
 
@@ -2305,7 +2299,8 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count)
         { "wordCount",   WordCountRole,   I18N_NOOP2_NOSTRIP("@label", "Word Count"),       I18N_NOOP2_NOSTRIP("@label", "Document"), true,  true  },
         { "lineCount",   LineCountRole,   I18N_NOOP2_NOSTRIP("@label", "Line Count"),       I18N_NOOP2_NOSTRIP("@label", "Document"), true,  true  },
         { "imageDateTime",   ImageDateTimeRole,   I18N_NOOP2_NOSTRIP("@label", "Date Photographed"),       I18N_NOOP2_NOSTRIP("@label", "Image"),    true,  true  },
-        { "imageSize",   ImageSizeRole,   I18N_NOOP2_NOSTRIP("@label", "Image Size"),       I18N_NOOP2_NOSTRIP("@label", "Image"),    true,  true  },
+        { "width",       WidthRole,       I18N_NOOP2_NOSTRIP("@label", "Width"),            I18N_NOOP2_NOSTRIP("@label", "Image"),    true,  true  },
+        { "height",      HeightRole,      I18N_NOOP2_NOSTRIP("@label", "Height"),           I18N_NOOP2_NOSTRIP("@label", "Image"),    true,  true  },
         { "orientation", OrientationRole, I18N_NOOP2_NOSTRIP("@label", "Orientation"),      I18N_NOOP2_NOSTRIP("@label", "Image"),    true,  true  },
         { "artist",      ArtistRole,      I18N_NOOP2_NOSTRIP("@label", "Artist"),           I18N_NOOP2_NOSTRIP("@label", "Audio"),    true,  true  },
         { "genre",       GenreRole,       I18N_NOOP2_NOSTRIP("@label", "Genre"),            I18N_NOOP2_NOSTRIP("@label", "Audio"),    true,  true  },
index 75953f0b7e8ed303c92f4826870377f4fa212ac3..134c50245c897318467bdb4f2a21e5297b1f88d9 100644 (file)
@@ -286,7 +286,7 @@ private:
         NoRole, NameRole, SizeRole, ModificationTimeRole, CreationTimeRole, AccessTimeRole, PermissionsRole, OwnerRole,
         GroupRole, TypeRole, DestinationRole, PathRole, DeletionTimeRole,
         // User visible roles available with Baloo:
-        CommentRole, TagsRole, RatingRole, ImageSizeRole, ImageDateTimeRole, OrientationRole,
+        CommentRole, TagsRole, RatingRole, WidthRole, HeightRole, ImageDateTimeRole, OrientationRole,
         WordCountRole, TitleRole, LineCountRole, ArtistRole, GenreRole, AlbumRole, DurationRole, TrackRole, ReleaseYearRole,
         BitrateRole, OriginUrlRole,
         // Non-visible roles:
index 6c96a08d164c9914938d1b193d9b9dffeb2d28a2..544d88040c8a52246b306b5e9487ee922add2362 100644 (file)
@@ -497,7 +497,7 @@ void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPi
 
     const QString mimeType = item.mimetype();
     const int slashIndex = mimeType.indexOf(QLatin1Char('/'));
-    const bool isFontPreview = mimeType.right(slashIndex).contains(QLatin1String("font"));
+    const bool isFontPreview = mimeType.rightRef(slashIndex).contains(QLatin1String("font"));
     const bool isFolderPreview = item.isDir();
     const bool isWindowsExePreview = mimeType == QLatin1String("application/x-ms-dos-executable") ||
                                      mimeType == QLatin1String("application/x-msdownload");
index fb92989894243f1ef5c6103ee391c3831a698d7e..06a32484aabf3e1be09aeb96713cbd4d99336b63 100644 (file)
@@ -78,6 +78,10 @@ QVariant KItemListGroupHeader::data() const
 
 void KItemListGroupHeader::setStyleOption(const KItemListStyleOption& option)
 {
+    if (m_styleOption == option) {
+        return;
+    }
+
     const KItemListStyleOption previous = m_styleOption;
     m_styleOption = option;
     m_dirtyCache = true;
index 1ebcad141509fc499bc01211c7bc2f98f1b17aa3..bcfb86064b39182175d0234ed5d414efb87e4d49 100644 (file)
@@ -53,3 +53,23 @@ KItemListStyleOption::KItemListStyleOption(const KItemListStyleOption& other) :
 KItemListStyleOption::~KItemListStyleOption()
 {
 }
+
+bool KItemListStyleOption::operator==(const KItemListStyleOption& other) const
+{
+    return rect == other.rect
+            && font == other.font
+            && fontMetrics == other.fontMetrics
+            && palette == other.palette
+            && padding == other.padding
+            && horizontalMargin == other.horizontalMargin
+            && verticalMargin == other.verticalMargin
+            && iconSize == other.iconSize
+            && extendedSelectionRegion == other.extendedSelectionRegion
+            && maxTextLines == other.maxTextLines
+            && maxTextWidth == other.maxTextWidth;
+}
+
+bool KItemListStyleOption::operator!=(const KItemListStyleOption& other) const
+{
+    return !(*this == other);
+}
index 09b787c27d272d71b70f7d3b7d3b3e8c77dbdfcb..93aafac1f53a9b3c027c97f0f68c47f572ec2eb8 100644 (file)
@@ -45,6 +45,11 @@ public:
     bool extendedSelectionRegion;
     int maxTextLines;
     int maxTextWidth;
+
+    bool operator==(const KItemListStyleOption& other) const;
+    bool operator!=(const KItemListStyleOption& other) const;
+
+
 };
 #endif
 
index 489c6f9b69f44522670b946fb72c74f7d886cbe6..f0647fb3eac23fc922532e447a4f20c541cbe3c1 100644 (file)
@@ -752,6 +752,10 @@ void KItemListView::setItemSize(const QSizeF& size)
 
 void KItemListView::setStyleOption(const KItemListStyleOption& option)
 {
+    if (m_styleOption == option) {
+        return;
+    }
+
     const KItemListStyleOption previousOption = m_styleOption;
     m_styleOption = option;
 
index 61dd7256eb98b7e9ac7f61b4981ea52b8f32edf7..28b374620c38ff7fe1122164f8011756a4489faa 100644 (file)
@@ -191,10 +191,13 @@ qreal KItemListWidget::columnWidth(const QByteArray& role) const
 
 void KItemListWidget::setStyleOption(const KItemListStyleOption& option)
 {
+    if (m_styleOption == option) {
+        return;
+    }
+
     const KItemListStyleOption previous = m_styleOption;
     clearHoverCache();
     m_styleOption = option;
-
     styleOptionChanged(option, previous);
     update();
 }
index ee1c061036f7a10c6b90183923a546fc57759f4e..929ee1da80a2db5b56cb589a46b09c876a9362bf 100644 (file)
@@ -146,27 +146,20 @@ void KStandardItemListView::applyDefaultStyleOption(int iconSize,
 {
     KItemListStyleOption option = styleOption();
 
-    bool changed = false;
     if (option.iconSize < 0) {
         option.iconSize = iconSize;
-        changed = true;
     }
     if (option.padding < 0) {
         option.padding = padding;
-        changed = true;
     }
     if (option.horizontalMargin < 0) {
         option.horizontalMargin = horizontalMargin;
-        changed = true;
     }
     if (option.verticalMargin < 0) {
         option.verticalMargin = verticalMargin;
-        changed = true;
     }
 
-    if (changed) {
-        setStyleOption(option);
-    }
+    setStyleOption(option);
 }
 
 void KStandardItemListView::updateLayoutOfVisibleItems()
index 1aca250dd8a46fae60ab06daa5fe22999c292405..bc3bb29de94daf12b115fd18b1579d69ccaa60f9 100644 (file)
@@ -1015,15 +1015,21 @@ void KStandardItemListWidget::updatePixmapCache()
 
     if (iconOnTop) {
         // Center horizontally and align on bottom within the icon-area
-        m_pixmapPos.setX((widgetSize.width() - m_scaledPixmapSize.width()) / 2);
+        m_pixmapPos.setX((widgetSize.width() - m_scaledPixmapSize.width()) / 2.0);
         m_pixmapPos.setY(padding + scaledIconSize - m_scaledPixmapSize.height());
     } else {
         // Center horizontally and vertically within the icon-area
         const TextInfo* textInfo = m_textInfo.value("text");
-        m_pixmapPos.setX(textInfo->pos.x() - 2 * padding
-                         - (scaledIconSize + m_scaledPixmapSize.width()) / 2);
-        m_pixmapPos.setY(padding
-                         + (scaledIconSize - m_scaledPixmapSize.height()) / 2);
+        m_pixmapPos.setX(textInfo->pos.x() - 2.0 * padding
+                      - (scaledIconSize + m_scaledPixmapSize.width()) / 2.0);
+
+        // Derive icon's vertical center from the center of the text frame, including
+        // any necessary adjustment if the font's midline is offset from the frame center
+        const qreal midlineShift = m_customizedFontMetrics.height() / 2.0
+                    - m_customizedFontMetrics.descent()
+                    - m_customizedFontMetrics.capHeight() / 2.0;
+        m_pixmapPos.setY(m_textRect.center().y() + midlineShift - m_scaledPixmapSize.height() / 2.0);
+
     }
 
     m_iconRect = QRectF(m_pixmapPos, QSizeF(m_scaledPixmapSize));
index bbd0927f21ef639f9371e568d2e9083ffce63651..3d3923b1b761125c83c6b96ed03ae1a06664344a 100644 (file)
@@ -56,9 +56,6 @@ QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const Baloo::File& f
 {
     QHash<QByteArray, QVariant> values;
 
-    int width = -1;
-    int height = -1;
-
     QMapIterator<KFileMetaData::Property::Property, QVariant> it(file.properties());
     while (it.hasNext()) {
         it.next();
@@ -72,23 +69,7 @@ QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const Baloo::File& f
 
         const QVariant value = it.value();
 
-        if (role == "imageSize") {
-            // Merge the two properties for width and height
-            // as one string into the "imageSize" role
-            if (property == QLatin1String("width")) {
-                width = value.toInt();
-            }
-            else if (property == QLatin1String("height")) {
-                height = value.toInt();
-            }
-
-            if (width >= 0 && height >= 0) {
-                QString widthAndHeight = QString::number(width);
-                widthAndHeight += QLatin1String(" x ");
-                widthAndHeight += QString::number(height);
-                values.insert(role, widthAndHeight);
-            }
-        } else if (role == "orientation") {
+        if (role == "orientation") {
             const QString orientation = orientationFromValue(value.toInt());
             values.insert(role, orientation);
         } else if (role == "duration") {
@@ -135,8 +116,7 @@ KBalooRolesProvider::KBalooRolesProvider() :
     };
 
     // Mapping from the URIs to the KFileItemModel roles. Note that this must not be
-    // a 1:1 mapping: One role may contain several URI-values (e.g. the URIs for height and
-    // width of an image are mapped to the role "imageSize")
+    // a 1:1 mapping: One role may contain several URI-values
     static const PropertyInfo propertyInfoList[] = {
         { "rating", "rating" },
         { "tag",        "tags" },
@@ -144,8 +124,8 @@ KBalooRolesProvider::KBalooRolesProvider() :
         { "title",         "title" },
         { "wordCount",     "wordCount" },
         { "lineCount",     "lineCount" },
-        { "width",         "imageSize" },
-        { "height",        "imageSize" },
+        { "width",         "width" },
+        { "height",        "height" },
         { "imageDateTime",   "imageDateTime"},
         { "nexif.orientation", "orientation", },
         { "artist",     "artist" },
index f44a3feb764050d24cabc95fa38a65fbbb2ad01f..5dcf8612efcba68c486f92afc42029de1197b0de 100644 (file)
@@ -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();
-            }
-
-            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::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;
index 80f3c8e22a09a114d1e9814b875d1159df68e872..9223fcc5a2c722f4300b1c07cfc0503dbc94da60 100644 (file)
@@ -115,14 +115,6 @@ private slots:
     void refreshMetaData();
 
 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
index 444ad29eaba6ad51290c8e03e3aba1ab03fa3494..1270d2473146ca7d6e0b5a8bb0d062bf012f1a10 100644 (file)
@@ -456,7 +456,7 @@ void PlacesItemModel::initializeDefaultViewProperties() const
                 } else if (path == QLatin1String("/images")) {
                     props.setViewMode(DolphinView::IconsView);
                     props.setPreviewsShown(true);
-                    props.setVisibleRoles({"text", "imageSize"});
+                    props.setVisibleRoles({"text", "height", "width"});
                 } else if (path == QLatin1String("/audio")) {
                     props.setViewMode(DolphinView::DetailsView);
                     props.setPreviewsShown(false);
@@ -600,7 +600,8 @@ void PlacesItemModel::onSourceModelDataChanged(const QModelIndex &topLeft, const
 
 void PlacesItemModel::onSourceModelGroupHiddenChanged(KFilePlacesModel::GroupType group, bool hidden)
 {
-    for(const QModelIndex &sourceIndex : m_sourceModel->groupIndexes(group)) {
+    const auto groupIndexes = m_sourceModel->groupIndexes(group);
+    for (const QModelIndex &sourceIndex : groupIndexes) {
         PlacesItem *item = placesItem(mapFromSource(sourceIndex));
         if (item) {
             item->setGroupHidden(hidden);
index 1f81a1eaa9977c170e46f61f5399cb7da031e326..00d8735c39020edb929c5947382f5119f5f3565b 100644 (file)
@@ -291,7 +291,7 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
         {KIconLoader::SizeLarge,        I18N_NOOP2_NOSTRIP("Huge icon size", "Huge (%1x%2)")}
     };
 
-    QMap<QAction*, int> iconSizeActionMap;
+    QHash<QAction*, int> iconSizeActionMap;
     QActionGroup* iconSizeGroup = new QActionGroup(iconSizeSubMenu);
 
     for (int i = 0; i < iconSizeCount; ++i) {
index 3263537f9e9c36320b28f053fde09cd1defbed28..fc21ce055f9c0d46c0ae59e4a088f6ab489b6aea 100644 (file)
@@ -228,7 +228,8 @@ void PlacesItemModelTest::init()
 
 void PlacesItemModelTest::cleanup()
 {
-    for (int i : m_tobeRemoved) {
+    const auto tobeRemoved = m_tobeRemoved;
+    for (const int i : tobeRemoved) {
         int before = m_model->count();
         m_model->deleteItem(i);
         QTRY_COMPARE(m_model->count(), before - 1);