- tabPage->setPlacesSelectorVisible(m_placesSelectorVisible);
- connect(tabPage, SIGNAL(activeViewChanged(DolphinViewContainer*)),
- this, SIGNAL(activeViewChanged(DolphinViewContainer*)));
- connect(tabPage, SIGNAL(activeViewUrlChanged(QUrl)),
- this, SLOT(tabUrlChanged(QUrl)));
- addTab(tabPage, QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), tabName(primaryUrl));
+ tabPage->setActive(false);
+ connect(tabPage, &DolphinTabPage::activeViewChanged,
+ this, &DolphinTabWidget::activeViewChanged);
+ connect(tabPage, &DolphinTabPage::activeViewUrlChanged,
+ this, &DolphinTabWidget::tabUrlChanged);
+ connect(tabPage->activeViewContainer(), &DolphinViewContainer::captionChanged, this, [this, tabPage]() {
+ const int tabIndex = indexOf(tabPage);
+ Q_ASSERT(tabIndex >= 0);
+ tabBar()->setTabText(tabIndex, tabName(tabPage));
+ });
+
+ if (position == NewTabPosition::FollowSetting) {
+ if (GeneralSettings::openNewTabAfterLastTab()) {
+ position = NewTabPosition::AtEnd;
+ } else {
+ position = NewTabPosition::AfterCurrent;
+ }
+ }
+
+ int newTabIndex = -1;
+ if (position == NewTabPosition::AfterCurrent || (position == NewTabPosition::FollowSetting && !GeneralSettings::openNewTabAfterLastTab())) {
+ newTabIndex = currentIndex() + 1;
+ }
+
+ insertTab(newTabIndex, tabPage, QIcon() /* loaded in tabInserted */, tabName(tabPage));