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

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim/korganizer
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2009-10-16 10:08:59
Message-ID: 1255687739.294509.3481.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1036019 by osterfeld:

start using findParent/findChildren


 M  +1 -1      calendarview.cpp  
 M  +11 -14    htmlexport.cpp  
 M  +1 -1      printing/calprintdefaultplugins.cpp  


--- branches/work/akonadi-ports/kdepim/korganizer/calendarview.cpp #1036018:1036019
@@ -2444,7 +2444,7 @@
     Item::List::ConstIterator it;
     for ( it = todos.constBegin(); it != todos.constEnd(); ++it ) {
       Todo::Ptr aTodo = Akonadi::todo( *it );
-      if ( aTodo && !aTodo->relatedTo() ) {
+      if ( aTodo && !aTodo->relatedTo() ) { // top level todo //REVIEW(AKONADI_PORT)
         rootTodos.append( *it );
       }
     }
--- branches/work/akonadi-ports/kdepim/korganizer/htmlexport.cpp #1036018:1036019
@@ -32,6 +32,8 @@
  #include <kabc/stdaddressbook.h>
 #endif
 
+#include <akonadi/kcal/utils.h>
+
 #include <kglobal.h>
 #include <klocale.h>
 #include <kdebug.h>
@@ -370,19 +372,13 @@
 
   int index = 0;
   while ( index < rawTodoList.count() ) {
-    Akonadi::Item &rawTodo = rawTodoList[ index ];
+    const Akonadi::Item rawTodo = rawTodoList.value( index );
     Q_ASSERT( rawTodo.hasPayload<Todo::Ptr>() );
     Todo::Ptr ev = rawTodo.payload<Todo::Ptr>();
-    if ( ev->relatedTo() && ev->relatedTo()->type() == "Todo" ) {
-      Incidence *relatedIncidence = ev->relatedTo();
-      Todo *relatedTodo = dynamic_cast<Todo*>(relatedIncidence);
-      Q_ASSERT(relatedTodo);
-      Akonadi::Item relatedTodoItem;
-      relatedTodoItem.setPayload( Todo::Ptr(relatedTodo->clone()) );
-      if ( !rawTodoList.contains(relatedTodoItem) ) {
-        rawTodoList.append(relatedTodoItem);
-      }
-    }
+    const Akonadi::Item parentItem = d->mCalendar->findParent( rawTodo );
+    if ( Akonadi::hasTodo( parentItem ) )
+        rawTodoList.append( parentItem );
+
     index = rawTodoList.indexOf( rawTodo );
     ++index;
   }
@@ -433,15 +429,16 @@
 
   // Create top-level list.
   for ( it = todoList.constBegin(); it != todoList.constEnd(); ++it ) {
-    if ( !(*it)->relatedTo() ) {
+    if ( !(*it)->relatedTo() ) { //REVIEW(AKONADI_PORT)
       createTodo( ts, *it );
     }
   }
 
+  //REVIEW(AKONADI_PORT) relations/relatedTo usage: ok right now, as relations \
should yield the same result as mCalendar->findChildren and items are not needed here \
// Create sub-level lists  for ( it = todoList.constBegin(); it != \
                todoList.constEnd(); ++it ) {
-    Incidence::List relations = (*it)->relations();
-    if ( relations.count() ) {
+    Incidence::List relations = (*it)->relations(); //REVIEW(AKONADI_PORT)
+    if ( !relations.isEmpty() ) {
       // Generate sub-to-do list
       *ts << "  <tr>" << endl;
       *ts << "    <td class=\"subhead\" colspan=";
--- branches/work/akonadi-ports/kdepim/korganizer/printing/calprintdefaultplugins.cpp \
#1036018:1036019 @@ -1486,7 +1486,7 @@
       continue;
     }
     // Skip sub-to-dos. They will be printed recursively in drawTodo()
-    if ( !todo->relatedTo() ) {
+    if ( !todo->relatedTo() ) { //review(AKONADI_PORT)
       count++;
       drawTodo( count, *it, p,
                 sortField, sortDirection,


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

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