diff options
| author | Méven Car <[email protected]> | 2020-11-17 21:11:03 +0100 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2020-11-23 00:02:59 +0000 |
| commit | 2cd1c07cad5945a5286914c05987e21b53cc3c7f (patch) | |
| tree | 85b9f955d29db9693d2d9cb927c71bfe5d923449 /src/panels/places/placespanel.cpp | |
| parent | d5a4835f01a7a269dc94f170860dddbd512bee6a (diff) | |
Places panel: highlight place only when it is displayed
BUG: 156678
FIXED-IN: 20.12
Diffstat (limited to 'src/panels/places/placespanel.cpp')
| -rw-r--r-- | src/panels/places/placespanel.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index ef174946b..4d50fe5f8 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -77,7 +77,7 @@ bool PlacesPanel::urlChanged() } if (m_controller) { - selectClosestItem(); + selectItem(); } return true; @@ -139,7 +139,7 @@ void PlacesPanel::showEvent(QShowEvent* event) layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(container); - selectClosestItem(); + selectItem(); } Panel::showEvent(event); @@ -293,7 +293,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) } } - selectClosestItem(); + selectItem(); } void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) @@ -361,7 +361,7 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) } } - selectClosestItem(); + selectItem(); } QAction *PlacesPanel::buildGroupContextMenu(QMenu *menu, int index) @@ -529,13 +529,17 @@ void PlacesPanel::editEntry(int index) delete dialog; } -void PlacesPanel::selectClosestItem() +void PlacesPanel::selectItem() { const int index = m_model->closestItem(url()); KItemListSelectionManager* selectionManager = m_controller->selectionManager(); selectionManager->setCurrentItem(index); selectionManager->clearSelection(); - selectionManager->setSelected(index); + + const QUrl closestUrl = m_model->url(index); + if (!closestUrl.path().isEmpty() && url() == closestUrl) { + selectionManager->setSelected(index); + } } void PlacesPanel::triggerItem(int index, Qt::MouseButton button) |
