From kde-commits Wed Nov 30 23:04:40 2011 From: Christian Mollekopf Date: Wed, 30 Nov 2011 23:04:40 +0000 To: kde-commits Subject: [kdepim-runtime] agents/nepomukfeeder: initialize mOnline Message-Id: <20111130230440.D5717A60CD () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=132269438602297 Git commit e83a881863aef41dd37ade8e3f68057a12423200 by Christian Mollekopf. Committed on 30/11/2011 at 23:01. Pushed by cmollekopf into branch 'master'. initialize mOnline M +14 -9 agents/nepomukfeeder/feederqueue.cpp http://commits.kde.org/kdepim-runtime/e83a881863aef41dd37ade8e3f68057a12423= 200 diff --git a/agents/nepomukfeeder/feederqueue.cpp b/agents/nepomukfeeder/fe= ederqueue.cpp index ad3331f..d444be7 100644 --- a/agents/nepomukfeeder/feederqueue.cpp +++ b/agents/nepomukfeeder/feederqueue.cpp @@ -44,7 +44,8 @@ FeederQueue::FeederQueue( QObject* parent ) mPendingJobs( 0 ), mReIndex( false ), lowPrioQueue(1, 100, this), - highPrioQueue(1, 100, this) + highPrioQueue(1, 100, this), + mOnline( true ) { mProcessItemQueueTimer.setInterval( 0 ); mProcessItemQueueTimer.setSingleShot( true ); @@ -68,6 +69,7 @@ void FeederQueue::setReindexing( bool reindex ) = void FeederQueue::setOnline( bool online ) { + kDebug() << online; mOnline =3D online; if (online) continueIndexing(); @@ -75,7 +77,7 @@ void FeederQueue::setOnline( bool online ) = void FeederQueue::addCollection( const Akonadi::Collection &collection ) { - //kDebug(); + kDebug() << collection.id(); mCollectionQueue.append( collection ); if ( mPendingJobs =3D=3D 0 ) { processNextCollection(); @@ -97,7 +99,7 @@ void FeederQueue::processNextCollection() } mCurrentCollection =3D mCollectionQueue.takeFirst(); emit running( i18n( "Indexing collection '%1'...", mCurrentCollection.na= me() )); - //kDebug() << "Indexing collection" << mCurrentCollection.name(); + kDebug() << "Indexing collection" << mCurrentCollection.name(); //TODO maybe reindex anyways to be sure that type etc is correct if ( !Nepomuk::ResourceManager::instance()->mainModel()->containsAnyStat= ement( Soprano::Node(), Vocabulary::NIE::url(), mCurrentCollection.url() ) = ) { //kDebug() << "adding collection to nepomuk"; @@ -114,7 +116,7 @@ void FeederQueue::processNextCollection() = void FeederQueue::itemHeadersReceived( const Akonadi::Item::List& items ) { - //kDebug() << items.count(); + kDebug() << items.count(); Akonadi::Item::List itemsToUpdate; foreach( const Item &item, items ) { if ( item.storageCollectionId() !=3D mCurrentCollection.id() ) @@ -158,7 +160,7 @@ void FeederQueue::itemFetchResult(KJob* job) = void FeederQueue::addItem( const Akonadi::Item &item ) { - //kDebug() << item.id(); + kDebug() << item.id(); highPrioQueue.addItem( item ); mProcessItemQueueTimer.start(); } @@ -170,13 +172,13 @@ bool FeederQueue::isEmpty() = void FeederQueue::continueIndexing() { - //kDebug(); + kDebug(); mProcessItemQueueTimer.start(); } = void FeederQueue::processItemQueue() { - //kDebug(); + kDebug(); ++mProcessedAmount; if ( (mProcessedAmount % 100) =3D=3D 0 && mTotalAmount > 0 && mProcessed= Amount <=3D mTotalAmount ) emit progress( (mProcessedAmount * 100) / mTotalAmount ); @@ -187,6 +189,7 @@ void FeederQueue::processItemQueue() return; } } else if ( !mOnline ) { + kDebug() << "not Online, stopping processing"; return; } else if ( !lowPrioQueue.isEmpty() ){ = //kDebug() << "low"; @@ -199,7 +202,7 @@ void FeederQueue::processItemQueue() } = if ( !highPrioQueue.isEmpty() || ( !lowPrioQueue.isEmpty() && mOnline ) = ) { - //kDebug() << "continue"; + kDebug() << "continue"; // go to eventloop before processing the next one, otherwise we miss t= he idle status change mProcessItemQueueTimer.start(); } @@ -317,10 +320,12 @@ void ItemQueue::itemsReceived(const Akonadi::Item::Li= st& items) { Akonadi::ItemFetchJob *job =3D qobject_cast(se= nder()); int numberOfItems =3D job->property("numberOfItems").toInt(); - kDebug() << items.size(); + kDebug() << items.size() << numberOfItems; mFetchedItemList.append(items); if ( mFetchedItemList.size() >=3D numberOfItems ) { //Sometimes we get= a partial delivery only, wait for the rest processBatch(); + } else { + kDebug() << "waiting for more"; } } =