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));
+ });
+
int newTabIndex = -1;
if (!GeneralSettings::openNewTabAfterLastTab()) {
newTabIndex = currentIndex() + 1;
}
+
insertTab(newTabIndex, tabPage, QIcon() /* loaded in tabInserted */, tabName(tabPage));
if (focusWidget) {
tabBar()->setTabText(index, tabName(tabPageAt(index)));
tabBar()->setTabToolTip(index, url.toDisplayString(QUrl::PreferLocalFile));
if (tabBar()->isVisible()) {
- tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(url)));
+ // ensure the path url ends with a slash to have proper folder icon for remote folders
+ const QUrl pathUrl = QUrl(url.adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/"));
+ tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(pathUrl)));
} else {
// Mark as dirty, actually load once the tab bar actually gets shown
tabBar()->setTabIcon(index, QIcon());
for (int i = 0; i < count(); ++i) {
const QUrl url = tabPageAt(i)->activeViewContainer()->url();
if (tabBar()->tabIcon(i).isNull()) {
- tabBar()->setTabIcon(i, QIcon::fromTheme(KIO::iconNameForUrl(url)));
+ // ensure the path url ends with a slash to have proper folder icon for remote folders
+ const QUrl pathUrl = QUrl(url.adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/"));
+ tabBar()->setTabIcon(i, QIcon::fromTheme(KIO::iconNameForUrl(pathUrl)));
}
if (tabBar()->tabToolTip(i).isEmpty()) {
tabBar()->setTabToolTip(index, url.toDisplayString(QUrl::PreferLocalFile));