diff --git a/src/libtomahawk/playlist/collectionflatmodel.cpp b/src/libtomahawk/playlist/collectionflatmodel.cpp index d86ba38f8..5edf161d5 100644 --- a/src/libtomahawk/playlist/collectionflatmodel.cpp +++ b/src/libtomahawk/playlist/collectionflatmodel.cpp @@ -212,7 +212,7 @@ void CollectionFlatModel::onTracksRemoved( const QList& tracks, const Tomahawk::collection_ptr& collection ) { QList t = tracks; - for ( int i = rowCount( QModelIndex() ); i > 0 && t.count(); i-- ) + for ( int i = rowCount( QModelIndex() ); i >= 0 && t.count(); i-- ) { PlItem* item = itemFromIndex( index( i, 0, QModelIndex() ) ); if ( !item ) diff --git a/src/sip/zeroconf/zeroconf.cpp b/src/sip/zeroconf/zeroconf.cpp index fdc25c87c..b4c8fccba 100644 --- a/src/sip/zeroconf/zeroconf.cpp +++ b/src/sip/zeroconf/zeroconf.cpp @@ -29,18 +29,8 @@ ZeroconfPlugin::connectPlugin( bool /*startup*/ ) SLOT( lanHostFound( const QString&, int, const QString&, const QString& ) ) ); m_zeroconf->advertise(); - m_isOnline = true; - foreach( QStringList *currNode, m_cachedNodes ) - { - QStringList nodeSet = *currNode; - if ( !Servent::instance()->connectedToSession( nodeSet[3] ) ) - Servent::instance()->connectToPeer( nodeSet[0], nodeSet[1].toInt(), "whitelist", nodeSet[2], nodeSet[3] ); - delete currNode; - } - m_cachedNodes.clear(); - return true; } @@ -58,20 +48,15 @@ ZeroconfPlugin::disconnectPlugin() void ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name, const QString& nodeid ) { + if ( sender() != m_zeroconf ) + return; + qDebug() << "Found LAN host:" << host << port << nodeid; - //FIXME: This doesn't work...why? I never see Found LAN host in debug either, but somehow nodes are being connected... - if ( !m_isOnline ) - { - qDebug() << "Not online, so not connecting"; - QStringList *nodeSet = new QStringList(); - *nodeSet << host << QString::number( port ) << name << nodeid; - m_cachedNodes.insert( nodeSet ); - return; - } - if ( !Servent::instance()->connectedToSession( nodeid ) ) Servent::instance()->connectToPeer( host, port, "whitelist", name, nodeid ); + else + qDebug() << "Already connected to" << host; } Q_EXPORT_PLUGIN2( sip, ZeroconfPlugin ) diff --git a/src/sip/zeroconf/zeroconf.h b/src/sip/zeroconf/zeroconf.h index aa4926908..9f1620092 100644 --- a/src/sip/zeroconf/zeroconf.h +++ b/src/sip/zeroconf/zeroconf.h @@ -17,7 +17,6 @@ public: ZeroconfPlugin() : m_zeroconf( 0 ) , m_isOnline( false ) - , m_cachedNodes() { qDebug() << Q_FUNC_INFO; } @@ -55,7 +54,6 @@ private slots: private: TomahawkZeroconf* m_zeroconf; bool m_isOnline; - QSet< QStringList* > m_cachedNodes; }; #endif