}
}
-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;
}
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);
}