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

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

index 1c1928c..82b2d65 100644 (file)
@@ -304,6 +304,44 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){
                                }
                
                        }
+                       
+                       // Process the TZNAME value.
+
+                       if (TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneNameData.size() > 0){
+               
+                               for (int TimezoneNameSeek = 0; TimezoneNameSeek < TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneNameData.size();
+                                       TimezoneNameSeek++){
+       
+                                       DataLine += "TZNAME";
+
+                                       if (TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneNameLanguage[TimezoneNameSeek].size() > 0){
+               
+                                               DataLine += ";LANGUAGE=";
+                                               DataLine += TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneNameLanguage[TimezoneNameSeek];
+                       
+                                       }
+                       
+                                       if (TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneNameTokens[TimezoneNameSeek].size() > 0){
+               
+                                               DataLine += ";";
+                                               DataLine += TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneNameTokens[TimezoneNameSeek];
+                       
+                                       }
+                               
+                                       DataLine += ":";
+                                       DataLine += TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneNameData[TimezoneNameSeek];
+                                       DataLine += "\n";
+
+                                       DataLineProcessed = OutputText(&DataLine);
+               
+                                       *SaveData += DataLineProcessed;
+
+                                       DataLine.clear();
+                                       DataLineProcessed.clear();
+                               
+                               }
+               
+                       }
                                
                        *SaveData += "END:STANDARD\n";
                                
@@ -522,6 +560,44 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){
                                }
                
                        }
+
+                       // Process the TZNAME value.
+
+                       if (TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneNameData.size() > 0){
+               
+                               for (int TimezoneNameSeek = 0; TimezoneNameSeek < TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneNameData.size();
+                                       TimezoneNameSeek++){
+       
+                                       DataLine += "TZNAME";
+
+                                       if (TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneNameLanguage[TimezoneNameSeek].size() > 0){
+               
+                                               DataLine += ";LANGUAGE=";
+                                               DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneNameLanguage[TimezoneNameSeek];
+                       
+                                       }
+                       
+                                       if (TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneNameTokens[TimezoneNameSeek].size() > 0){
+               
+                                               DataLine += ";";
+                                               DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneNameTokens[TimezoneNameSeek];
+                       
+                                       }
+                               
+                                       DataLine += ":";
+                                       DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneNameData[TimezoneNameSeek];
+                                       DataLine += "\n";
+
+                                       DataLineProcessed = OutputText(&DataLine);
+               
+                                       *SaveData += DataLineProcessed;
+
+                                       DataLine.clear();
+                                       DataLineProcessed.clear();
+                               
+                               }
+               
+                       }
                        
                        *SaveData += "END:DAYLIGHT\n";
                                
index 5698b44..678ea60 100644 (file)
@@ -82,6 +82,7 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){
        "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=kw;YO=YOYOS:Example timezone comment.\n"
        "RDATE;VALUE=DATE;TZID=Europe/Truro;BEEP=BOOP:20160205,20160207,20160216,20160\n"
        " 305\n"
+       "TZNAME;LANGUAGE=en;NOPE=YES:Example Timezone Name 1\n"
        "END:STANDARD\n"
        "BEGIN:DAYLIGHT\n"
        "DTSTART:20160204T020000\n"
@@ -101,6 +102,7 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){
        "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=kw;YO=YOYOS:Example timezone comment.\n"
        "RDATE;VALUE=DATE;TZID=Europe/Truro;BEEP=BOOP:20160205,20160207,20160216,20160\n"
        " 305\n"
+       "TZNAME;LANGUAGE=en;NOPE=YES:Example Timezone Name 1\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