┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2022-10-02 13:09:21 +0200
committerKai Uwe Broulik <[email protected]>2022-10-06 12:21:15 +0000
commit380543334c7a518717564e94bc806cae6ee7bf4a (patch)
tree65689190a1efa276f520cb4f0234a4826053b452 /src
parent8402b989957a5b9e44274b17b1cba289fc3544f0 (diff)
DolphinTabBar: Open folder in new tab when dropped onto tab bar
Diffstat (limited to 'src')
-rw-r--r--src/dolphintabbar.cpp15
-rw-r--r--src/dolphintabwidget.cpp11
2 files changed, 13 insertions, 13 deletions
diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp
index 4c1d9e44a..d3dc96393 100644
--- a/src/dolphintabbar.cpp
+++ b/src/dolphintabbar.cpp
@@ -36,13 +36,7 @@ void DolphinTabBar::dragEnterEvent(QDragEnterEvent* event)
const int index = tabAt(event->pos());
if (mimeData->hasUrls()) {
- if (index >= 0) {
- event->acceptProposedAction();
- } else {
- event->setDropAction(Qt::IgnoreAction);
- // Still need to accept it to receive dragMoveEvent
- event->accept();
- }
+ event->acceptProposedAction();
updateAutoActivationTimer(index);
}
@@ -62,11 +56,6 @@ void DolphinTabBar::dragMoveEvent(QDragMoveEvent* event)
const int index = tabAt(event->pos());
if (mimeData->hasUrls()) {
- if (index >= 0) {
- event->acceptProposedAction();
- } else {
- event->setDropAction(Qt::IgnoreAction);
- }
updateAutoActivationTimer(index);
}
@@ -81,7 +70,7 @@ void DolphinTabBar::dropEvent(QDropEvent* event)
const QMimeData* mimeData = event->mimeData();
const int index = tabAt(event->pos());
- if (index >= 0 && mimeData->hasUrls()) {
+ if (mimeData->hasUrls()) {
Q_EMIT tabDropEvent(index, event);
}
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index 7eae6f297..6caaf174f 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -393,6 +393,17 @@ void DolphinTabWidget::tabDropEvent(int index, QDropEvent* event)
if (index >= 0) {
DolphinView* view = tabPageAt(index)->activeViewContainer()->view();
view->dropUrls(view->url(), event, view);
+ } else {
+ const auto urls = event->mimeData()->urls();
+
+ for (const QUrl &url : urls) {
+ auto *job = KIO::statDetails(url, KIO::StatJob::SourceSide, KIO::StatDetail::StatBasic, KIO::JobFlag::HideProgressInfo);
+ connect(job, &KJob::result, this, [this, job]() {
+ if (!job->error() && job->statResult().isDir()) {
+ openNewTab(job->url(), QUrl(), NewTabPosition::AtEnd);
+ }
+ });
+ }
}
}