Just FTR, the upstream patch for easier review.

Samuel
commit 325ebf25a5de3cfeb02c4cd71deacfea3dc767e3
Author: David Faure <fa...@kde.org>
Date:   Sun Oct 19 23:45:25 2014 +0200

    Write zanshin-master-compatible project markers
    
    This makes it easier to test both versions in parallel on the same data.

diff --git a/src/todohelpers.cpp b/src/todohelpers.cpp
index 0db98f3..a4ae190 100644
--- a/src/todohelpers.cpp
+++ b/src/todohelpers.cpp
@@ -89,6 +89,7 @@ void TodoHelpers::addProject(const QString &summary, const 
Akonadi::Collection &
     KCalCore::Todo::Ptr todo(new KCalCore::Todo());
     todo->setSummary(summary);
     todo->addComment("X-Zanshin-Project");
+    todo->setCustomProperty("Zanshin", "Project", "1");
 
     Akonadi::Item item;
     item.setMimeType("application/x-vnd.akonadi.calendar.todo");
@@ -112,6 +113,7 @@ void TodoHelpers::addProject(const QString &summary, const 
QModelIndex &parentIt
     KCalCore::Todo::Ptr todo(new KCalCore::Todo());
     todo->setSummary(summary);
     todo->addComment("X-Zanshin-Project");
+    todo->setCustomProperty("Zanshin", "Project", "1");
 
     KCalCore::Todo::Ptr parentTodo = 
parentProject.payload<KCalCore::Todo::Ptr>();
     todo->setRelatedTo(parentTodo->uid());
@@ -347,6 +349,7 @@ bool TodoHelpers::promoteTodo(const QModelIndex &index)
     }
 
     todo->addComment("X-Zanshin-Project");
+    todo->setCustomProperty("Zanshin", "Project", "1");
     new Akonadi::ItemModifyJob(item);
     return true;
 }
diff --git a/src/todometadatamodel.cpp b/src/todometadatamodel.cpp
index 60056b2..9250635 100644
--- a/src/todometadatamodel.cpp
+++ b/src/todometadatamodel.cpp
@@ -281,7 +281,7 @@ Zanshin::ItemType TodoMetadataModel::itemTypeFromItem(const 
Akonadi::Item &item)
 
     QStringList comments = todo->comments();
     const int childCount = m_childrenMap.contains(todo->uid()) ? 
m_childrenMap[todo->uid()].count() : 0;
-    if (comments.contains("X-Zanshin-Project")
+    if (comments.contains("X-Zanshin-Project") || 
!todo->customProperty("Zanshin", "Project").isEmpty()
      || childCount>0) {
         return Zanshin::ProjectTodo;
     } else {

Reply via email to