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

List:       kde-commits
Subject:    KDE/kdepim/nepomuk_email_feeder
From:       Till Adam <adam () kde ! org>
Date:       2010-05-16 19:42:10
Message-ID: 20100516194210.6F73DAC8BA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1127486 by tilladam:

Introduce a compat level for the index.

The feeder now defines a compat level for its index, via a constant, and
avoids doing a full pass over all collections unless that level changes.
To that end, it keeps the compat level of the last succesful full run
around in its config file.

 M  +4 -0      nepomuk_email_feeder.kcfg  
 M  +16 -0     nepomukemailfeeder.cpp  
 M  +6 -0      nepomukemailfeeder.h  
 M  +5 -1      shared/nepomukfeederagentbase.cpp  
 M  +3 -0      shared/nepomukfeederagentbase.h  


--- trunk/KDE/kdepim/nepomuk_email_feeder/nepomuk_email_feeder.kcfg #1127485:1127486
@@ -25,5 +25,9 @@
       </choices>
       <default>LocalAndCached</default>
     </entry>
+    <entry name="IndexCompatLevel" type="Int">
+        <label>The compat level of the last succesful full indexing.</label>
+        <default>0</default>
+    </entry>
   </group>
 </kcfg>
--- trunk/KDE/kdepim/nepomuk_email_feeder/nepomukemailfeeder.cpp #1127485:1127486
@@ -32,6 +32,8 @@
 
 #include <gpgme++/context.h>
 
+static const int INDEX_COMPAT_LEVEL = 1; // increment when the index format for \
emails changes +
 using namespace Akonadi;
 
 Akonadi::NepomukEMailFeeder::NepomukEMailFeeder( const QString &id ) :
@@ -44,6 +46,9 @@
 
   changeRecorder()->itemFetchScope().fetchFullPayload();
 
+  connect( this, SIGNAL( fullyIndexed() ),
+           this, SLOT( slotFullyIndexed() ) );
+
   // failsafe in case we don't have / lost G13 support
   if ( Settings::self()->indexEncryptedContent() == Settings::EncryptedIndex && \
!GpgME::hasFeature( GpgME::G13VFSFeature ) )  \
Settings::self()->setIndexEncryptedContent( Settings::NoIndexing ); @@ -105,6 +110,17 \
@@  return scope;
 }
 
+bool NepomukEMailFeeder::needsReIndexing() const
+{
+  return INDEX_COMPAT_LEVEL > Settings::self()->indexCompatLevel();
+}
+
+void NepomukEMailFeeder::slotFullyIndexed()
+{
+  Settings::self()->setIndexCompatLevel( INDEX_COMPAT_LEVEL );
+  Settings::self()->writeConfig();
+}
+
 AKONADI_AGENT_MAIN( NepomukEMailFeeder )
 
 #include "nepomukemailfeeder.moc"
--- trunk/KDE/kdepim/nepomuk_email_feeder/nepomukemailfeeder.h #1127485:1127486
@@ -46,6 +46,12 @@
 
   protected:
     ItemFetchScope fetchScopeForcollection(const Akonadi::Collection& collection);
+
+  private:
+    bool needsReIndexing() const;
+
+  private slots:
+    void slotFullyIndexed();
 };
 
 }
--- trunk/KDE/kdepim/nepomuk_email_feeder/shared/nepomukfeederagentbase.cpp \
#1127485:1127486 @@ -184,8 +184,12 @@
 
 void NepomukFeederAgentBase::processNextCollection()
 {
-  if ( mCurrentCollection.isValid() || mCollectionQueue.isEmpty() )
+  if ( mCurrentCollection.isValid() )
     return;
+  if ( mCollectionQueue.isEmpty() ) {
+    emit fullyIndexed();
+    return;
+  }
   mCurrentCollection = mCollectionQueue.takeFirst();
   emit status( AgentBase::Running, i18n( "Indexing collection '%1'...", \
mCurrentCollection.name() ) );  kDebug() << "Indexing collection" << \
                mCurrentCollection.name();
--- trunk/KDE/kdepim/nepomuk_email_feeder/shared/nepomukfeederagentbase.h \
#1127485:1127486 @@ -151,6 +151,9 @@
     /** Trigger a complete update of all items. */
     void updateAll();
 
+  signals:
+    void fullyIndexed();
+
   protected:
     void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection \
                );
     void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> \
&partIdentifiers );


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

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