]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add tooltip to tabbar
authortolu schr <toluschr@protonmail.com>
Wed, 8 Jul 2020 08:59:11 +0000 (10:59 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Tue, 13 Oct 2020 17:44:32 +0000 (17:44 +0000)
src/dolphintabwidget.cpp

index cd023beb262a3be2201f43161c91b59a8e89e43b..7a14f7ca4ff73729272a950a10c887a37d8c3f00 100644 (file)
@@ -382,6 +382,7 @@ void DolphinTabWidget::tabUrlChanged(const QUrl& url)
     const int index = indexOf(qobject_cast<QWidget*>(sender()));
     if (index >= 0) {
         tabBar()->setTabText(index, tabName(tabPageAt(index)));
+        tabBar()->setTabToolTip(index, url.path());
         if (tabBar()->isVisible()) {
             tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(url)));
         } else {
@@ -417,8 +418,12 @@ void DolphinTabWidget::tabInserted(int index)
     if (count() > 1) {
         // Resolve all pending tab icons
         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(tabPageAt(i)->activeViewContainer()->url())));
+                tabBar()->setTabIcon(i, QIcon::fromTheme(KIO::iconNameForUrl(url)));
+            }
+            if (tabBar()->tabToolTip(i).isEmpty()) {
+                tabBar()->setTabToolTip(index, url.path());
             }
         }