┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphintabwidget.cpp8
-rw-r--r--src/tests/dolphinmainwindowtest.cpp3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index cfb695e7d..0e7012d3b 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -383,7 +383,9 @@ void DolphinTabWidget::tabUrlChanged(const QUrl& url)
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());
@@ -427,7 +429,9 @@ void DolphinTabWidget::tabInserted(int index)
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));
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index 40f8f6bcd..b40d3dbbf 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -211,7 +211,8 @@ void DolphinMainWindowTest::testOpenInNewTabTitle()
QCOMPARE(tabWidget->count(), 2);
QVERIFY(tabWidget->tabText(0) != tabWidget->tabText(1));
if (!tabWidget->tabIcon(0).isNull() && !tabWidget->tabIcon(1).isNull()) {
- QVERIFY(tabWidget->tabIcon(0).name() != tabWidget->tabIcon(1).name());
+ QCOMPARE(QStringLiteral("inode-directory"), tabWidget->tabIcon(0).name());
+ QCOMPARE(QStringLiteral("inode-directory"), tabWidget->tabIcon(1).name());
}
}