Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added DTSTART property for saving data from a CalendarTimezoneObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 11 Jun 2016 08:53:49 +0000 (09:53 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 11 Jun 2016 08:53:49 +0000 (09:53 +0100)
Added the code and unit tests for the DTSTART property in both STANDARD
and DAYLIGHT timezone types.

source/objects/calendartimezone/CalendarTimezone-Save.cpp
source/tests/xestiacalendar_icaltimezonesave.h

index c52c70e..46c0be9 100644 (file)
@@ -92,6 +92,92 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){
                DataLineProcessed.clear();
                
        }
+
+       // Process Standard timezones.
+       
+       if (TimezoneStandardCollection.size() > 0){
+               
+               for (int TimezoneStandardSeek = 0; TimezoneStandardSeek < TimezoneStandardCollection.size();
+                       TimezoneStandardSeek++){
+                               
+                       *SaveData += "BEGIN:STANDARD\n";
+                               
+                       // Process the DTSTART value.
+       
+                       if (TimezoneStandardCollection[TimezoneStandardSeek].DateTimeStartData.size() > 0){
+               
+                               if (TimezoneStandardCollection[TimezoneStandardSeek].DateTimeStartTokens.size() > 0){
+               
+                                       DataLine += "DTSTART;";
+                                       DataLine += TimezoneStandardCollection[TimezoneStandardSeek].DateTimeStartTokens;
+                       
+                               } else {
+
+                                       DataLine += "DTSTART";
+                       
+                               }
+
+                               DataLine += ":";
+                               DataLine += TimezoneStandardCollection[TimezoneStandardSeek].DateTimeStartData;
+                               DataLine += "\n";
+               
+                               DataLineProcessed = OutputText(&DataLine);
+               
+                               *SaveData += DataLineProcessed;
+               
+                               DataLine.clear();
+                               DataLineProcessed.clear();
+               
+                       }
+                               
+                       *SaveData += "END:STANDARD\n";
+                               
+               }
+               
+       }
+       
+       // Process Daylight timezones.
+       
+       if (TimezoneDaylightCollection.size() > 0){
+
+               for (int TimezoneDaylightSeek = 0; TimezoneDaylightSeek < TimezoneDaylightCollection.size();
+                       TimezoneDaylightSeek++){
+               
+                       *SaveData += "BEGIN:DAYLIGHT\n";
+                               
+                       // Process the DTSTART value.
+       
+                       if (TimezoneDaylightCollection[TimezoneDaylightSeek].DateTimeStartData.size() > 0){
+               
+                               if (TimezoneStandardCollection[TimezoneDaylightSeek].DateTimeStartTokens.size() > 0){
+               
+                                       DataLine += "DTSTART;";
+                                       DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].DateTimeStartTokens;
+                       
+                               } else {
+
+                                       DataLine += "DTSTART";
+                       
+                               }
+
+                               DataLine += ":";
+                               DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].DateTimeStartData;
+                               DataLine += "\n";
+               
+                               DataLineProcessed = OutputText(&DataLine);
+               
+                               *SaveData += DataLineProcessed;
+               
+                               DataLine.clear();
+                               DataLineProcessed.clear();
+               
+                       }
+                               
+                       *SaveData += "END:DAYLIGHT\n";
+                               
+               }
+               
+       }
        
        *SaveData += "END:VTIMEZONE\n";
        
index ff6c101..f2850a1 100644 (file)
@@ -64,6 +64,24 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){
        "TZID;OTHER=PARAM:Example/Starrgazy\n"
        "LAST-MODIFIED;FUTURE=ODD:20160203T200700Z\n"
        "TZURL;URL=YES:http://www.example.com/\n"
+       "BEGIN:STANDARD\n"
+       "DTSTART:20160204T020000\n"
+       "END:STANDARD\n"
+       "BEGIN:STANDARD\n"
+       "DTSTART;MEEP=MOO:20160205T020000\n"
+       "END:STANDARD\n"
+       "BEGIN:STANDARD\n"
+       "DTSTART;MEEP=MOO:20160206T020000\n"
+       "END:STANDARD\n"
+       "BEGIN:DAYLIGHT\n"
+       "DTSTART:20160204T020000\n"
+       "END:DAYLIGHT\n"
+       "BEGIN:DAYLIGHT\n"
+       "DTSTART;MEEP=MOO:20160205T020000\n"
+       "END:DAYLIGHT\n"
+       "BEGIN:DAYLIGHT\n"
+       "DTSTART;MEEP=MOO:20160206T020000\n"
+       "END:DAYLIGHT\n"
        "END:VTIMEZONE\n"
        "END:VCALENDAR";
 
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy