[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: RE: [Kde-pim] Exporting parseRecurrenceRule in KCal::ICalFormat
From: "Best, Jan-Pascal van" <j.p.vanbest () tbm ! tudelft ! nl>
Date: 2002-09-04 14:14:38
[Download RAW message or body]
> Why don't you call the function
> "bool fromString( Recurrence *, const QString > &)"?
> Then it would be consistent with the other functions of
> ICalFormat.
Better like this?
bool ICalFormat::fromString( Recurrence * recurrence, const QString&
rrule )
void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r,
Recurrence* recur )
Jan-Pascal
["recur.diff" (application/octet-stream)]
Index: icalformat.cpp
===================================================================
RCS file: /home/kde/kdepim/libkcal/icalformat.cpp,v
retrieving revision 1.33
diff -u -3 -p -r1.33 icalformat.cpp
--- icalformat.cpp 2002/07/20 18:17:04 1.33
+++ icalformat.cpp 2002/09/04 14:13:27
@@ -212,6 +212,24 @@ QString ICalFormat::toString( Recurrence
return QString::fromLocal8Bit( text );
}
+bool ICalFormat::fromString( Recurrence * recurrence, const QString& rrule )
+{
+ bool success = true;
+ icalerror_clear_errno();
+ struct icalrecurrencetype recur = icalrecurrencetype_from_string( rrule );
+ if ( icalerrno != ICAL_NO_ERROR ) {
+ kdDebug() << "Recurrence parsing error: " << icalerror_strerror( icalerrno ) << endl;
+ success = false;
+ }
+
+ if ( success ) {
+ mImpl->readRecurrence( recur, recurrence );
+ }
+
+ return success;
+}
+
+
QString ICalFormat::createScheduleMessage(IncidenceBase *incidence,
Scheduler::Method method)
{
Index: icalformat.h
===================================================================
RCS file: /home/kde/kdepim/libkcal/icalformat.h,v
retrieving revision 1.13
diff -u -3 -p -r1.13 icalformat.h
--- icalformat.h 2002/07/20 16:05:45 1.13
+++ icalformat.h 2002/09/04 14:13:27
@@ -76,6 +76,11 @@ class ICalFormat : public CalFormat {
Return recurrence as iCalendar formatted text.
*/
QString toString( Recurrence * );
+ /**
+ Parse string and fill recurrence object with
+ that information
+ */
+ bool fromString ( Recurrence *, const QString& );
/** Create a scheduling message for event \a e using method \m */
QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m);
Index: icalformatimpl.cpp
===================================================================
RCS file: /home/kde/kdepim/libkcal/icalformatimpl.cpp,v
retrieving revision 1.61
diff -u -3 -p -r1.61 icalformatimpl.cpp
--- icalformatimpl.cpp 2002/09/02 10:41:19 1.61
+++ icalformatimpl.cpp 2002/09/04 14:13:27
@@ -1178,6 +1178,11 @@ void ICalFormatImpl::readRecurrenceRule(
dumpIcalRecurrence(r);
+ readRecurrence( r, recur );
+}
+
+void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur )
+{
int wkst;
int index = 0;
short day = 0;
Index: icalformatimpl.h
===================================================================
RCS file: /home/kde/kdepim/libkcal/icalformatimpl.h,v
retrieving revision 1.15
diff -u -3 -p -r1.15 icalformatimpl.h
--- icalformatimpl.h 2002/07/20 16:05:45 1.15
+++ icalformatimpl.h 2002/09/04 14:13:27
@@ -62,6 +62,7 @@ class ICalFormatImpl {
Attendee *readAttendee(icalproperty *attendee);
void readIncidence(icalcomponent *parent,Incidence *incidence);
void readRecurrenceRule(icalproperty *rrule,Incidence *event);
+ void readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur );
void readAlarm(icalcomponent *alarm,Incidence *incidence);
/** Return the PRODID string loaded from calendar file */
const QString &loadedProductId() { return mLoadedProductId; }
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic