┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphintabwidget.cpp
diff options
context:
space:
mode:
authorDavid Hallas <[email protected]>2018-08-28 09:00:13 +0200
committerDavid Hallas <[email protected]>2018-09-02 11:08:15 +0200
commit5a9567730d37126a66d5723fd22c215f184d1f7f (patch)
tree4521052227aed95fbbd960e082db630c58580756 /src/dolphintabwidget.cpp
parenta23acffd5e50e77b68da2c54287db369728b1ddb (diff)
Changes the tabName function to return the name of a specific tab
Summary: Changes the tabName function to return the name of the passed in DolphinTabPage. Previously it would return the name of the active tab, which causes in-active tabs to get the wrong name. Test Plan: Open Dolphin Right click a folder and select 'Open in new tab' Notice that the new tab has the wrong title BUG: 397910 Reviewers: #dolphin, ngraham, elvisangelaccio Reviewed By: #dolphin, ngraham, elvisangelaccio Subscribers: kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D15112
Diffstat (limited to 'src/dolphintabwidget.cpp')
-rw-r--r--src/dolphintabwidget.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index 600974f56..ab2f42c62 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -116,7 +116,7 @@ void DolphinTabWidget::refreshViews()
{
const int tabCount = count();
for (int i = 0; i < tabCount; ++i) {
- tabBar()->setTabText(i, tabName());
+ tabBar()->setTabText(i, tabName(tabPageAt(i)));
tabPageAt(i)->refreshViews();
}
}
@@ -161,7 +161,7 @@ void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryU
this, &DolphinTabWidget::activeViewChanged);
connect(tabPage, &DolphinTabPage::activeViewUrlChanged,
this, &DolphinTabWidget::tabUrlChanged);
- addTab(tabPage, QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), tabName());
+ addTab(tabPage, QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), tabName(tabPage));
if (focusWidget) {
// The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
@@ -306,7 +306,7 @@ void DolphinTabWidget::tabUrlChanged(const QUrl& url)
{
const int index = indexOf(qobject_cast<QWidget*>(sender()));
if (index >= 0) {
- tabBar()->setTabText(index, tabName());
+ tabBar()->setTabText(index, tabName(tabPageAt(index)));
tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(url)));
// Emit the currentUrlChanged signal if the url of the current tab has been changed.
@@ -354,12 +354,12 @@ void DolphinTabWidget::tabRemoved(int index)
emit tabCountChanged(count());
}
-QString DolphinTabWidget::tabName() const
+QString DolphinTabWidget::tabName(DolphinTabPage* tabPage) const
{
- if (currentTabPage() == nullptr) {
+ if (!tabPage) {
return QString();
}
- QString name = currentTabPage()->activeViewContainer()->getCaption();
+ QString name = tabPage->activeViewContainer()->getCaption();
// Make sure that a '&' inside the directory name is displayed correctly
// and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
return name.replace('&', QLatin1String("&&"));