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

List:       kde-commits
Subject:    KDE/kdepimlibs/akonadi
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-12-20 11:11:18
Message-ID: 20101220111118.1CC4EAC8AA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208029 by vkrause:

Disconnect itemLink/Unlink signals in the Observer default
implementation. If we get there it means nobody is listening,
so we can just as well enable Monitor to do its optimizations
for not connected signals. Can probably be added for all other
notification types as well, although they are used much more
often.


 M  +11 -2     agentbase.cpp  
 M  +4 -0      agentbase.h  


--- trunk/KDE/kdepimlibs/akonadi/agentbase.cpp #1208028:1208029
@@ -121,17 +121,25 @@
 {
   Q_UNUSED( item );
   Q_UNUSED( collection );
-  if ( sAgentBase != 0 )
+  if ( sAgentBase != 0 ) {
+    // not implementation, let's disconnect the signal to enable optimizations in \
Monitor +    QObject::disconnect( sAgentBase->changeRecorder(), SIGNAL( itemLinked( \
const Akonadi::Item&, const Akonadi::Collection& ) ), +                         \
sAgentBase, SLOT( itemLinked( const Akonadi::Item&, const Akonadi::Collection& ) ) ); \
sAgentBase->d_ptr->changeProcessed();  }
+}
 
 void AgentBase::ObserverV2::itemUnlinked( const Akonadi::Item& item, const \
Akonadi::Collection& collection )  {
   Q_UNUSED( item );
   Q_UNUSED( collection );
-  if ( sAgentBase != 0 )
+  if ( sAgentBase != 0 ) {
+    // not implementation, let's disconnect the signal to enable optimizations in \
Monitor +    QObject::disconnect( sAgentBase->changeRecorder(), SIGNAL( itemUnlinked( \
const Akonadi::Item&, const Akonadi::Collection& ) ), +                         \
sAgentBase, SLOT( itemUnlinked( const Akonadi::Item&, const Akonadi::Collection& ) ) \
);  sAgentBase->d_ptr->changeProcessed();
 }
+}
 
 void AgentBase::ObserverV2::collectionMoved( const Akonadi::Collection &collection, \
const Akonadi::Collection &source, const Akonadi::Collection &dest )  {
@@ -686,6 +694,7 @@
 
 void AgentBase::registerObserver( Observer *observer )
 {
+  // TODO in theory we should re-connect change recorder signals here that we \
disconnected previously  d_ptr->mObserver = observer;
 }
 
--- trunk/KDE/kdepimlibs/akonadi/agentbase.h #1208028:1208029
@@ -101,6 +101,10 @@
      * @note In the multiple inheritance approach the init() method automatically
      *       registers itself as the observer.
      *
+     * @note Do not call the base implementation of reimplemented virtual methods!
+     *       The default implementation disconnected themselves from the \
Akonadi::ChangeRecorder +     *       to enable internal optimizations for unused \
notifications. +     *
      * Example for stand-alone observer:
      * @code
      * class ExampleAgent : public AgentBase


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

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