}
}
-void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryUrl)
+void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryUrl, DolphinTabWidget::NewTabPosition position)
{
QWidget* focusWidget = QApplication::focusWidget();
tabBar()->setTabText(tabIndex, tabName(tabPage));
});
+ if (position == NewTabPosition::FollowSetting) {
+ if (GeneralSettings::openNewTabAfterLastTab()) {
+ position = NewTabPosition::AtEnd;
+ } else {
+ position = NewTabPosition::AfterCurrent;
+ }
+ }
+
int newTabIndex = -1;
- if (!GeneralSettings::openNewTabAfterLastTab()) {
+ if (position == NewTabPosition::AfterCurrent || (position == NewTabPosition::FollowSetting && !GeneralSettings::openNewTabAfterLastTab())) {
newTabIndex = currentIndex() + 1;
}
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);
+ }
+ });
+ }
}
}
do {
const auto tabPage = tabPageAt(i);
if (tabPage->primaryViewContainer()->url() == url ||
- childUrlBehavior == ReturnIndexForOpenedParentAlso && tabPage->primaryViewContainer()->url().isParentOf(url)) {
+ (childUrlBehavior == ReturnIndexForOpenedParentAlso && tabPage->primaryViewContainer()->url().isParentOf(url))) {
return qMakePair(i, true);
}
if (tabPage->splitViewEnabled() &&
(url == tabPage->secondaryViewContainer()->url() ||
- childUrlBehavior == ReturnIndexForOpenedParentAlso && tabPage->secondaryViewContainer()->url().isParentOf(url))) {
+ (childUrlBehavior == ReturnIndexForOpenedParentAlso && tabPage->secondaryViewContainer()->url().isParentOf(url)))) {
return qMakePair(i, false);
}