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

List:       kde-commits
Subject:    KDE/kdepim/nepomuk_email_feeder
From:       Volker Krause <vkrause () kde ! org>
Date:       2009-10-15 17:24:16
Message-ID: 1255627456.182361.26510.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1035702 by vkrause:

Use the OTP in async mode.


 M  +25 -14    messageanalyzer.cpp  
 M  +2 -0      messageanalyzer.h  


--- trunk/KDE/kdepim/nepomuk_email_feeder/messageanalyzer.cpp #1035701:1035702
@@ -46,8 +46,6 @@
 #include <Soprano/QueryResultIterator>
 #include <Soprano/Vocabulary/NAO>
 
-// #include <boost/shared_ptr.hpp>
-
 MessageAnalyzer::MessageAnalyzer(const Akonadi::Item& item, const QUrl& graphUri, \
NepomukFeederAgentBase* parent) :  QObject( parent ),
   m_parent( parent ),
@@ -67,22 +65,16 @@
 
     if ( Settings::self()->indexEncryptedContent() /* TODO != Settings::NoIndexing \
*/ == Settings::CleartextIndex ) {  m_otp = new MessageViewer::ObjectTreeParser( this \
                );
-      m_otp->setAllowAsync( false ); // FIXME: make async
+      m_otp->setAllowAsync( true );
       m_otp->parseObjectTree( msg.get() );
     }
 
-    // before we walk the part node tree, let's see if there is a main plain text \
                body, so we don't interpret that as an attachment later on
-    m_mainBodyPart = msg->mainBodyPart( "text/plain" );
-    if ( m_mainBodyPart ) {
-      const QString text = m_mainBodyPart->decodedText( true, true );
-      if ( !text.isEmpty() )
-        m_email.setPlainTextMessageContents( QStringList( text ) );
-    }
+    if ( !m_otp || !m_otp->hasPendingAsyncJobs() )
+      processContent( msg );
 
-    processPart( msg.get() );
+  } else {
+    deleteLater();
   }
-
-  deleteLater();
 }
 
 MessageAnalyzer::~MessageAnalyzer()
@@ -90,6 +82,21 @@
   delete m_otp;
 }
 
+
+void MessageAnalyzer::processContent(const KMime::Message::Ptr& msg)
+{
+  // before we walk the part node tree, let's see if there is a main plain text \
body, so we don't interpret that as an attachment later on +  m_mainBodyPart = \
msg->mainBodyPart( "text/plain" ); +  if ( m_mainBodyPart ) {
+    const QString text = m_mainBodyPart->decodedText( true, true );
+    if ( !text.isEmpty() )
+      m_email.setPlainTextMessageContents( QStringList( text ) );
+  }
+
+  processPart( msg.get() );
+  deleteLater();
+}
+
 void MessageAnalyzer::processHeaders(const KMime::Message::Ptr& msg)
 {
   if ( msg->subject( false ) ) {
@@ -208,7 +215,11 @@
 
 void MessageAnalyzer::update(MessageViewer::Viewer::UpdateMode mode)
 {
-  kDebug() << mode;
+  kDebug() << m_otp->hasPendingAsyncJobs();
+  const KMime::Message::Ptr msg = m_item.payload<KMime::Message::Ptr>();
+  m_otp->parseObjectTree( msg.get() );
+  if ( !m_otp->hasPendingAsyncJobs() )
+    processContent( msg );
 }
 
 #include "messageanalyzer.moc"
--- trunk/KDE/kdepim/nepomuk_email_feeder/messageanalyzer.h #1035701:1035702
@@ -65,6 +65,8 @@
   private:
     QList<NepomukFast::Contact> extractContactsFromMailboxes( const \
                KMime::Types::Mailbox::List& mbs, const QUrl&graphUri );
     void addTranslatedTag( const char* tagName, const QString &tagLabel );
+
+    void processContent( const KMime::Message::Ptr &msg );
     void processFlags( const Akonadi::Item::Flags &flags );
     void processHeaders( const KMime::Message::Ptr &msg );
     void processPart( KMime::Content *content );


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

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