]> cloud.milkyroute.net Git - dolphin.git/commitdiff
only set the title synchronously for the file-protocol, otherwise use KIO::stat()
authorPeter Penz <peter.penz19@gmail.com>
Wed, 20 Jan 2010 13:06:16 +0000 (13:06 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 20 Jan 2010 13:06:16 +0000 (13:06 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1077599

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index 742f7bbf1b08c28cc379988d9dd5c58ee5cfef21..9349ca7be63fdfcf9f42e556a4553c4aea68acb6 100644 (file)
@@ -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<KIO::StatJob*>(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
index c1411319a196290b7df0a4d8d79a1094c226e4d9..a70aa4c23e792721fa901c6acaa8adfabfc9bef7 100644 (file)
@@ -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);