From: Peter Penz Date: Wed, 20 Jan 2010 13:06:16 +0000 (+0000) Subject: only set the title synchronously for the file-protocol, otherwise use KIO::stat() X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/2798e5d22546487ed6f93ecb9c5a4299ce96940a?ds=sidebyside only set the title synchronously for the file-protocol, otherwise use KIO::stat() svn path=/trunk/KDE/kdebase/apps/; revision=1077599 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 742f7bbf1..9349ca7be 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1729,19 +1729,19 @@ void DolphinMainWindow::setUrlAsCaption(const KUrl& url) delete m_captionStatJob; m_captionStatJob = 0; - QString caption; - if (url.equals(KUrl("file:///"))) { - caption = '/'; - } else { - caption = url.fileName(); - if (caption.isEmpty()) { - caption = url.protocol(); + if (url.protocol() == QLatin1String("file")) { + QString caption; + if (url.equals(KUrl("file:///"))) { + caption = '/'; + } else { + caption = url.fileName(); + if (caption.isEmpty()) { + caption = url.protocol(); + } } - } - - setCaption(caption); - if ( url.protocol() != QLatin1String( "file" ) ) { + setCaption(caption); + } else { m_captionStatJob = KIO::stat(url, KIO::HideProgressInfo); connect(m_captionStatJob, SIGNAL(result(KJob*)), this, SLOT(slotCaptionStatFinished(KJob*))); @@ -1752,20 +1752,17 @@ void DolphinMainWindow::handleUrl(const KUrl& url) { if (KProtocolManager::supportsListing(url)) { activeViewContainer()->setUrl(url); - } - else { + } else { new KRun(url, this); } } -void DolphinMainWindow::slotCaptionStatFinished( KJob* job ) -{ +void DolphinMainWindow::slotCaptionStatFinished(KJob* job) +{ m_captionStatJob = 0; const KIO::UDSEntry entry = static_cast(job)->statResult(); - QString name = entry.stringValue(KIO::UDSEntry::UDS_DISPLAY_NAME); - if (!name.isEmpty()) { - setCaption(name); - } + const QString name = entry.stringValue(KIO::UDSEntry::UDS_DISPLAY_NAME); + setCaption(name); } QString DolphinMainWindow::squeezedText(const QString& text) const diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index c1411319a..a70aa4c23 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -425,10 +425,10 @@ private slots: void handleUrl(const KUrl& url); /** - * setUrlAsCaption will trigger a stat job which reports its result in + * setUrlAsCaption() will trigger a stat job which reports its result in * this slot. */ - void slotCaptionStatFinished( KJob* job ); + void slotCaptionStatFinished(KJob* job); private: DolphinMainWindow(int id);