]> cloud.milkyroute.net Git - dolphin.git/commitdiff
panels/information: Add option to not show information for hovered item
authorOliver Beard <olib141@outlook.com>
Sun, 5 Feb 2023 20:34:50 +0000 (20:34 +0000)
committerOliver Beard <olib141@outlook.com>
Sat, 25 Mar 2023 10:01:52 +0000 (10:01 +0000)
BUG: 364956
BUG: 453211

src/panels/information/dolphin_informationpanelsettings.kcfg
src/panels/information/informationpanel.cpp

index 7a5d29728f4c5e3cb4776fe91a647f9dae763b1b..0f34e731055e6ec9ec3b2ac56fd9c950346d6bdc 100644 (file)
             <label>Auto-Play media files</label>
             <default>false</default>
         </entry>
+        <entry name="showHovered" type="Bool">
+            <label>Show item on hover</label>
+            <default>true</default>
+        </entry>
         <entry name="dateFormat" type="Enum">
             <label>Date display format</label>
             <choices>
index a0dff0d5e25adacc97c3c6055ce980e45c3eb862..6060e2d8c8ce7da570ee63d922e482c2e639dcef 100644 (file)
@@ -62,13 +62,13 @@ void InformationPanel::setSelection(const KFileItemList &selection)
         if ((count == 1) && !selection.first().url().isEmpty()) {
             m_urlCandidate = selection.first().url();
         }
-        m_infoTimer->start();
+        showItemInfo();
     }
 }
 
 void InformationPanel::requestDelayedItemInfo(const KFileItem &item)
 {
-    if (!isVisible()) {
+    if (!isVisible() || !InformationPanelSettings::showHovered()) {
         return;
     }
 
@@ -160,6 +160,11 @@ void InformationPanel::showContextMenu(const QPoint &pos)
     previewAutoPlayAction->setCheckable(true);
     previewAutoPlayAction->setChecked(InformationPanelSettings::previewsAutoPlay());
 
+    QAction *showHoveredAction = popup.addAction(i18nc("@action:inmenu", "Show item on hover"));
+    showHoveredAction->setIcon(QIcon::fromTheme(QStringLiteral("followmouse")));
+    showHoveredAction->setCheckable(true);
+    showHoveredAction->setChecked(InformationPanelSettings::showHovered());
+
     QAction *configureAction = popup.addAction(i18nc("@action:inmenu", "Configure..."));
     configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
     if (m_inConfigurationMode) {
@@ -188,18 +193,23 @@ void InformationPanel::showContextMenu(const QPoint &pos)
     if (action == previewAction) {
         InformationPanelSettings::setPreviewsShown(isChecked);
         m_content->refreshPreview();
+    } else if (action == previewAutoPlayAction) {
+        InformationPanelSettings::setPreviewsAutoPlay(isChecked);
+        m_content->setPreviewAutoPlay(isChecked);
+    } else if (action == showHoveredAction) {
+        InformationPanelSettings::setShowHovered(isChecked);
+        if (!isChecked) {
+            m_hoveredItem = KFileItem();
+            showItemInfo();
+        }
     } else if (action == configureAction) {
         m_inConfigurationMode = true;
         m_content->configureShownProperties();
-    }
-    if (action == dateformatAction) {
+    } else if (action == dateformatAction) {
         int dateFormat = static_cast<int>(isChecked ? Baloo::DateFormats::ShortFormat : Baloo::DateFormats::LongFormat);
 
         InformationPanelSettings::setDateFormat(dateFormat);
         m_content->refreshMetaData();
-    } else if (action == previewAutoPlayAction) {
-        InformationPanelSettings::setPreviewsAutoPlay(isChecked);
-        m_content->setPreviewAutoPlay(isChecked);
     }
 }
 
@@ -218,7 +228,7 @@ void InformationPanel::showItemInfo()
     } else {
         // The information for exactly one item should be shown
         KFileItem item;
-        if (!m_hoveredItem.isNull()) {
+        if (!m_hoveredItem.isNull() && InformationPanelSettings::showHovered()) {
             item = m_hoveredItem;
         } else if (!m_selection.isEmpty()) {
             Q_ASSERT(m_selection.count() == 1);
@@ -281,8 +291,6 @@ void InformationPanel::slotFileRenamed(const QString &source, const QString &des
             // item is selected, as the name of the item is shown. If this should change
             // in future: Before parsing the whole selection take care to test possible
             // performance bottlenecks when renaming several hundreds of files.
-        } else {
-            m_hoveredItem = KFileItem(destUrl);
         }
 
         showItemInfo();