/** * Different constructor * @param startOnMonday Does the week start on monday? * @param rp Already set ORecur object * @param startDate The start date * @param parent The parent widget * @param name The name of the object * @param modal * @param fl The flags for window */ ORecurranceWidget::ORecurranceWidget( bool startOnMonday, const ORecur& rp, const QDate& startDate, QWidget* parent, const char* name, bool modal, WFlags fl) : ORecurranceBase( parent, name, modal, fl ), start( startDate ), end( rp.endDate() ), startWeekOnMonday( startOnMonday ) { if (strDayTemplate.isEmpty() ) fillStrings(); // do some stuff with the repeat pattern init(); setRecurrence( rp ); }
void OEvent::fromMap( const QMap<int, QString>& map ) { // We just want to set the UID if it is really stored. if ( !map[OEvent::FUid].isEmpty() ) setUid( map[OEvent::FUid].toInt() ); setCategories( idsFromString( map[OEvent::FCategories] ) ); setDescription( map[OEvent::FDescription] ); setLocation( map[OEvent::FLocation] ); if ( map[OEvent::FType] == "AllDay" ) setAllDay( true ); else setAllDay( false ); int alarmTime = -1; if( !map[OEvent::FAlarm].isEmpty() ) alarmTime = map[OEvent::FAlarm].toInt(); int sound = ( ( map[OEvent::FSound] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); if ( ( alarmTime != -1 ) ){ QDateTime dt = startDateTime().addSecs( -1*alarmTime*60 ); OPimAlarm al( sound , dt ); notifiers().add( al ); } if ( !map[OEvent::FTimeZone].isEmpty() && ( map[OEvent::FTimeZone] != "None" ) ){ setTimeZone( map[OEvent::FTimeZone] ); } time_t start = (time_t) map[OEvent::FStart].toLong(); time_t end = (time_t) map[OEvent::FEnd].toLong(); /* AllDay is always in UTC */ if ( isAllDay() ) { OTimeZone utc = OTimeZone::utc(); setStartDateTime( utc.fromUTCDateTime( start ) ); setEndDateTime ( utc.fromUTCDateTime( end ) ); setTimeZone( "UTC"); // make sure it is really utc }else { /* to current date time */ // qWarning(" Start is %d", start ); OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() ); QDateTime date = zone.toDateTime( start ); qWarning(" Start is %s", date.toString().latin1() ); setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) ); date = zone.toDateTime( end ); setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) ); } if ( !map[OEvent::FRecParent].isEmpty() ) setParent( map[OEvent::FRecParent].toInt() ); if ( !map[OEvent::FRecChildren].isEmpty() ){ QStringList list = QStringList::split(' ', map[OEvent::FRecChildren] ); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { addChild( (*it).toInt() ); } } // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap.. if( !map[OEvent::FRType].isEmpty() ){ QMap<int, QString> recFields; recFields.insert( ORecur::RType, map[OEvent::FRType] ); recFields.insert( ORecur::RWeekdays, map[OEvent::FRWeekdays] ); recFields.insert( ORecur::RPosition, map[OEvent::FRPosition] ); recFields.insert( ORecur::RFreq, map[OEvent::FRFreq] ); recFields.insert( ORecur::RHasEndDate, map[OEvent::FRHasEndDate] ); recFields.insert( ORecur::EndDate, map[OEvent::FREndDate] ); recFields.insert( ORecur::Created, map[OEvent::FRCreated] ); recFields.insert( ORecur::Exceptions, map[OEvent::FRExceptions] ); ORecur recur( recFields ); setRecurrence( recur ); } }
bool IncidenceConverter::convertToCalendarItem(KCal::Incidence *incidence, ngwt__CalendarItem *item) { kdDebug() << k_funcinfo << endl; //TODO: support the new iCal standard recurrence rule // ngwt__CalendarItem item->rdate = 0; item->rrule = 0; item->exdate = 0; item->recurrenceKey = 0; item->iCalId = 0; // ngwt__Mail item->subject = 0; item->originalSubject = 0; item->subjectPrefix = 0; item->distribution = 0; item->message = 0; item->attachments = 0; item->options = 0; item->link = 0; item->hasAttachment = false; item->size = 0; item->subType = 0; item->nntpOrImap = 0; item->smimeType = 0; // ngwt__BoxEntry item->status = 0; item->thread = 0; item->msgId = 0; item->messageId = 0; item->source = 0; item->returnSentItemsId = 0; item->delivered = 0; item->class_ = 0; item->security = 0; item->comment = 0; // ngwt__ContainerItem item->categories = 0; item->created = 0; item->customs = 0; // ngwt__Item item->id = 0; item->name = 0; item->version = 0; item->modified = 0; item->changes = 0; QString id = incidence->customProperty("GWRESOURCE", "UID"); if(!id.isEmpty()) item->id = qStringToString(id); // Container if(!incidence->customProperty("GWRESOURCE", "CONTAINER").isEmpty()) { std::vector<ngwt__ContainerRef *> *container = soap_new_std__vectorTemplateOfPointerTongwt__ContainerRef(soap(), -1); ngwt__ContainerRef *containerRef = soap_new_ngwt__ContainerRef(soap(), -1); containerRef->deleted = 0; containerRef->__item = incidence->customProperty("GWRESOURCE", "CONTAINER").utf8(); container->push_back(containerRef); item->container = *container; } // secrecy item->class_ = (ngwt__ItemClass *)soap_malloc(soap(), sizeof(ngwt__ItemClass)); switch(incidence->secrecy()) { case KCal::Event::SecrecyPublic: *item->class_ = Public; break; case KCal::Event::SecrecyPrivate: *item->class_ = Private; break; case KCal::Event::SecrecyConfidential: *item->class_ = Private; break; } // options item->options = soap_new_ngwt__ItemOptions(soap(), -1); item->options->concealSubject = 0; item->options->delayDeliveryUntil = 0; item->options->expires = 0; item->options->hidden = 0; item->options->priority = Standard; // summary if(!incidence->summary().isEmpty()) item->subject = qStringToString(incidence->summary()); // TODO: reinstate when we know that this isn't causing problems with recurrence // if ( incidence->created().isValid() ) { // item->created = qDateTimeToChar( incidence->created(), mTimezone ); // } else // item->created = 0; // if ( incidence->lastModified().isValid() ) // item->modified = qDateTimeToChar( incidence->lastModified(), mTimezone ); setItemDescription(incidence, item); item->source = (ngwt__ItemSource *)soap_malloc(soap(), sizeof(ngwt__ItemSource)); #if 1 if(incidence->attendeeCount() > 0) { setAttendees(incidence, item); *item->source = sent_; } else *item->source = personal_; #endif setRecurrence(incidence, item); return true; }
/** * set the recurrence * @param rp The ORecur object with the new recurrence rules */ void ORecurranceWidget::setRecurrence( const ORecur& rp ) { setRecurrence( rp, start ); }
/** * set the start date * @param date the new start date */ void ORecurranceWidget::setStartDate( const QDate& date ) { setRecurrence( recurrence(), date ); }