Add support for categories (tags) when synching calendars
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 17 Apr 2010 17:47:56 +0000 (13:47 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 17 Apr 2010 17:47:56 +0000 (13:47 -0400)
framework/ActiveSync/lib/Horde/ActiveSync/Message/Appointment.php
kronolith/lib/Event.php

index 101ca7a..05afb26 100644 (file)
@@ -717,18 +717,16 @@ class Horde_ActiveSync_Message_Appointment extends Horde_ActiveSync_Message_Base
     /**
      * Add a category to the appointment
      *
-     * TODO
-     *
      * @param string $category
      */
     public function addCategory($category)
     {
-
+        $this->categories[] = $category;
     }
 
-    public function getCategory()
+    public function getCategories()
     {
-
+        return $this->categories;
     }
 
     /**
index f465713..fbbe448 100644 (file)
@@ -1083,6 +1083,12 @@ abstract class Kronolith_Event
             $this->addAttendee($attendee->email, Kronolith::PART_NONE, Kronolith::RESPONSE_NONE, $attendee->name);
         }
 
+        /* Categories (Tags) */
+        $tags = $message->getCategories();
+        foreach ($tags as $tag) {
+            $this->tags[] = Horde_String::convertCharset($tag, 'utf-8', Horde_Nls::getCharset());
+        }
+
         /* Flag that we are initialized */
         $this->initialized = true;
     }
@@ -1238,6 +1244,11 @@ abstract class Kronolith_Event
         /* Reminder */
         $message->setReminder($this->alarm);
 
+        /* Categories (tags) */
+        foreach ($this->tags as $tag) {
+            $message->addCategory(Horde_String::convertCharset($tag, Horde_Nls::getCharset(), 'utf-8'));
+        }
+
         return $message;
     }