[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:       2010-11-06 18:17:21
Message-ID: 20101106181721.661F9AC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1193664 by adawit:

- Added support for missing QNAM DeleteOperation.
- Let QNAM handle all operations not supported by KIO, e.g. CustomOperation.

BUG:250118


 M  +13 -6     accessmanager.cpp  


--- trunk/KDE/kdelibs/kio/kio/accessmanager.cpp #1193663:1193664
@@ -33,6 +33,7 @@
 #include <kprotocolinfo.h>
 
 #include <QtCore/QUrl>
+#include <QtCore/QStringBuilder>
 #include <QtCore/QWeakPointer>
 #include <QtDBus/QDBusInterface>
 #include <QtDBus/QDBusConnection>
@@ -176,10 +177,16 @@
             kioJob = KIO::http_post(reqUrl, outgoingData->readAll(), KIO::HideProgressInfo);
             break;
         }
-        default:
-            //kDebug( 7044 ) << "Unknown operation";
-            return 0;
+        case DeleteOperation: {
+            kioJob = KIO::file_delete(reqUrl, KIO::HideProgressInfo);
+            break;
     }
+        default: {
+            // For operations we cannot support through KIO, e.g. CustomOpetions,
+            // we let QNetworkAccessManager handle it instead of returning a NULL.
+            return QNetworkAccessManager::createRequest(op, req, outgoingData);            
+        }
+    }
 
     kioJob->setRedirectionHandlingEnabled(false);
     
@@ -199,10 +206,10 @@
     kioJob->addMetaData(d->metaDataForRequest(req));
 
     if ( op == PostOperation && !kioJob->metaData().contains("content-type"))  {
-        QVariant header = req.header(QNetworkRequest::ContentTypeHeader);
+        const QVariant header = req.header(QNetworkRequest::ContentTypeHeader);
         if (header.isValid())
           kioJob->addMetaData(QL1S("content-type"),
-                              QString::fromLatin1("Content-Type: %1").arg(header.toString()));
+                              (QL1S("Content-Type: ") % header.toString()));
         else
           kioJob->addMetaData(QL1S("content-type"),
                               QL1S("Content-Type: application/x-www-form-urlencoded"));
@@ -252,7 +259,7 @@
     Q_FOREACH(const QByteArray &key, request.rawHeaderList()) {
         const QByteArray value = request.rawHeader(key);
         if (value.length())
-            customHeaders << (key + ": " + value);
+            customHeaders << (key % QL1S(": ") % value);
     }
 
     if (!customHeaders.isEmpty())
[prev in list] [next in list] [prev in thread] [next in thread] 

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