┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2017-06-11 19:33:36 +0200
committerElvis Angelaccio <[email protected]>2017-06-11 19:33:36 +0200
commit96eff55e75bfd0f1e3f866b4af14f3778e9002b3 (patch)
tree22fe4883d7925aa7c919a6364a0d84ee78aea1e4
parenta2f9e005a5e281b5c4938e86b4a5a85ede63c4b9 (diff)
parentec9f4ed17c9c71078eac838060024aef5ca8b2c3 (diff)
Merge branch 'Applications/17.04'
* Applications/17.04: Change in "Open in new tab" feature in Dolphin Ignore drops-onto-items from invalid places items Revert "Increase smooth scrolling animation duration from 100 to 300 ms and set easing curve to InOutQuart"
-rw-r--r--src/dolphinmainwindow.cpp21
-rw-r--r--src/kitemviews/kitemlistcontroller.cpp2
-rw-r--r--src/kitemviews/kitemmodelbase.cpp5
-rw-r--r--src/kitemviews/kitemmodelbase.h10
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp3
-rw-r--r--src/panels/places/placesitemmodel.cpp3
6 files changed, 33 insertions, 11 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 8d580432f..3d6f8489d 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -307,16 +307,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()
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
index a95969771..3731895d0 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 bf41b1c84..ee7e81084 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 bd5ca1d65..45ad1f61a 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/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index cb1dd61ff..6bfdba4c9 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);
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index a4741e746..04dac81b7 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);