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

List:       kfm-devel
Subject:    Re: [PATCH]Automatic proxy configuration
From:       Malte Starostik <malte () kde ! org>
Date:       2001-07-30 12:35:28
[Download RAW message or body]

Am Montag, 30. Juli 2001 13:23 schrieb David Faure:
> > In most cases those scripts are on a web server. Anyway, please review
> > the attachted patch.
>
> /me points to QIODevice::readAll(), to save one line :)
Interesting class QIODevice :)
Okay, if it's about reducing the lines, here's another one.

-- 
Malte Starostik
PGP: 1024D/D2F3C787 [C138 2121 FAF3 410A 1C2A  27CD 5431 7745 D2F3 C787]

["kpac.diff" (text/x-diff)]

Index: kpac_downloader.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kpac/kpac_downloader.cpp,v
retrieving revision 1.1
diff -u -3 -d -p -r1.1 kpac_downloader.cpp
--- kpac_downloader.cpp	2001/05/14 18:02:28	1.1
+++ kpac_downloader.cpp	2001/07/30 12:35:09
@@ -18,6 +18,8 @@
 
 // $Id: kpac_downloader.cpp,v 1.1 2001/05/14 18:02:28 malte Exp $
 
+#include <qfile.h>
+
 #include <kapp.h>
 #include <kio/job.h>
 
@@ -32,6 +34,14 @@ KPACDownloader::KPACDownloader()
 bool KPACDownloader::download(const KURL &url)
 {
     m_data = 0;
+    if (url.isLocalFile())
+    {
+        QFile f(url.path());
+        if (!f.open(IO_ReadOnly))
+            return false;
+        m_data = f.readAll();
+        return true;
+    }
     m_working = true;
     KIO::TransferJob *job = KIO::get(url, false /* no reload */, false /* no GUI \
                */);
     connect(job, SIGNAL(data(KIO::Job *, const QByteArray &)), \
SLOT(slotData(KIO::Job *, const QByteArray &)));



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

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