From 6171e08eafd8684a3607f19d9f2baac30b45337c Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Sat, 21 Nov 2020 08:23:19 +0100 Subject: GIT_SILENT made messages (after extraction) --- src/org.kde.dolphin.appdata.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/org.kde.dolphin.appdata.xml b/src/org.kde.dolphin.appdata.xml index e78a1ee89..5bbb7f885 100644 --- a/src/org.kde.dolphin.appdata.xml +++ b/src/org.kde.dolphin.appdata.xml @@ -597,6 +597,7 @@ Gestion de fichiers dans Dophin Xestión de ficheiros en Dolphin ניהול קבצים ב־Dolphin + Fájlkezelés a Dolphinban Gerente de file in Dolphin Pengelolaan file di Dolphin Gestione dei file in Dolphin -- cgit v1.3 From 760700819cfdcb767efe0af5a26b385f41c38aae Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Fri, 20 Nov 2020 16:17:08 +0100 Subject: Select last visited folder when going up/back This commit fixes a regression introduced by ad5d3367c7fef4c3c11188a768f21a2ee2b3c025. A lot of connections were changed there and at least one of them was wrong. The connections can be separated into GUI connections and internal ones. This commit makes it so the GUI stuff is connected to m_urlNavigatorConnected and everything else to m_urlNavigator. BUG: 429097 --- src/dolphinviewcontainer.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 0fe8ee9d3..4b11fc3d1 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -118,6 +118,10 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) : m_urlNavigator.get(), &DolphinUrlNavigator::setLocationUrl); connect(m_urlNavigator.get(), &DolphinUrlNavigator::urlChanged, this, &DolphinViewContainer::slotUrlNavigatorLocationChanged); + connect(m_urlNavigator.get(), &DolphinUrlNavigator::urlAboutToBeChanged, + this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged); + connect(m_urlNavigator.get(), &DolphinUrlNavigator::urlSelectionRequested, + this, &DolphinViewContainer::slotUrlSelectionRequested); connect(m_view, &DolphinView::writeStateChanged, this, &DolphinViewContainer::writeStateChanged); connect(m_view, &DolphinView::requestItemInfo, @@ -297,20 +301,18 @@ void DolphinViewContainer::connectUrlNavigator(DolphinUrlNavigator *urlNavigator } urlNavigator->setActive(isActive()); - connect(m_view, &DolphinView::urlChanged, - urlNavigator, &DolphinUrlNavigator::setLocationUrl); + // Url changes are still done via m_urlNavigator. connect(urlNavigator, &DolphinUrlNavigator::urlChanged, - this, &DolphinViewContainer::slotUrlNavigatorLocationChanged); - connect(urlNavigator, &DolphinUrlNavigator::activated, - this, &DolphinViewContainer::activate); - connect(urlNavigator, &DolphinUrlNavigator::urlAboutToBeChanged, - this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged); - connect(urlNavigator, &DolphinUrlNavigator::urlSelectionRequested, - this, &DolphinViewContainer::slotUrlSelectionRequested); + m_urlNavigator.get(), &DolphinUrlNavigator::setLocationUrl); connect(urlNavigator, &DolphinUrlNavigator::urlsDropped, this, [=](const QUrl &destination, QDropEvent *event) { m_view->dropUrls(destination, event, urlNavigator->dropWidget()); }); + // Aside from these, only visual things need to be connected. + connect(m_view, &DolphinView::urlChanged, + urlNavigator, &DolphinUrlNavigator::setLocationUrl); + connect(urlNavigator, &DolphinUrlNavigator::activated, + this, &DolphinViewContainer::activate); m_urlNavigatorConnected = urlNavigator; } @@ -321,18 +323,14 @@ void DolphinViewContainer::disconnectUrlNavigator() return; } + disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::urlChanged, + m_urlNavigator.get(), &DolphinUrlNavigator::setLocationUrl); + disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::urlsDropped, + this, nullptr); disconnect(m_view, &DolphinView::urlChanged, m_urlNavigatorConnected, &DolphinUrlNavigator::setLocationUrl); - disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::urlChanged, - this, &DolphinViewContainer::slotUrlNavigatorLocationChanged); disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::activated, this, &DolphinViewContainer::activate); - disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::urlAboutToBeChanged, - this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged); - disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::urlSelectionRequested, - this, &DolphinViewContainer::slotUrlSelectionRequested); - disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::urlsDropped, - this, nullptr); m_urlNavigatorVisualState = m_urlNavigatorConnected->visualState(); m_urlNavigatorConnected = nullptr; -- cgit v1.3 From a218b2ce51d22a1d1ea8ab38ab5a2834ed598b55 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Mon, 23 Nov 2020 00:36:50 +0100 Subject: PlacesItemModelTest: use helper method to increase indexes Instead of duplicating the logic all over the place. --- src/tests/placesitemmodeltest.cpp | 104 +++++++++----------------------------- 1 file changed, 23 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp index bac89bc61..9d2f74175 100644 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -82,6 +82,7 @@ private: void schedulePlaceRemoval(int index); void cancelPlaceRemoval(int index); QMimeData *createMimeData(const QList &indexes) const; + void increaseIndexIfNeeded(int &index) const; QTemporaryDir m_tempHomeDir; }; @@ -215,6 +216,19 @@ QMimeData *PlacesItemModelTest::createMimeData(const QList &indexes) const return mimeData; } +void PlacesItemModelTest::increaseIndexIfNeeded(int &index) const +{ + if (m_hasDesktopFolder) { + index++; + } + if (m_hasDocumentsFolder) { + index++; + } + if (m_hasDownloadsFolder) { + index++; + } +} + void PlacesItemModelTest::init() { m_model = new PlacesItemModel(); @@ -289,15 +303,7 @@ void PlacesItemModelTest::testGroups() { const auto groups = m_model->groups(); int expectedRemoteIndex = 2; - if (m_hasDesktopFolder) { - expectedRemoteIndex++; - } - if (m_hasDocumentsFolder) { - expectedRemoteIndex++; - } - if (m_hasDownloadsFolder) { - expectedRemoteIndex++; - } + increaseIndexIfNeeded(expectedRemoteIndex); QCOMPARE(groups.size(), 6); @@ -366,15 +372,7 @@ void PlacesItemModelTest::testDeletePlace() PlacesItemModel *model = new PlacesItemModel(); int tempDirIndex = 2; - if (m_hasDesktopFolder) { - tempDirIndex++; - } - if (m_hasDocumentsFolder) { - tempDirIndex++; - } - if (m_hasDownloadsFolder) { - tempDirIndex++; - } + increaseIndexIfNeeded(tempDirIndex); // create a new place createPlaceItem(QStringLiteral("Temporary Dir"), tempUrl, QString()); @@ -539,15 +537,7 @@ void PlacesItemModelTest::testHideItem() void PlacesItemModelTest::testSystemItems() { int tempDirIndex = 2; - if (m_hasDesktopFolder) { - tempDirIndex++; - } - if (m_hasDocumentsFolder) { - tempDirIndex++; - } - if (m_hasDownloadsFolder) { - tempDirIndex++; - } + increaseIndexIfNeeded(tempDirIndex); QCOMPARE(m_model->count(), m_expectedModelCount); for (int r = 0; r < m_model->count(); r++) { @@ -590,15 +580,7 @@ void PlacesItemModelTest::testSystemItems() void PlacesItemModelTest::testEditBookmark() { int tempDirIndex = 2; - if (m_hasDesktopFolder) { - tempDirIndex++; - } - if (m_hasDocumentsFolder) { - tempDirIndex++; - } - if (m_hasDownloadsFolder) { - tempDirIndex++; - } + increaseIndexIfNeeded(tempDirIndex); QScopedPointer other(new PlacesItemModel()); @@ -631,15 +613,7 @@ void PlacesItemModelTest::testEditBookmark() void PlacesItemModelTest::testEditAfterCreation() { int tempDirIndex = 2; - if (m_hasDesktopFolder) { - tempDirIndex++; - } - if (m_hasDocumentsFolder) { - tempDirIndex++; - } - if (m_hasDownloadsFolder) { - tempDirIndex++; - } + increaseIndexIfNeeded(tempDirIndex); const QUrl tempUrl = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); QSignalSpy itemsInsertedSpy(m_model, &PlacesItemModel::itemsInserted); @@ -671,15 +645,7 @@ void PlacesItemModelTest::testEditAfterCreation() void PlacesItemModelTest::testEditMetadata() { int tempDirIndex = 2; - if (m_hasDesktopFolder) { - tempDirIndex++; - } - if (m_hasDocumentsFolder) { - tempDirIndex++; - } - if (m_hasDownloadsFolder) { - tempDirIndex++; - } + increaseIndexIfNeeded(tempDirIndex); const QUrl tempUrl = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); QSignalSpy itemsInsertedSpy(m_model, &PlacesItemModel::itemsInserted); @@ -713,15 +679,7 @@ void PlacesItemModelTest::testEditMetadata() void PlacesItemModelTest::testRefresh() { int tempDirIndex = 2; - if (m_hasDesktopFolder) { - tempDirIndex++; - } - if (m_hasDocumentsFolder) { - tempDirIndex++; - } - if (m_hasDownloadsFolder) { - tempDirIndex++; - } + increaseIndexIfNeeded(tempDirIndex); const QUrl tempUrl = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); QSignalSpy itemsInsertedSpy(m_model, &PlacesItemModel::itemsInserted); @@ -784,15 +742,7 @@ void PlacesItemModelTest::testIcons() void PlacesItemModelTest::testDragAndDrop() { int lastIndex = 1; // last index of places group - if (m_hasDesktopFolder) { - lastIndex++; - } - if (m_hasDocumentsFolder) { - lastIndex++; - } - if (m_hasDownloadsFolder) { - lastIndex++; - } + increaseIndexIfNeeded(lastIndex); QList args; KItemRangeList range; @@ -907,15 +857,7 @@ void PlacesItemModelTest::testDuplicatedEntries() void PlacesItemModelTest::renameAfterCreation() { int tempDirIndex = 2; - if (m_hasDesktopFolder) { - tempDirIndex++; - } - if (m_hasDocumentsFolder) { - tempDirIndex++; - } - if (m_hasDownloadsFolder) { - tempDirIndex++; - } + increaseIndexIfNeeded(tempDirIndex); const QUrl tempUrl = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); QStringList urls = initialUrls(); -- cgit v1.3 From d5a4835f01a7a269dc94f170860dddbd512bee6a Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Mon, 23 Nov 2020 00:25:07 +0100 Subject: PlacesItemModelTest: consider also Pictures/Music/Videos folders See a371e23b2b667bc85c311d04549f3d7348d00af5 in kio. --- src/tests/placesitemmodeltest.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src') diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp index 9d2f74175..0a6ccf27d 100644 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -71,6 +71,9 @@ private: bool m_hasDesktopFolder = false; bool m_hasDocumentsFolder = false; bool m_hasDownloadsFolder = false; + bool m_hasMusicFolder = false; + bool m_hasPicturesFolder = false; + bool m_hasVideosFolder = false; void setBalooEnabled(bool enabled); int indexOf(const QUrl &url); @@ -162,6 +165,18 @@ QStringList PlacesItemModelTest::initialUrls() const urls << QDir::homePath() + QStringLiteral("/Downloads"); } + if (m_hasMusicFolder) { + urls << QDir::homePath() + QStringLiteral("/Music"); + } + + if (m_hasPicturesFolder) { + urls << QDir::homePath() + QStringLiteral("/Pictures"); + } + + if (m_hasVideosFolder) { + urls << QDir::homePath() + QStringLiteral("/Videos"); + } + urls << QStringLiteral("trash:/") << QStringLiteral("remote:/") << QStringLiteral("/media/nfs"); @@ -227,6 +242,15 @@ void PlacesItemModelTest::increaseIndexIfNeeded(int &index) const if (m_hasDownloadsFolder) { index++; } + if (m_hasMusicFolder) { + index++; + } + if (m_hasPicturesFolder) { + index++; + } + if (m_hasVideosFolder) { + index++; + } } void PlacesItemModelTest::init() @@ -284,6 +308,21 @@ void PlacesItemModelTest::initTestCase() m_expectedModelCount++; } + if (QDir(QStandardPaths::writableLocation(QStandardPaths::MusicLocation)).exists()) { + m_hasMusicFolder = true; + m_expectedModelCount++; + } + + if (QDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)).exists()) { + m_hasPicturesFolder = true; + m_expectedModelCount++; + } + + if (QDir(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)).exists()) { + m_hasVideosFolder = true; + m_expectedModelCount++; + } + qRegisterMetaType(); qRegisterMetaType(); } -- cgit v1.3 From 2cd1c07cad5945a5286914c05987e21b53cc3c7f Mon Sep 17 00:00:00 2001 From: Méven Car Date: Tue, 17 Nov 2020 21:11:03 +0100 Subject: Places panel: highlight place only when it is displayed BUG: 156678 FIXED-IN: 20.12 --- src/panels/places/placespanel.cpp | 16 ++++++++++------ src/panels/places/placespanel.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') 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) diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index fe4f46ba6..67b484c65 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -68,10 +68,10 @@ private: void editEntry(int index); /** - * Selects the item that has the closest URL for the URL set + * Selects the item that matches the URL set * for the panel (see Panel::setUrl()). */ - void selectClosestItem(); + void selectItem(); void triggerItem(int index, Qt::MouseButton button); -- cgit v1.3