File connect-both-the-queues-together.diff of Package nepomuk-core
commit 6b0839c1ea03d702d84c55ed6d9ec193dcca702b
Author: Vishesh Handa <me@vhanda.in>
Date: Mon Feb 4 20:41:14 2013 +0530
IndexScheduler: Connect both the queues together
This way the fileIQ is notified that it has items when the basicIQ
finishes and it doesn't need to check the db.
diff --git a/services/fileindexer/fileindexingqueue.cpp b/services/fileindexer/fileindexingqueue.cpp
index dfac534..2b11925 100644
--- a/services/fileindexer/fileindexingqueue.cpp
+++ b/services/fileindexer/fileindexingqueue.cpp
@@ -62,6 +62,15 @@ void FileIndexingQueue::fillQueue()
m_fileQueue.enqueue( it[0].uri() );
}
+void FileIndexingQueue::enqueue(const QUrl& url)
+{
+ if( !m_fileQueue.contains(url) ) {
+ m_fileQueue.enqueue( url );
+ callForNextIteration();
+ }
+}
+
+
bool FileIndexingQueue::isEmpty()
{
return m_fileQueue.isEmpty();
diff --git a/services/fileindexer/fileindexingqueue.h b/services/fileindexer/fileindexingqueue.h
index 294b41d..b017f22 100644
--- a/services/fileindexer/fileindexingqueue.h
+++ b/services/fileindexer/fileindexingqueue.h
@@ -46,6 +46,7 @@ namespace Nepomuk2 {
*/
void start();
+ void enqueue( const QUrl& url );
signals:
void beginIndexingFile(const QUrl& url);
void endIndexingFile(const QUrl& url);
diff --git a/services/fileindexer/indexscheduler.cpp b/services/fileindexer/indexscheduler.cpp
index 3ad7819..9831d2d 100644
--- a/services/fileindexer/indexscheduler.cpp
+++ b/services/fileindexer/indexscheduler.cpp
@@ -83,6 +83,9 @@ Nepomuk2::IndexScheduler::IndexScheduler( QObject* parent )
connect( m_fileIQ, SIGNAL(startedIndexing()), this, SLOT(slotStartedIndexing()) );
connect( m_fileIQ, SIGNAL(finishedIndexing()), this, SLOT(slotFinishedIndexing()) );
+ // Connect both the queues together
+ connect( m_basicIQ, SIGNAL(endIndexingFile(QUrl)), m_fileIQ, SLOT(enqueue(QUrl)) );
+
// Status String
connect( m_basicIQ, SIGNAL(beginIndexingFile(QUrl)), this, SIGNAL(statusStringChanged()) );
connect( m_basicIQ, SIGNAL(endIndexingFile(QUrl)), this, SIGNAL(statusStringChanged()) );