mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
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"
This commit is contained in:
commit
96eff55e75
6 changed files with 33 additions and 11 deletions
|
@ -307,16 +307,21 @@ void DolphinMainWindow::openNewTab(const QUrl& url)
|
||||||
void DolphinMainWindow::openInNewTab()
|
void DolphinMainWindow::openInNewTab()
|
||||||
{
|
{
|
||||||
const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
|
const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
|
||||||
if (list.isEmpty()) {
|
bool tabCreated = false;
|
||||||
openNewTab(m_activeViewContainer->url());
|
|
||||||
} else {
|
foreach (const KFileItem& item, list) {
|
||||||
foreach (const KFileItem& item, list) {
|
const QUrl& url = DolphinView::openItemAsFolderUrl(item);
|
||||||
const QUrl& url = DolphinView::openItemAsFolderUrl(item);
|
if (!url.isEmpty()) {
|
||||||
if (!url.isEmpty()) {
|
openNewTab(url);
|
||||||
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()
|
void DolphinMainWindow::openInNewWindow()
|
||||||
|
|
|
@ -928,7 +928,7 @@ bool KItemListController::dropEvent(QGraphicsSceneDragDropEvent* event, const QT
|
||||||
// Something has been dropped between two items.
|
// Something has been dropped between two items.
|
||||||
m_view->hideDropIndicator();
|
m_view->hideDropIndicator();
|
||||||
emit aboveItemDropEvent(dropAboveIndex, event);
|
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.
|
// Something has been dropped on an item or on an empty part of the view.
|
||||||
emit itemDropEvent(m_view->itemAt(pos), event);
|
emit itemDropEvent(m_view->itemAt(pos), event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,11 @@ bool KItemModelBase::supportsDropping(int index) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString KItemModelBase::blacklistItemDropEventMimeType() const
|
||||||
|
{
|
||||||
|
return QStringLiteral("application/x-dolphin-blacklist-drop");
|
||||||
|
}
|
||||||
|
|
||||||
void KItemModelBase::onGroupedSortingChanged(bool current)
|
void KItemModelBase::onGroupedSortingChanged(bool current)
|
||||||
{
|
{
|
||||||
Q_UNUSED(current);
|
Q_UNUSED(current);
|
||||||
|
|
|
@ -172,6 +172,16 @@ public:
|
||||||
// decision whether it accepts the drop?
|
// decision whether it accepts the drop?
|
||||||
virtual bool supportsDropping(int index) const;
|
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:
|
signals:
|
||||||
/**
|
/**
|
||||||
* Is emitted if one or more items have been inserted. Each item-range consists
|
* Is emitted if one or more items have been inserted. Each item-range consists
|
||||||
|
|
|
@ -35,9 +35,8 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
|
||||||
m_animation(0)
|
m_animation(0)
|
||||||
{
|
{
|
||||||
m_animation = new QPropertyAnimation(this);
|
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->setDuration(duration);
|
||||||
m_animation->setEasingCurve(QEasingCurve::InOutQuart);
|
|
||||||
connect(m_animation, &QPropertyAnimation::stateChanged,
|
connect(m_animation, &QPropertyAnimation::stateChanged,
|
||||||
this, &KItemListSmoothScroller::slotAnimationStateChanged);
|
this, &KItemListSmoothScroller::slotAnimationStateChanged);
|
||||||
|
|
||||||
|
|
|
@ -376,6 +376,9 @@ QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const
|
||||||
QMimeData* mimeData = new QMimeData();
|
QMimeData* mimeData = new QMimeData();
|
||||||
if (!urls.isEmpty()) {
|
if (!urls.isEmpty()) {
|
||||||
mimeData->setUrls(urls);
|
mimeData->setUrls(urls);
|
||||||
|
} else {
|
||||||
|
// #378954: prevent itemDropEvent() drops if there isn't a source url.
|
||||||
|
mimeData->setData(blacklistItemDropEventMimeType(), QByteArrayLiteral("true"));
|
||||||
}
|
}
|
||||||
mimeData->setData(internalMimeType(), itemData);
|
mimeData->setData(internalMimeType(), itemData);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue