Don't show an empty window caption when browsing "/", "trash:", etc.

BUG: 190783

svn path=/trunk/KDE/kdebase/apps/; revision=964061
This commit is contained in:
Frank Reininghaus 2009-05-05 21:49:03 +00:00
parent 0738c273ce
commit cc8a62ff16
2 changed files with 24 additions and 3 deletions

View file

@ -236,7 +236,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
updateEditActions();
updateViewActions();
updateGoActions();
setCaption(url.fileName());
setUrlAsCaption(url);
if (m_viewTab.count() > 1) {
m_tabBar->setTabText(m_tabIndex, tabName(url));
}
@ -987,7 +987,7 @@ void DolphinMainWindow::init()
setupActions();
const KUrl& homeUrl = generalSettings->homeUrl();
setCaption(homeUrl.fileName());
setUrlAsCaption(homeUrl);
m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
@ -1096,7 +1096,7 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
updateGoActions();
const KUrl& url = m_activeViewContainer->url();
setCaption(url.fileName());
setUrlAsCaption(url);
if (m_viewTab.count() > 1 && m_viewTab[m_tabIndex].secondaryView != 0) {
m_tabBar->setTabText(m_tabIndex, tabName(url));
m_tabBar->setTabIcon(m_tabIndex, KIcon(KMimeType::iconNameForUrl(url)));
@ -1555,6 +1555,21 @@ QString DolphinMainWindow::tabProperty(const QString& property, int tabIndex) co
return "Tab " + QString::number(tabIndex) + ' ' + property;
}
void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
{
QString caption;
if (url.equals(KUrl("file:///"))) {
caption = '/';
} else {
caption = url.fileName();
if (caption.isEmpty()) {
caption = url.protocol();
}
}
setCaption(caption);
}
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
KIO::FileUndoManager::UiInterface()
{

View file

@ -435,6 +435,12 @@ private:
*/
QString tabProperty(const QString& property, int tabIndex) const;
/**
* Sets the window caption to url.fileName() if this is non-empty,
* "/" if the URL is "file:///", and url.protocol() otherwise.
*/
void setUrlAsCaption(const KUrl& url);
private:
/**
* Implements a custom error handling for the undo manager. This