void IncidenceConverter::setAttendees(KCal::Incidence *incidence, ngwt__CalendarItem *item) { item->distribution = soap_new_ngwt__Distribution(soap(), -1); item->distribution->from = soap_new_ngwt__From(soap(), -1); // ngwt__From item->distribution->from->replyTo = 0; // ngwt__NameAndEmail item->distribution->from->displayName = 0; item->distribution->from->email = 0; item->distribution->from->uuid = 0; item->distribution->from->displayName = qStringToString(incidence->organizer().name()); item->distribution->from->email = qStringToString(incidence->organizer().email()); if(!mFromName.isEmpty()) item->distribution->from->displayName = qStringToString(mFromName); if(!mFromEmail.isEmpty()) item->distribution->from->email = qStringToString(mFromEmail); if(!mFromUuid.isEmpty()) item->distribution->from->uuid = qStringToString(mFromUuid); QString to; // To list consists of display names of organizer and attendees separated by "; " to += incidence->organizer().name(); item->distribution->sendoptions = soap_new_ngwt__SendOptions(soap(), -1); item->distribution->sendoptions->requestReply = 0; item->distribution->sendoptions->mimeEncoding = 0; item->distribution->sendoptions->notification = 0; item->distribution->sendoptions->statusTracking = soap_new_ngwt__StatusTracking(soap(), -1); item->distribution->sendoptions->statusTracking->autoDelete = nullptr; item->distribution->sendoptions->statusTracking->__item = All_; item->distribution->recipients = soap_new_ngwt__RecipientList(soap(), -1); item->distribution->recipients->recipient = *(soap_new_std__vectorTemplateOfPointerTongwt__Recipient(soap(), -1)); KCal::Attendee::List attendees = incidence->attendees(); KCal::Attendee::List::ConstIterator it; for(it = attendees.begin(); it != attendees.end(); ++it) { if(!to.isEmpty()) to += QString::fromLatin1("; %1").arg((*it)->name()); kdDebug() << "IncidenceConverter::setAttendees(), adding " << (*it)->fullName() << endl; QString uuid; QValueList<KABC::Addressee> addList = KABC::StdAddressBook::self()->findByEmail((*it)->email()); if(!addList.first().isEmpty()) uuid = addList.first().custom("GWRESOURCE", "UUID"); //uuid may be mandatory for the recipients list to be stored on the server... item->distribution->recipients->recipient.push_back(createRecipient((*it)->name(), (*it)->email(), uuid)); } item->distribution->to = qStringToString(to); item->distribution->cc = 0; item->distribution->bc = 0; }
void Smtp::dnsLookupHelper() { QValueList<QDns::MailServer> s = mxLookup->mailServers(); if ( s.isEmpty() ) { if ( !mxLookup->isWorking() ) emit status( tr( "Error in MX record lookup" ) ); return; } emit status( tr( "Connecting to %1" ).arg( s.first().name ) ); socket->connectToHost( s.first().name, 25 ); t = new QTextStream( socket ); }
void subversionPart::slotCopy() { // error check if( m_urls.count() > 1 ){ KMessageBox::error( (QWidget*)project()->mainWindow()->main(), i18n("Please select only one item for subversion switch") ); return; } if( m_urls.count() < 1 ) return; // retrieve repository info from local-copy metadata which will be displayed in dialog box KURL wcPath = m_urls.first(); QMap< KURL, SvnGlobal::SvnInfoHolder> holderMap; SvnGlobal::SvnInfoHolder holder; m_impl->clientInfo( wcPath, false, holderMap ); QValueList< SvnGlobal::SvnInfoHolder > holderList = holderMap.values(); holder = holderList.first(); // start input dialog SvnCopyDialog dlg( wcPath.prettyURL(), &holder, (QWidget*)project()->mainWindow()->main()); if( dlg.exec() != QDialog::Accepted ) return; // retrieve user input KURL srcUrl = dlg.sourceUrl(); int rev = dlg.revision(); QString revKind = dlg.revKind(); KURL dest = dlg.destUrl(); kdDebug(9036) << " SRC: " << srcUrl << " DEST: " << dest << " Revnum: " << rev << " RevKind: " << revKind << endl; m_impl->svnCopy( srcUrl, rev, revKind, dest ); }
void Undo::saveReactivates(const QValueList<KAEvent> &events) { int count = events.count(); if(count == 1) saveReactivate(events.first()); else if(count > 1) { new UndoReactivates(UNDO, events); emitChanged(); } }
void Undo::saveDeletes(const QValueList<KAEvent> &events) { int count = events.count(); if(count == 1) saveDelete(events.first()); else if(count > 1) { new UndoDeletes(UNDO, events); for(QValueList<KAEvent>::ConstIterator it = events.begin(); it != events.end(); ++it) removeRedos((*it).id()); // remove any redos which are made invalid by these deletions emitChanged(); } }
QStringList Rad::kanjiByRad(const QStringList &list) { //kdDebug() << "kanjiByRad (list version)\n"; QStringList ret; QValueList<QStringList> lists; for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { //kdDebug() << "loading radical " << *it << endl; lists.append(kanjiByRad(*it)); } QStringList first = lists.first(); lists.pop_front(); for (QStringList::Iterator kit = first.begin(); kit != first.end(); ++kit) { //kdDebug() << "kit is " << *kit << endl; QValueList<bool> outcomes; for (QValueList<QStringList>::Iterator it = lists.begin(); it != lists.end(); ++it) { //kdDebug() << "looping through lists\n"; outcomes.append((*it).contains(*kit) > 0); } const bool containsBool = false; if ((outcomes.contains(containsBool) < 1)) { //kdDebug() << "appending " << *kit << endl; ret.append(*kit); } else { //kdDebug() << "not appending " << *kit << endl; } } return ret; }
void subversionPart::slotSwitch() { if( m_urls.count() > 1 ){ KMessageBox::error( (QWidget*)project()->mainWindow()->main(), i18n("Please select only one item for subversion switch") ); return; } if( m_urls.count() < 1 ) return; // retrieve repository info from local-copy metadata which will be displayed in dialog box KURL wcPath = m_urls.first(); QMap< KURL, SvnGlobal::SvnInfoHolder> holderMap; SvnGlobal::SvnInfoHolder holder; m_impl->clientInfo( wcPath, false, holderMap ); QValueList< SvnGlobal::SvnInfoHolder > holderList = holderMap.values(); holder = holderList.first(); // invoke dialog box SvnSwitchDlg dlg( &holder, wcPath.path(), (QWidget*)project()->mainWindow()->main() ); if( dlg.exec() != QDialog::Accepted ){ return; } // check target url's validity KURL repositUrl = KURL( dlg.destUrl() ); if( !repositUrl.isValid() ){ KMessageBox::error( (QWidget*)project()->mainWindow()->main(), i18n("The destination URL is invalid") ); return; } // call core if( dlg.switchOnly() ) m_impl->switchTree( wcPath, repositUrl, -1, "HEAD", dlg.recursive() ); else if( dlg.relocation() ) m_impl->switchRelocate( wcPath, dlg.currentUrl(), repositUrl, dlg.recursive() ); else KMessageBox::error( (QWidget*)project()->mainWindow()->main(), i18n("Fail to conduct subversion switch. No action was selected") ); }
void Editor::fill() { setUpdatesEnabled(false); d->itemToSelectLater = 0; qApp->eventLoop()->processEvents(QEventLoop::AllEvents); hideEditor(); KListView::clear(); d->itemDict.clear(); clearWidgetCache(); if(!d->set) { d->topItem = 0; setUpdatesEnabled(true); triggerUpdate(); return; } d->topItem = new EditorDummyItem(this); const QValueList<QCString> groupNames = d->set->groupNames(); // kopropertydbg << "Editor::fill(): group names = " << groupNames.count() << endl; if(groupNames.count() == 1) { // one group (default one), so don't show groups //add flat set of properties const QValueList<QCString>& propertyNames = d->set->propertyNamesForGroup( groupNames.first() ); QValueListConstIterator<QCString> it = propertyNames.constBegin(); for( ; it != propertyNames.constEnd(); ++it) addItem(*it, d->topItem); } else { // create a groupItem for each group EditorGroupItem *prevGroupItem = 0; int sortOrder = 0; for (QValueListConstIterator<QCString> it = groupNames.constBegin(); it!=groupNames.constEnd(); ++it, sortOrder++) { const QValueList<QCString>& propertyNames = d->set->propertyNamesForGroup(*it); EditorGroupItem *groupItem; if (prevGroupItem) groupItem = new EditorGroupItem(d->topItem, prevGroupItem, d->set->groupDescription(*it), d->set->groupIcon(*it), sortOrder ); else groupItem = new EditorGroupItem(d->topItem, d->set->groupDescription(*it), d->set->groupIcon(*it), sortOrder ); QValueList<QCString>::ConstIterator it2 = propertyNames.constBegin(); for( ; it2 != propertyNames.constEnd(); ++it2) addItem(*it2, groupItem); prevGroupItem = groupItem; } } // repaint(); if (firstChild()) { setCurrentItem(firstChild()); setSelected(firstChild(), true); slotClicked(firstChild()); updateGroupLabelsPosition(); } setUpdatesEnabled(true); // aaah, call this instead of update() as explained here http://lists.trolltech.com/qt-interest/2000-06/thread00337-0.html triggerUpdate(); }
\link datastreamformat.html Format of the QDataStream operators \endlink */ QDataStream &operator<<( QDataStream &s, const QKeySequence &keysequence ) { QValueList<int> list; list += (int) keysequence; s << list; return s; } /*! \relates QKeySequence Reads a key sequence from the stream \a s into the key sequence \a keysequence. */ QDataStream &operator>>( QDataStream &s, QKeySequence &keysequence ) { QValueList<int> list; s >> list; keysequence = QKeySequence( list.first() ); return s; } } #endif //QT_NO_DATASTREAM #endif #endif //QT_NO_ACCEL
void AdvancedConnector::dns_done() { bool failed = false; QHostAddress addr; #ifdef NO_NDNS //if(!d->qdns) // return; // apparently we sometimes get this signal even though the results aren' t ready //if(d->qdns->isWorking()) // return; //SafeDeleteLock s(&d->sd); // grab the address list and destroy the qdns object QValueList<QHostAddress> list = d->qdns->addresses(); d->qdns->disconnect(this); d->qdns->deleteLater(); //d->sd.deleteLater(d->qdns); d->qdns = 0; if(list.isEmpty()) { if(d->aaaa) { d->aaaa = false; do_resolve(); return; } //do_resolve(); //return; failed = true; } else addr = list.first(); #else if(d->dns.result() == 0) failed = true; else addr = QHostAddress(d->dns.result()); #endif if(failed) { #ifdef XMPP_DEBUG printf("dns1\n"); #endif // using proxy? then try the unresolved host through the proxy if(d->proxy.type() != Proxy::None) { #ifdef XMPP_DEBUG printf("dns1.1\n"); #endif do_connect(); } else if(d->using_srv) { #ifdef XMPP_DEBUG printf("dns1.2\n"); #endif if(d->servers.isEmpty()) { #ifdef XMPP_DEBUG printf("dns1.2.1\n"); #endif cleanup(); d->errorCode = ErrConnectionRefused; error(); } else { #ifdef XMPP_DEBUG printf("dns1.2.2\n"); #endif tryNextSrv(); return; } } else { #ifdef XMPP_DEBUG printf("dns1.3\n"); #endif cleanup(); d->errorCode = ErrHostNotFound; error(); } } else { #ifdef XMPP_DEBUG printf("dns2\n"); #endif d->host = addr.toString(); do_connect(); } }
bool KexiSimplePrintingCommand::print(const QString& aTitleText) { KexiDB::Connection *conn = m_mainWin->project()->dbConnection(); KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId); if (!tableOrQuery.table() && !tableOrQuery.query()) { //! @todo item not found return false; } QString titleText(aTitleText.stripWhiteSpace()); if (titleText.isEmpty()) titleText = tableOrQuery.captionOrName(); KexiSimplePrintingEngine engine(m_settings, this); QString errorMessage; if (!engine.init(*conn, tableOrQuery, titleText, errorMessage)) { if (!errorMessage.isEmpty()) KMessageBox::sorry(m_mainWin, errorMessage, i18n("Printing")); return false; } //setup printing #ifdef Q_WS_WIN QPrinter printer(QPrinter::HighResolution); printer.setOrientation( m_settings.pageLayout.orientation == PG_PORTRAIT ? QPrinter::Portrait : QPrinter::Landscape ); printer.setPageSize( (QPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) ); // "chicken-egg" problem: // we cannot use real from/to values in setMinMax() and setFromTo() // because page count is known after obtaining print settings printer.setFromTo(1,1); #else KPrinter printer; printer.setOrientation( m_settings.pageLayout.orientation == PG_PORTRAIT ? KPrinter::Portrait : KPrinter::Landscape ); printer.setPageSize( (KPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) ); #endif printer.setFullPage(true); QString docName( titleText ); printer.setDocName( docName ); printer.setCreator(KEXI_APP_NAME); if ( !printer.setup( m_mainWin ) ) { return true; } // now we have final settings //! @todo get printer.pageOrder() (for reversed order requires improved engine) QPainter painter; if (!painter.begin(&printer)) { //! @todo msg return false; } engine.calculatePagesCount(painter); uint loops, loopsPerPage; QValueList<int> pagesToPrint; int fromPage = 0; #ifdef Q_WS_WIN int toPage = 0; if (QPrinter::PageRange == printer.printRange()) { fromPage = printer.fromPage(); toPage = printer.toPage(); } if (fromPage==0 || toPage==0) { fromPage = 0; toPage = (int)engine.pagesCount()-1; } else { fromPage--; if (toPage > (int)engine.pagesCount()) toPage = (int)engine.pagesCount(); toPage--; } // win32 only supports one range, build the list for (int i = fromPage; i<=toPage; i++) { pagesToPrint.append(i); } // on win32 the OS does perform buffering (only when collation is off, each copy needs to be repeated) loops = 1; loopsPerPage = printer.collateCopies() ? 1 : printer.numCopies(); #else // on !win32 print QPrinter::numCopies() times (the OS does not perform buffering) pagesToPrint = printer.pageList(); kdDebug() << pagesToPrint << endl; if (pagesToPrint.isEmpty()) { fromPage = 0; for (int i = 0; i<(int)engine.pagesCount(); i++) { pagesToPrint.append(i); } } else fromPage = pagesToPrint.first(); if (printer.collate()==KPrinter::Collate) { //collation: p1, p2,..pn; p1, p2,..pn; ......; p1, p2,..pn loops = printer.numCopies(); loopsPerPage = 1; } else { //no collation: p1, p1, ..., p1; p2, p2, ..., p2; ......; pn, pn,..pn loops = 1; loopsPerPage = printer.numCopies(); } //! @todo also look at printer.pageSet() option : all/odd/even pages #endif // now, total number of printed pages is printer.numCopies()*printer.pageList().count() kdDebug() << "printing..." << endl; bool firstPage = true; for (uint copy = 0;copy < loops; copy++) { kdDebug() << "copy " << (copy+1) << " of " << loops << endl; uint pageNumber = fromPage; QValueList<int>::ConstIterator pagesIt = pagesToPrint.constBegin(); for(;(int)pageNumber == fromPage || !engine.eof(); ++pageNumber) { kdDebug() << "printing..." << endl; if (pagesIt == pagesToPrint.constEnd()) //no more pages to print break; if ((int)pageNumber < *pagesIt) { //skip pages without printing (needed for computation) engine.paintPage(pageNumber, painter, false); continue; } if (*pagesIt < (int)pageNumber) { //sanity ++pagesIt; continue; } for (uint onePageCounter = 0; onePageCounter < loopsPerPage; onePageCounter++) { if (!firstPage) printer.newPage(); else firstPage = false; kdDebug() << "page #" << pageNumber << endl; engine.paintPage(pageNumber, painter); } ++pagesIt; } } kdDebug() << "end of printing." << endl; // stop painting, this will automatically send the print data to the printer if (!painter.end()) return false; if (!engine.done()) return false; return true; }
/****************************************************************************** * Initialise a KCal::Recurrence to be the same as this instance. * Additional recurrence rules are created as necessary if it recurs on Feb 29th. */ void KARecurrence::writeRecurrence(KCal::Recurrence &recur) const { recur.clear(); recur.setStartDateTime(startDateTime()); recur.setExDates(exDates()); recur.setExDateTimes(exDateTimes()); const RecurrenceRule *rrule = defaultRRuleConst(); if(!rrule) return; int freq = frequency(); int count = duration(); static_cast<KARecurrence *>(&recur)->setNewRecurrenceType(rrule->recurrenceType(), freq); if(count) recur.setDuration(count); else recur.setEndDateTime(endDateTime()); switch(type()) { case DAILY: if(rrule->byDays().isEmpty()) break; // fall through to rWeekly case WEEKLY: case MONTHLY_POS: recur.defaultRRule(true)->setByDays(rrule->byDays()); break; case MONTHLY_DAY: recur.defaultRRule(true)->setByMonthDays(rrule->byMonthDays()); break; case ANNUAL_POS: recur.defaultRRule(true)->setByMonths(rrule->byMonths()); recur.defaultRRule()->setByDays(rrule->byDays()); break; case ANNUAL_DATE: { QValueList<int> months = rrule->byMonths(); QValueList<int> days = monthDays(); bool special = (mFeb29Type != FEB29_FEB29 && !days.isEmpty() && days.first() == 29 && months.remove(2)); RecurrenceRule *rrule1 = recur.defaultRRule(); rrule1->setByMonths(months); rrule1->setByMonthDays(days); if(!special) break; // It recurs on the 29th February. // Create an additional 60th day of the year, or last day of February, rule. RecurrenceRule *rrule2 = new RecurrenceRule(); rrule2->setRecurrenceType(RecurrenceRule::rYearly); rrule2->setFrequency(freq); rrule2->setStartDt(startDateTime()); rrule2->setFloats(doesFloat()); if(!count) rrule2->setEndDt(endDateTime()); if(mFeb29Type == FEB29_MAR1) { QValueList<int> ds; ds.append(60); rrule2->setByYearDays(ds); } else { QValueList<int> ds; ds.append(-1); rrule2->setByMonthDays(ds); QValueList<int> ms; ms.append(2); rrule2->setByMonths(ms); } if(months.isEmpty()) { // Only February recurs. // Replace the RRULE and keep the recurrence count the same. if(count) rrule2->setDuration(count); recur.unsetRecurs(); } else { // Months other than February also recur on the 29th. // Remove February from the list and add a separate RRULE for February. if(count) { rrule1->setDuration(-1); rrule2->setDuration(-1); if(count > 0) { /* Adjust counts in the two rules to keep the correct occurrence total. * Note that durationTo() always includes the start date. Since for an * individual RRULE the start date may not actually be included, we need * to decrement the count if the start date doesn't actually recur in * this RRULE. * Note that if the count is small, one of the rules may not recur at * all. In that case, retain it so that the February 29th characteristic * is not lost should the user later change the recurrence count. */ QDateTime end = endDateTime(); kdDebug() << "29th recurrence: count=" << count << ", end date=" << end.toString() << endl; int count1 = rrule1->durationTo(end) - (rrule1->recursOn(startDate()) ? 0 : 1); if(count1 > 0) rrule1->setDuration(count1); else rrule1->setEndDt(startDateTime()); int count2 = rrule2->durationTo(end) - (rrule2->recursOn(startDate()) ? 0 : 1); if(count2 > 0) rrule2->setDuration(count2); else rrule2->setEndDt(startDateTime()); } } } recur.addRRule(rrule2); break; } default: break; } }
/****************************************************************************** * Must be called after presetting with a KCal::Recurrence, to convert the * recurrence to KARecurrence types: * - Convert hourly recurrences to minutely. * - Remove all but the first day in yearly date recurrences. * - Check for yearly recurrences falling on February 29th and adjust them as * necessary. A 29th of the month rule can be combined with either a 60th day * of the year rule or a last day of February rule. */ void KARecurrence::fix() { mCachedType = -1; mFeb29Type = FEB29_FEB29; int convert = 0; int days[2] = { 0, 0 }; RecurrenceRule *rrules[2]; RecurrenceRule::List rrulelist = rRules(); RecurrenceRule::List::ConstIterator rr = rrulelist.begin(); for(int i = 0; i < 2 && rr != rrulelist.end(); ++i, ++rr) { RecurrenceRule *rrule = *rr; rrules[i] = rrule; bool stop = true; int rtype = recurrenceType(rrule); switch(rtype) { case rHourly: // Convert an hourly recurrence to a minutely one rrule->setRecurrenceType(RecurrenceRule::rMinutely); rrule->setFrequency(rrule->frequency() * 60); // fall through to rMinutely case rMinutely: case rDaily: case rWeekly: case rMonthlyDay: case rMonthlyPos: case rYearlyPos: if(!convert) ++rr; // remove all rules except the first break; case rOther: if(dailyType(rrule)) { // it's a daily rule with BYDAYS if(!convert) ++rr; // remove all rules except the first } break; case rYearlyDay: { // Ensure that the yearly day number is 60 (i.e. Feb 29th/Mar 1st) if(convert) { // This is the second rule. // Ensure that it can be combined with the first one. if(days[0] != 29 || rrule->frequency() != rrules[0]->frequency() || rrule->startDt() != rrules[0]->startDt()) break; } QValueList<int> ds = rrule->byYearDays(); if(!ds.isEmpty() && ds.first() == 60) { ++convert; // this rule needs to be converted days[i] = 60; stop = false; break; } break; // not day 60, so remove this rule } case rYearlyMonth: { QValueList<int> ds = rrule->byMonthDays(); if(!ds.isEmpty()) { int day = ds.first(); if(convert) { // This is the second rule. // Ensure that it can be combined with the first one. if(day == days[0] || day == -1 && days[0] == 60 || rrule->frequency() != rrules[0]->frequency() || rrule->startDt() != rrules[0]->startDt()) break; } if(ds.count() > 1) { ds.clear(); // remove all but the first day ds.append(day); rrule->setByMonthDays(ds); } if(day == -1) { // Last day of the month - only combine if it's February QValueList<int> months = rrule->byMonths(); if(months.count() != 1 || months.first() != 2) day = 0; } if(day == 29 || day == -1) { ++convert; // this rule may need to be converted days[i] = day; stop = false; break; } } if(!convert) ++rr; break; } default: break; } if(stop) break; } // Remove surplus rules for(; rr != rrulelist.end(); ++rr) { removeRRule(*rr); delete *rr; } QDate end; int count; QValueList<int> months; if(convert == 2) { // There are two yearly recurrence rules to combine into a February 29th recurrence. // Combine the two recurrence rules into a single rYearlyMonth rule falling on Feb 29th. // Find the duration of the two RRULEs combined, using the shorter of the two if they differ. if(days[0] != 29) { // Swap the two rules so that the 29th rule is the first RecurrenceRule *rr = rrules[0]; rrules[0] = rrules[1]; // the 29th rule rrules[1] = rr; int d = days[0]; days[0] = days[1]; days[1] = d; // the non-29th day } // If February is included in the 29th rule, remove it to avoid duplication months = rrules[0]->byMonths(); if(months.remove(2)) rrules[0]->setByMonths(months); count = combineDurations(rrules[0], rrules[1], end); mFeb29Type = (days[1] == 60) ? FEB29_MAR1 : FEB29_FEB28; } else if(convert == 1 && days[0] == 60) { // There is a single 60th day of the year rule. // Convert it to a February 29th recurrence. count = duration(); if(!count) end = endDate(); mFeb29Type = FEB29_MAR1; } else return; // Create the new February 29th recurrence setNewRecurrenceType(RecurrenceRule::rYearly, frequency()); RecurrenceRule *rrule = defaultRRule(); months.append(2); rrule->setByMonths(months); QValueList<int> ds; ds.append(29); rrule->setByMonthDays(ds); if(count) setDuration(count); else setEndDate(end); }
void Incidence::setRecurrence(KCal::Recurrence *recur) { mRecurrence.interval = recur->frequency(); switch(recur->recurrenceType()) { case KCal::Recurrence::rMinutely: // Not handled by the kolab XML mRecurrence.cycle = "minutely"; break; case KCal::Recurrence::rHourly: // Not handled by the kolab XML mRecurrence.cycle = "hourly"; break; case KCal::Recurrence::rDaily: mRecurrence.cycle = "daily"; break; case KCal::Recurrence::rWeekly: // every X weeks mRecurrence.cycle = "weekly"; { QBitArray arr = recur->days(); for(uint idx = 0 ; idx < 7 ; ++idx) if(arr.testBit(idx)) mRecurrence.days.append(s_weekDayName[idx]); } break; case KCal::Recurrence::rMonthlyPos: { mRecurrence.cycle = "monthly"; mRecurrence.type = "weekday"; QValueList<KCal::RecurrenceRule::WDayPos> monthPositions = recur->monthPositions(); if(!monthPositions.isEmpty()) { KCal::RecurrenceRule::WDayPos monthPos = monthPositions.first(); // TODO: Handle multiple days in the same week mRecurrence.dayNumber = QString::number(monthPos.pos()); mRecurrence.days.append(s_weekDayName[ monthPos.day() - 1 ]); // Not (properly) handled(?): monthPos.negative (nth days before end of month) } break; } case KCal::Recurrence::rMonthlyDay: { mRecurrence.cycle = "monthly"; mRecurrence.type = "daynumber"; QValueList<int> monthDays = recur->monthDays(); // ####### Kolab XML limitation: only the first month day is used if(!monthDays.isEmpty()) mRecurrence.dayNumber = QString::number(monthDays.first()); break; } case KCal::Recurrence::rYearlyMonth: // (day n of Month Y) { mRecurrence.cycle = "yearly"; mRecurrence.type = "monthday"; QValueList<int> rmd = recur->yearDates(); int day = !rmd.isEmpty() ? rmd.first() : recur->startDate().day(); mRecurrence.dayNumber = QString::number(day); QValueList<int> months = recur->yearMonths(); if(!months.isEmpty()) mRecurrence.month = s_monthName[ months.first() - 1 ]; // #### Kolab XML limitation: only one month specified break; } case KCal::Recurrence::rYearlyDay: // YearlyDay (day N of the year). Not supported by Outlook mRecurrence.cycle = "yearly"; mRecurrence.type = "yearday"; mRecurrence.dayNumber = QString::number(recur->yearDays().first()); break; case KCal::Recurrence::rYearlyPos: // (weekday X of week N of month Y) mRecurrence.cycle = "yearly"; mRecurrence.type = "weekday"; QValueList<int> months = recur->yearMonths(); if(!months.isEmpty()) mRecurrence.month = s_monthName[ months.first() - 1 ]; // #### Kolab XML limitation: only one month specified QValueList<KCal::RecurrenceRule::WDayPos> monthPositions = recur->yearPositions(); if(!monthPositions.isEmpty()) { KCal::RecurrenceRule::WDayPos monthPos = monthPositions.first(); // TODO: Handle multiple days in the same week mRecurrence.dayNumber = QString::number(monthPos.pos()); mRecurrence.days.append(s_weekDayName[ monthPos.day() - 1 ]); //mRecurrence.dayNumber = QString::number( *recur->yearNums().getFirst() ); // Not handled: monthPos.negative (nth days before end of month) } break; } int howMany = recur->duration(); if(howMany > 0) { mRecurrence.rangeType = "number"; mRecurrence.range = QString::number(howMany); } else if(howMany == 0) { mRecurrence.rangeType = "date"; mRecurrence.range = dateToString(recur->endDate()); } else { mRecurrence.rangeType = "none"; } }