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

List:       kde-commits
Subject:    extragear/multimedia/kmid/win
From:       Pedro Lopez-Cabanillas <pedro.lopez.cabanillas () gmail ! com>
Date:       2010-04-18 18:58:18
Message-ID: 20100418190036.20302AC8A2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1116158 by pedrol:

Windows backend, workaround for broken KIO::NetAccess::download()

 M  +14 -8     winmidiobject.cpp  


--- trunk/extragear/multimedia/kmid/win/winmidiobject.cpp #1116157:1116158
@@ -603,14 +603,19 @@
         QFileInfo finfo;
         QString tmpFile = fileName;
         //TODO: looks like KIO::NetAccess::download() is broken in Windows/KDE 4.4.0
-        //KUrl url(fileName);
-        //kDebug() << "input:" << fileName;
-        //kDebug() << "KUrl::localFile:" << url.toLocalFile();
+        KUrl url(fileName);
+        kDebug() << fileName;
+        if (fileName.startsWith(QLatin1String("file://"), Qt::CaseInsensitive)) {
+            kDebug() << "KUrl::localFile:" << url.toLocalFile();
+            tmpFile = fileName.mid(7);
+            kDebug() << "workaround, loading" << tmpFile;
+        } else {
+            kDebug() << "download:" << url;
+            KIO::NetAccess::download(url, tmpFile, 0);
+        }
         d->m_openMutex.lock();
-        tmpFile.remove(QLatin1String("file://"), Qt::CaseSensitive);
         finfo.setFile(tmpFile);
-        if (finfo.exists()) {
-        //if(KIO::NetAccess::download(url, tmpFile, 0)) {
+        if (finfo.exists() && finfo.size() > 0) {
             updateState( LoadingState );
             clearSong();
             try {
@@ -632,9 +637,10 @@
                 clearSong();
                 updateState( ErrorState );
             }
-            //KIO::NetAccess::removeTempFile(tmpFile);
+            if (!fileName.contains(tmpFile))
+                KIO::NetAccess::removeTempFile(tmpFile);
         } else {
-            //d->m_loadingMessages << KIO::NetAccess::lastErrorString();
+            d->m_loadingMessages << KIO::NetAccess::lastErrorString();
             kDebug() << KIO::NetAccess::lastErrorString();
             updateState( ErrorState );
         }
[prev in list] [next in list] [prev in thread] [next in thread] 

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