Commit 26f8e688 authored by Antonio Prcela's avatar Antonio Prcela 🏞 Committed by Nate Graham
Browse files

Do not display full path in the title of the tab

Summary:
Displays the full path only in the window title, not in the tab title.

Screenshot for comparison: ( Dolphin on the right is without D28815 , Dolphin on left has both D28815 and this patch)

{F8240079}

Reviewers: #vdg, #dolphin, ngraham, meven

Reviewed By: #vdg, #dolphin, ngraham, meven

Subscribers: ngraham, elvisangelaccio, meven, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D28857
parent 24c9666d
...@@ -1269,7 +1269,7 @@ void DolphinMainWindow::tabCountChanged(int count) ...@@ -1269,7 +1269,7 @@ void DolphinMainWindow::tabCountChanged(int count)
void DolphinMainWindow::updateWindowTitle() void DolphinMainWindow::updateWindowTitle()
{ {
const QString newTitle = m_activeViewContainer->caption(); const QString newTitle = m_activeViewContainer->captionWindowTitle();
if (windowTitle() != newTitle) { if (windowTitle() != newTitle) {
setWindowTitle(newTitle); setWindowTitle(newTitle);
} }
......
...@@ -449,6 +449,18 @@ void DolphinViewContainer::reload() ...@@ -449,6 +449,18 @@ void DolphinViewContainer::reload()
m_messageWidget->hide(); m_messageWidget->hide();
} }
QString DolphinViewContainer::captionWindowTitle() const
{
if (GeneralSettings::showFullPathInTitlebar() && !isSearchModeEnabled()) {
if (!url().isLocalFile()) {
return url().adjusted(QUrl::StripTrailingSlash).toString();
}
return url().adjusted(QUrl::StripTrailingSlash).path();
} else {
return DolphinViewContainer::caption();
}
}
QString DolphinViewContainer::caption() const QString DolphinViewContainer::caption() const
{ {
if (isSearchModeEnabled()) { if (isSearchModeEnabled()) {
...@@ -459,13 +471,6 @@ QString DolphinViewContainer::caption() const ...@@ -459,13 +471,6 @@ QString DolphinViewContainer::caption() const
} }
} }
if (GeneralSettings::showFullPathInTitlebar()) {
if (!url().isLocalFile()) {
return url().adjusted(QUrl::StripTrailingSlash).toString();
}
return url().adjusted(QUrl::StripTrailingSlash).path();
}
KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QUrl(url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?")), 1, Qt::MatchRegExp); const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QUrl(url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?")), 1, Qt::MatchRegExp);
......
...@@ -133,6 +133,13 @@ public: ...@@ -133,6 +133,13 @@ public:
*/ */
void reload(); void reload();
/**
* @return Returns a Caption suitable for display in the window title.
* It is calculated depending on GeneralSettings::showFullPathInTitlebar().
* If it's false, it calls caption().
*/
QString captionWindowTitle() const;
/** /**
* @return Returns a Caption suitable for display to the user. It is * @return Returns a Caption suitable for display to the user. It is
* calculated depending on settings, if a search is active and other * calculated depending on settings, if a search is active and other
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment