From 883b908b4b26b428e5609d3e7ddd46a9ad884b92 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Wed, 31 May 2017 14:05:37 +0200 Subject: [PATCH 1/4] Revert "Increase smooth scrolling animation duration from 100 to 300 ms and set easing curve to InOutQuart" This reverts commit 58c5eae1953bbdcf6d4150b21cb7ffdad07a5257. Reasons against this change: 1. Scroll is now too fast with devices such as touchpads or trackpoints. 2. Scroll behavior is now inconsistent between Dolphin and other applications (e.g. the Plasma file dialog). Breeze's default animation duration is 100 ms. 3. Many people complained and this feature is currently not configurable. We should introduce a QStyle::SH_Widget_Animation_Duration hint that would allow us to not hardcode durations in Dolphin (i.e. respect whatever duration the users set in their QStyle). Proposal in https://codereview.qt-project.org/#/c/195712/ Reviewers: #vdg, #plasma, emmanuelp, davidedmundson Reviewed By: #plasma, davidedmundson Differential Revision: https://phabricator.kde.org/D5883 --- src/kitemviews/private/kitemlistsmoothscroller.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index cb1dd61ff4..6bfdba4c9a 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.cpp +++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp @@ -35,9 +35,8 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar, m_animation(0) { m_animation = new QPropertyAnimation(this); - const int duration = m_scrollBar->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, m_scrollBar) ? 300 : 1; + const int duration = m_scrollBar->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, m_scrollBar) ? 100 : 1; m_animation->setDuration(duration); - m_animation->setEasingCurve(QEasingCurve::InOutQuart); connect(m_animation, &QPropertyAnimation::stateChanged, this, &KItemListSmoothScroller::slotAnimationStateChanged); From 5246e19a400c305bfa3bfc5e5bfb739b3b07fbf3 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 5 Jun 2017 20:52:31 +0200 Subject: [PATCH 2/4] GIT_SILENT Upgrade KDE Applications version to 17.04.2. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 717f3d6ae7..76a16607fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(Dolphin) # KDE Application Version, managed by release script set (KDE_APPLICATIONS_VERSION_MAJOR "17") set (KDE_APPLICATIONS_VERSION_MINOR "04") -set (KDE_APPLICATIONS_VERSION_MICRO "1") +set (KDE_APPLICATIONS_VERSION_MICRO "2") set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") set(QT_MIN_VERSION "5.5.0") From c85ca114553c198af79eedacdb6b40ac4cab20e0 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Fri, 21 Apr 2017 13:16:05 +0200 Subject: [PATCH 3/4] Ignore drops-onto-items from invalid places items If the QMimeData object created by PlacesItemModel doesn't have any url set (e.g. when dragging unmounted devices), it is detected by the resulting DropJob as "drop raw data" because the mimeData has one format set (the internalMimeType() used for dragging between places items). This results in a crash because the DropJob schedules a PasteJob, but in the meantime the QDrag from Dolphin ends and deletes the mimeData object that was passed to the paste job. The fix is to prevent the DropJob in the first place. We can introduce a new internal mimetype that we use to blacklist drops-onto-items (while still allowing drops-between-items). This way PlacesItemModel can set the blacklist flag if the mimeData is being created without urls. BUG: 373005 FIXED-IN: 17.04.3 Test Plan: Drag and drop an unmounted device to another place item or the DolphinView, doesn't crash anymore. Dropping the unmounted device between two places item still works. Differential Revision: https://phabricator.kde.org/D5535 --- src/kitemviews/kitemlistcontroller.cpp | 2 +- src/kitemviews/kitemmodelbase.cpp | 5 +++++ src/kitemviews/kitemmodelbase.h | 10 ++++++++++ src/panels/places/placesitemmodel.cpp | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index a959697710..3731895d0a 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -928,7 +928,7 @@ bool KItemListController::dropEvent(QGraphicsSceneDragDropEvent* event, const QT // Something has been dropped between two items. m_view->hideDropIndicator(); emit aboveItemDropEvent(dropAboveIndex, event); - } else { + } else if (!event->mimeData()->hasFormat(m_model->blacklistItemDropEventMimeType())) { // Something has been dropped on an item or on an empty part of the view. emit itemDropEvent(m_view->itemAt(pos), event); } diff --git a/src/kitemviews/kitemmodelbase.cpp b/src/kitemviews/kitemmodelbase.cpp index bf41b1c84b..ee7e81084a 100644 --- a/src/kitemviews/kitemmodelbase.cpp +++ b/src/kitemviews/kitemmodelbase.cpp @@ -142,6 +142,11 @@ bool KItemModelBase::supportsDropping(int index) const return false; } +QString KItemModelBase::blacklistItemDropEventMimeType() const +{ + return QStringLiteral("application/x-dolphin-blacklist-drop"); +} + void KItemModelBase::onGroupedSortingChanged(bool current) { Q_UNUSED(current); diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index bd5ca1d652..45ad1f61ab 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -172,6 +172,16 @@ public: // decision whether it accepts the drop? virtual bool supportsDropping(int index) const; + /** + * @return An internal mimetype to signal that an itemDropEvent() should be rejected by + * the receiving model. + * + * This mimeType can be used in createMimeData() to notify that the + * drop-onto-items events should be ignored, while the drop-between-items + * ones should be still accepted. + */ + QString blacklistItemDropEventMimeType() const; + signals: /** * Is emitted if one or more items have been inserted. Each item-range consists diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index a4741e7469..04dac81b73 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -376,6 +376,9 @@ QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const QMimeData* mimeData = new QMimeData(); if (!urls.isEmpty()) { mimeData->setUrls(urls); + } else { + // #378954: prevent itemDropEvent() drops if there isn't a source url. + mimeData->setData(blacklistItemDropEventMimeType(), QByteArrayLiteral("true")); } mimeData->setData(internalMimeType(), itemData); From ec9f4ed17c9c71078eac838060024aef5ca8b2c3 Mon Sep 17 00:00:00 2001 From: Emirald Mateli Date: Sun, 11 Jun 2017 19:26:52 +0200 Subject: [PATCH 4/4] Change in "Open in new tab" feature in Dolphin Summary: This patch proposes a change to the "open in new tab" feature. The "open in new tab" feature will try to open selected items (files or folders) in a new tab, however, if there are no valid items to be opened in a new tab then nothing will happen, making it look like a bug. This patch adds the functionality that when there are no valid items(files or folders) to be opened in a new tab the current folder will be opened. Test Plan: 1. Select a file(pdf, text, image etc) in Dolphin 2. Click on the "Open in new tab" toolbar button Expected: since the file is not a valid target to open in a new tab, the current directory should be opened (as is the case where selection is empty) Actual: Nothing happens after the button is pressed Reviewed By: #dolphin, elvisangelaccio Differential Revision: https://phabricator.kde.org/D6182 --- src/dolphinmainwindow.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index e28e540d15..4b01272b7e 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -306,16 +306,21 @@ void DolphinMainWindow::openNewTab(const QUrl& url) void DolphinMainWindow::openInNewTab() { const KFileItemList& list = m_activeViewContainer->view()->selectedItems(); - if (list.isEmpty()) { - openNewTab(m_activeViewContainer->url()); - } else { - foreach (const KFileItem& item, list) { - const QUrl& url = DolphinView::openItemAsFolderUrl(item); - if (!url.isEmpty()) { - openNewTab(url); - } + bool tabCreated = false; + + foreach (const KFileItem& item, list) { + const QUrl& url = DolphinView::openItemAsFolderUrl(item); + if (!url.isEmpty()) { + openNewTab(url); + tabCreated = true; } } + + // if no new tab has been created from the selection + // open the current directory in a new tab + if (!tabCreated) { + openNewTab(m_activeViewContainer->url()); + } } void DolphinMainWindow::openInNewWindow()