[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kio/kio
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2011-01-19 7:00:23
Message-ID: 20110119070023.9D110AC8B7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1215664 by adawit:

Unbreak the ability to show local html files and man pages that was broken as a \
result of the fix to properly handle ioslaves on hold.

 M  +17 -1     accessmanagerreply_p.cpp  


--- trunk/KDE/kdelibs/kio/kio/accessmanagerreply_p.cpp #1215663:1215664
@@ -27,6 +27,7 @@
 #include "job.h"
 
 #include <kdebug.h>
+#include <kprotocolinfo.h>
 
 #include <QtNetwork/QSslConfiguration>
 
@@ -34,6 +35,13 @@
 #define QL1C(x)  QLatin1Char(x)
 
 
+static bool isLocalRequest(const KUrl& url)
+{
+    const QString scheme (url.protocol());
+    return (KProtocolInfo::isKnownProtocol(scheme) &&
+            KProtocolInfo::protocolClass(scheme).compare(QL1S(":local"), \
Qt::CaseInsensitive) == 0); +}
+
 namespace KDEPrivate {
 
 AccessManagerReply::AccessManagerReply(const QNetworkAccessManager::Operation &op,
@@ -133,8 +141,15 @@
         return;
 
     const KIO::MetaData& metaData = job->metaData();
-    if (metaData.isEmpty())
+    if (metaData.isEmpty()) {
+        // Allow handling of local resources such as man pages and file url...
+        if (isLocalRequest(url())) {
+            setHeader(QNetworkRequest::ContentLengthHeader, \
job->totalAmount(KJob::Bytes)); +            \
setAttribute(QNetworkRequest::HttpStatusCodeAttribute, "200"); +            emit \
metaDataChanged(); +        }        
         return;
+    }
 
     // Set the encryption attribute and values...
     QSslConfiguration sslConfig;
@@ -202,6 +217,7 @@
 
 void AccessManagerReply::slotData(KIO::Job *kioJob, const QByteArray &data)
 {
+    Q_UNUSED (kioJob);
     m_data += data;
     emit readyRead();
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic