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
{
const int tabCount = count();
for (int i = 0; i < tabCount; ++i) {
{
const int tabCount = count();
for (int i = 0; i < tabCount; ++i) {
- tabBar()->setTabText(i, tabName());
+ tabBar()->setTabText(i, tabName(tabPageAt(i)));
tabPageAt(i)->refreshViews();
}
}
tabPageAt(i)->refreshViews();
}
}
this, &DolphinTabWidget::activeViewChanged);
connect(tabPage, &DolphinTabPage::activeViewUrlChanged,
this, &DolphinTabWidget::tabUrlChanged);
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
if (focusWidget) {
// The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
{
const int index = indexOf(qobject_cast<QWidget*>(sender()));
if (index >= 0) {
{
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.
tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(url)));
// Emit the currentUrlChanged signal if the url of the current tab has been changed.
emit tabCountChanged(count());
}
emit tabCountChanged(count());
}
-QString DolphinTabWidget::tabName() const
+QString DolphinTabWidget::tabName(DolphinTabPage* tabPage) const
- if (currentTabPage() == nullptr) {
- 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("&&"));
// 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("&&"));
- * Returns the name of the tab for the URL \a url.
+ * @param tabPage The tab page to get the name of
+ * @return The name of the tab page
- QString tabName() const;
+ QString tabName(DolphinTabPage* tabPage) const;
private:
/** Caches the (negated) places panel visibility */
private:
/** Caches the (negated) places panel visibility */