Commit 325ebf25 authored by David Faure's avatar David Faure

Write zanshin-master-compatible project markers

This makes it easier to test both versions in parallel on the same data.
parent 4c47c7de
......@@ -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;
}
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment