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

List:       kde-commits
Subject:    playground/ioslaves/kio_torrent
From:       Christian Weilbach <christian () whiletaker ! homeip ! net>
Date:       2010-08-30 3:29:04
Message-ID: 20100830032904.0C236AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1169755 by weilbach:

add some first single file support


 M  +1 -7      kio_torrent.cpp  
 M  +0 -1      kio_torrent.h  
 M  +16 -4     ktorrentdbusinterface.cpp  
 M  +1 -1      ktorrentdbusinterface.h  


--- trunk/playground/ioslaves/kio_torrent/kio_torrent.cpp #1169754:1169755
@@ -68,12 +68,6 @@
     kDebug();
 }
 
-void TorrentProtocol::listDir( const KUrl& url )
-{
-    kDebug() << url.url();
-    finished();
-}
-
 void TorrentProtocol::stat( const KUrl& url )
 {
     kDebug() << url.url();
@@ -122,7 +116,7 @@
 
 void TorrentProtocol::finishGet(const QString& path)
 {
-  kDebug() << p;
+  kDebug() << path;
   m_finishGet = true;
   m_path = path;
 }
--- trunk/playground/ioslaves/kio_torrent/kio_torrent.h #1169754:1169755
@@ -32,7 +32,6 @@
         TorrentProtocol( const QByteArray &pool, const QByteArray &app );
         virtual ~TorrentProtocol();
 
-        virtual void listDir( const KUrl & url );
         virtual void stat( const KUrl & url );
         virtual void get( const KUrl & url );
 	virtual void finishStat();
--- trunk/playground/ioslaves/kio_torrent/ktorrentdbusinterface.cpp #1169754:1169755
@@ -70,19 +70,30 @@
     m_mutex.unlock();
 }
 //magnet:?xt=urn:btih:78a81f594d83326e48758991dc365b3c9903d4af&dn=dsl-3.4-vmx&tr=http%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce
                
-void KTorrentDBusInterface::load(const KUrl& url)
+void KTorrentDBusInterface::load(const KUrl& u)
 {
-    kDebug() << url.url() << " Thread: " << thread();
+    kDebug() << u.url() << " Thread: " << thread();
     m_mutex.lock();
+    KUrl url = u;
+    
+    m_fl= url.queryItemValue("fl");
+    kDebug() << "m_fl = " << m_fl;
+    url.removeQueryItem("fl");
+    
     QString xt = url.queryItemValue("xt");
     m_tor = xt.replace("urn:btih:","");
+    
     QDBusReply<QString>name = \
QDBusInterface("org.ktorrent.ktorrent","/torrent/"+m_tor).call("name");  \
if(name.isValid()){  kDebug() << "Torrent already loaded in KTorrent.";
       m_slave->finishStat();
     } else {
-      kDebug() << "Load torrent in KTorrent.";
-      m_coreKtInterface->call("loadSilently", \
url.url().replace("torrent:","magnet:"), "kio_torrent"); +      QString u = \
url.url().replace("torrent:","magnet:"); +      if( !m_fl.isEmpty() ) // HACK
+        u.resize(u.count()-1); // remove trailing &
+      
+      kDebug() << "Load torrent in KTorrent: " << u;
+      m_coreKtInterface->call("loadSilently", u, "kio_torrent");
     }
     m_mutex.unlock();
 }
@@ -98,6 +109,7 @@
 	return;
       }
       QString p = path.value();
+      p += !m_fl.isEmpty() ? "/"+m_fl : "";
       m_slave->finishGet( p );
     }
 }
--- trunk/playground/ioslaves/kio_torrent/ktorrentdbusinterface.h #1169754:1169755
@@ -46,7 +46,7 @@
 	QMutex m_mutex;
 	QThread* m_thread;
 	TorrentProtocol* m_slave;
-	QString m_tor;
+	QString m_tor, m_fl;
 };
 
 #endif // KTORRENTDBUSINTERFACE_H


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

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