summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-07-04 19:17:50 (UTC)
committer zautrix <zautrix>2005-07-04 19:17:50 (UTC)
commit2710cddd5b0b69efc1c5a7f8516d5b451ff258f1 (patch) (unidiff)
treeabcfa306ccfcdf7aba536cc3f476c0bdbe9ef12b /libkcal
parent4f3238355f67a256f338986ca13322ef23960895 (diff)
downloadkdepimpi-2710cddd5b0b69efc1c5a7f8516d5b451ff258f1.zip
kdepimpi-2710cddd5b0b69efc1c5a7f8516d5b451ff258f1.tar.gz
kdepimpi-2710cddd5b0b69efc1c5a7f8516d5b451ff258f1.tar.bz2
free ring buffer
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/icalformat.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index d9fe40b..5877406 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -131,32 +131,33 @@ bool ICalFormat::fromString( Calendar *cal, const QString &text )
131 131
132 if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) { 132 if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) {
133 setException(new ErrorFormat(ErrorFormat::NoCalendar)); 133 setException(new ErrorFormat(ErrorFormat::NoCalendar));
134 success = false; 134 success = false;
135 } else { 135 } else {
136 // put all objects into their proper places 136 // put all objects into their proper places
137 if ( !mImpl->populate( cal, calendar ) ) { 137 if ( !mImpl->populate( cal, calendar ) ) {
138 if ( !exception() ) { 138 if ( !exception() ) {
139 setException(new ErrorFormat(ErrorFormat::ParseErrorKcal)); 139 setException(new ErrorFormat(ErrorFormat::ParseErrorKcal));
140 } 140 }
141 success = false; 141 success = false;
142 } else 142 } else
143 mLoadedProductId = mImpl->loadedProductId(); 143 mLoadedProductId = mImpl->loadedProductId();
144 } 144 }
145 145
146 icalcomponent_free( calendar ); 146 icalcomponent_free( calendar );
147 icalmemory_free_ring();
147 148
148 return success; 149 return success;
149} 150}
150 151
151Incidence *ICalFormat::fromString( const QString &text ) 152Incidence *ICalFormat::fromString( const QString &text )
152{ 153{
153 CalendarLocal cal( mTimeZoneId ); 154 CalendarLocal cal( mTimeZoneId );
154 fromString(&cal, text); 155 fromString(&cal, text);
155 156
156 Incidence *ical = 0; 157 Incidence *ical = 0;
157 QPtrList<Event> elist = cal.events(); 158 QPtrList<Event> elist = cal.events();
158 if ( elist.count() > 0 ) { 159 if ( elist.count() > 0 ) {
159 ical = elist.first(); 160 ical = elist.first();
160 } else { 161 } else {
161 QPtrList<Todo> tlist = cal.todos(); 162 QPtrList<Todo> tlist = cal.todos();
162 if ( tlist.count() > 0 ) { 163 if ( tlist.count() > 0 ) {
@@ -212,35 +213,36 @@ QString ICalFormat::toString( Calendar *cal )
212 const char *text; 213 const char *text;
213 QString ret =""; 214 QString ret ="";
214 text = icalcomponent_as_ical_string( calendar ); 215 text = icalcomponent_as_ical_string( calendar );
215 qApp->processEvents(); 216 qApp->processEvents();
216 217
217 // text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n"; 218 // text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n";
218 219
219 220
220 if ( text ) { 221 if ( text ) {
221 ret = QString ( text ); 222 ret = QString ( text );
222 } 223 }
223 icalcomponent_free( calendar ); 224 icalcomponent_free( calendar );
224 225
225 if (!text) { 226 if (!text) {
226 setException(new ErrorFormat(ErrorFormat::SaveError, 227 setException(new ErrorFormat(ErrorFormat::SaveError,
227 i18n("libical error"))); 228 i18n("libical error")));
229 icalmemory_free_ring();
228 return QString::null; 230 return QString::null;
229 } 231 }
230 232 icalmemory_free_ring();
231 return ret; 233 return ret;
232} 234}
233 235
234QString ICalFormat::toICalString( Incidence *incidence ) 236QString ICalFormat::toICalString( Incidence *incidence )
235{ 237{
236 CalendarLocal cal( mTimeZoneId ); 238 CalendarLocal cal( mTimeZoneId );
237 cal.addIncidence( incidence->clone() ); 239 cal.addIncidence( incidence->clone() );
238 return toString( &cal ); 240 return toString( &cal );
239} 241}
240 242
241QString ICalFormat::toString( Incidence *incidence ) 243QString ICalFormat::toString( Incidence *incidence )
242{ 244{
243 icalcomponent *component; 245 icalcomponent *component;
244 246
245 component = mImpl->writeIncidence( incidence ); 247 component = mImpl->writeIncidence( incidence );
246 248