[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-28 22:21:58
Message-ID: 20100828222159.033B3AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1169268 by weilbach:

small cleanups, nothing special.


 M  +16 -4     dbusthread.cpp  
 M  +1 -0      dbusthread.h  
 M  +1 -6      kio_torrent.cpp  


--- trunk/playground/ioslaves/kio_torrent/dbusthread.cpp #1169267:1169268
@@ -67,19 +67,30 @@
         groupInt.call("setDefaultSaveLocation",dirs->saveLocation("data","kio_torrent"));
  }
 
-    if (!connect(m_coreKtInterface, SIGNAL(finished(const QString&)),
+/*    if (!connect(m_coreKtInterface, SIGNAL(finished(const QString&)),
                  this, SLOT(slotFinished(const QString&)))) {
         kDebug() << "Could not connect to finished().";
     }
     if (!connect(m_coreKtInterface, SIGNAL(torrentAdded(const QString&)),
                  this, SLOT(slotTorrentAdded(const QString&)))) {
         kDebug() << "Could not connect to torrentAdded().:";
-    }
-//     bus.connect("org.ktorrent.ktorrent","/core","org.ktorrent.core","torrentAdded",this,SLOT(slotTorrentAdded(const \
                QString &)));
-//     bus.connect("org.ktorrent.ktorrent","/core","org.ktorrent.core","torrentRemoved",this,SLOT(torrentRemoved(const \
QString &))); +    }*/
+    bus.connect("org.ktorrent.ktorrent","/core","org.ktorrent.core","torrentAdded",this,SLOT(slotTorrentAdded(const \
QString &))); +    bus.connect("org.ktorrent.ktorrent","/core","org.ktorrent.core","torrentRemoved",this,SLOT(slotTorrentRemoved(const \
QString &)));  m_mutex.unlock();
 }
 
+void DBusThread::load(const QString& url)
+{
+    kDebug() << url;
+    QString httpUrl = url;
+    httpUrl.replace("torrent:","http:");
+    QStringList splitUrl = httpUrl.split(QRegExp(".torrent(/)"));
+    kDebug() << splitUrl[0]+".torrent";
+    m_coreKtInterface->call("loadSilently", splitUrl[0]+".torrent","kio_torrent");
+}
+
+
 void DBusThread::slotFinished(const QString& tor)
 {
     kDebug()<< tor;
@@ -89,6 +100,7 @@
 void DBusThread::slotTorrentAdded(const QString& tor)
 {
     kDebug()<< tor;
+    m_slave->finishGet();
 }
 
 #include "dbusthread.moc"
--- trunk/playground/ioslaves/kio_torrent/dbusthread.h #1169267:1169268
@@ -35,6 +35,7 @@
         DBusThread( TorrentProtocol* );
         void run();
 	void initializeDBus();
+	void load(const QString&);
 
     private slots:
         void slotFinished(const QString&);
--- trunk/playground/ioslaves/kio_torrent/kio_torrent.cpp #1169267:1169268
@@ -58,8 +58,6 @@
     kDebug();
     m_dbusThread = new DBusThread(this);
     m_dbusThread->start();
-    QDBusConnection bus = QDBusConnection::sessionBus();
-    m_coreKtInterface = new QDBusInterface("org.ktorrent.ktorrent", "/core", \
"org.ktorrent.core", bus);  }
 
 TorrentProtocol::~TorrentProtocol()
@@ -84,10 +82,7 @@
 void TorrentProtocol::get( const KUrl& url )
 {
     kDebug() << url.url();
-    QString httpUrl = url.url();
-    httpUrl.replace("torrent:","http:");
-    QStringList splitUrl = httpUrl.split(QRegExp(".torrent(/)"));
-    m_coreKtInterface->call("loadSilently", splitUrl[0]+".torrent","kio_torrent");
+    m_dbusThread->load( url.url() );
     while( true ){
       if(m_finishGet){
 	m_finishGet = false;


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

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