[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim-runtime] resources/maildir: Rework Sergio's patch to run only one job at once and process wi
From: Andras Mantia <amantia () kde ! org>
Date: 2013-07-23 7:54:16
Message-ID: E1V1XQG-0006UQ-Ic () scm ! kde ! org
[Download RAW message or body]
Git commit 1f676cf44ce81f6d82e7ffdc5821e5d501ac7e5a by Andras Mantia.
Committed on 23/07/2013 at 07:53.
Pushed by amantia into branch 'master'.
Rework Sergio's patch to run only one job at once and process with the next only when \
that is done. This fixes the slowness and mail duplication bug for me.
M +11 -8 resources/maildir/retrieveitemsjob.cpp
M +2 -0 resources/maildir/retrieveitemsjob.h
http://commits.kde.org/kdepim-runtime/1f676cf44ce81f6d82e7ffdc5821e5d501ac7e5a
diff --git a/resources/maildir/retrieveitemsjob.cpp \
b/resources/maildir/retrieveitemsjob.cpp index 6afedec..d7b0ff2 100644
--- a/resources/maildir/retrieveitemsjob.cpp
+++ b/resources/maildir/retrieveitemsjob.cpp
@@ -35,7 +35,8 @@ RetrieveItemsJob::RetrieveItemsJob ( const Akonadi::Collection& \
collection, cons m_mimeType( KMime::Message::mimeType() ),
m_transaction( 0 ),
m_previousMtime( 0 ),
- m_highestMtime( 0 )
+ m_highestMtime( 0 ),
+ m_nextIndex( 0 )
{
Q_ASSERT( m_collection.isValid() );
Q_ASSERT( m_maildir.isValid() );
@@ -116,19 +117,21 @@ void RetrieveItemsJob::processEntry(qint64 index)
item.setPayload( KMime::Message::Ptr( msg ) );
+ m_nextIndex = index + 1;
+ KJob *job = 0;
if ( m_localItems.contains( entry ) ) { // modification
item.setId( m_localItems.value( entry ).id() );
- new Akonadi::ItemModifyJob( item, transaction() );
+ job = new Akonadi::ItemModifyJob( item, transaction() );
m_localItems.remove( entry );
} else { // new item
- new Akonadi::ItemCreateJob( item, m_collection, transaction() );
+ job = new Akonadi::ItemCreateJob( item, m_collection, transaction() );
}
+ connect(job, SIGNAL(result(KJob*)), SLOT(processEntryDone(KJob*)) );
+}
- if ( index % 20 == 0 ) {
- QMetaObject::invokeMethod( this, "processEntry", Qt::QueuedConnection, Q_ARG( \
qint64, index + 1 ) );
- } else
- processEntry( index + 1 );
-
+void RetrieveItemsJob::processEntryDone( KJob* )
+{
+ processEntry( m_nextIndex );
}
void RetrieveItemsJob::entriesProcessed()
diff --git a/resources/maildir/retrieveitemsjob.h \
b/resources/maildir/retrieveitemsjob.h index dfc7095..60f3602 100644
--- a/resources/maildir/retrieveitemsjob.h
+++ b/resources/maildir/retrieveitemsjob.h
@@ -53,6 +53,7 @@ class RetrieveItemsJob : public Akonadi::Job
void localListDone( KJob *job );
void transactionDone( KJob *job );
void processEntry( qint64 index );
+ void processEntryDone( KJob * );
private:
Akonadi::Collection m_collection;
@@ -63,6 +64,7 @@ class RetrieveItemsJob : public Akonadi::Job
QStringList m_entryList;
qint64 m_previousMtime;
qint64 m_highestMtime;
+ qint64 m_nextIndex;
QString m_listingPath;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic