diff options
| author | Méven Car <[email protected]> | 2023-05-08 17:46:51 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2023-05-08 17:46:51 +0200 |
| commit | 863ee3a87cee8b1f22a311d6a6a62e56714b5eae (patch) | |
| tree | 728a2f70486e1835053e5c3431e72c62eb69ff82 /src/panels | |
| parent | 69f6b9b78b71f8369dc0ab9b9f9aecfd928d3eb1 (diff) | |
| parent | 26808a188ccb5e35a05b37709e4fe61263c46032 (diff) | |
Merge branch 'master' into kf6
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/information/dolphin_informationpanelsettings.kcfg | 4 | ||||
| -rw-r--r-- | src/panels/information/informationpanel.cpp | 28 | ||||
| -rw-r--r-- | src/panels/places/placespanel.cpp | 3 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 6 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.h | 2 |
5 files changed, 27 insertions, 16 deletions
diff --git a/src/panels/information/dolphin_informationpanelsettings.kcfg b/src/panels/information/dolphin_informationpanelsettings.kcfg index 7a5d29728..0f34e7310 100644 --- a/src/panels/information/dolphin_informationpanelsettings.kcfg +++ b/src/panels/information/dolphin_informationpanelsettings.kcfg @@ -14,6 +14,10 @@ <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> diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index a0dff0d5e..6060e2d8c 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -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(); diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 2155f29bd..2d508ba65 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -14,7 +14,6 @@ #include "dolphin_generalsettings.h" #include "dolphin_placespanelsettings.h" #include "dolphinplacesmodelsingleton.h" -#include "global.h" #include "settings/dolphinsettingsdialog.h" #include "views/draganddrophelper.h" @@ -50,7 +49,7 @@ PlacesPanel::PlacesPanel(QWidget *parent) connect(this, &PlacesPanel::contextMenuAboutToShow, this, &PlacesPanel::slotContextMenuAboutToShow); - connect(this, &PlacesPanel::iconSizeChanged, this, [this](const QSize &newSize) { + connect(this, &PlacesPanel::iconSizeChanged, this, [](const QSize &newSize) { int iconSize = qMin(newSize.width(), newSize.height()); if (iconSize == 0) { // Don't store 0 size, let's keep -1 for default/small/automatic diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 53464e620..9e0391c41 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -54,12 +54,12 @@ void TerminalPanel::goHome() sendCdToTerminal(QDir::homePath(), HistoryPolicy::SkipHistory); } -QString TerminalPanel::currentWorkingDirectory() +bool TerminalPanel::currentWorkingDirectoryIsChildOf(const QString &path) const { if (m_terminal) { - return m_terminal->currentWorkingDirectory(); + return m_terminal->currentWorkingDirectory().startsWith(path); } - return QString(); + return false; } void TerminalPanel::terminalExited() diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index a1b7af03a..8eee3c10f 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -45,7 +45,7 @@ public: * home when an unmounting request is received. */ void goHome(); - QString currentWorkingDirectory(); + bool currentWorkingDirectoryIsChildOf(const QString &path) const; bool isHiddenInVisibleWindow() const; bool terminalHasFocus() const; bool hasProgramRunning() const; |
