Пример #1
0
QString Entry::debugInfo() const
{
    QString info;
    info += QLatin1String("### Entry: ###################\n");
    if (!title().isEmpty())
        info += QLatin1String("title: #") + title() + QLatin1String("#\n");
    if (!summary().isEmpty())
        info += QLatin1String("summary: #") + summary() + QLatin1String("#\n");
    if (!id().isEmpty())
        info += QLatin1String("id: #") + id() + QLatin1String("#\n");
    if (!content().isNull())
        info += content().debugInfo();
    
    if (!rights().isEmpty())
        info += QLatin1String("rights: #") + rights() + QLatin1String("#\n");
    
    
    QString dupdated = dateTimeToString(updated());
    if (!dupdated.isNull())
        info += QLatin1String("updated: #") + dupdated + QLatin1String("#\n");
    
    QString dpublished = dateTimeToString(published());
    if (!dpublished.isNull())
        info += QLatin1String("published: #") + dpublished + QLatin1String("#\n");
    
    QList<Link> dlinks = links();
    QList<Link>::ConstIterator endlinks = dlinks.constEnd();
    for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it)
        info += (*it).debugInfo();
    
    QList<Category> dcats = categories();
    QList<Category>::ConstIterator endcats = dcats.constEnd();
    for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Authors: ###################\n");
    
    QList<Person> dauthors = authors();
    QList<Person>::ConstIterator endauthors = dauthors.constEnd();
    for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Contributors: ###################\n");
    
    QList<Person> dcontri = contributors();
    QList<Person>::ConstIterator endcontri = dcontri.constEnd();
    for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it)
        info += (*it).debugInfo();
    
    if (!source().isNull())
        info += source().debugInfo();
    
    info += QLatin1String("### Entry end ################\n");

    return info;
}
std::string TaskDeadline::taskDetailsToString() {
	std::ostringstream output;
	output << getTaskDesc() << std::endl;
	output << dateTimeToString() << std::endl;
	output << statusToString() << std::endl;
	return output.str();
}
Пример #3
0
std::string DelaySerializer::serializePayload(boost::shared_ptr<Delay> delay)  const {
	XMLElement delayElement("delay", "urn:xmpp:delay");
	if (delay->getFrom() && delay->getFrom()->isValid()) {
		delayElement.setAttribute("from", delay->getFrom()->toString());
	}
	delayElement.setAttribute("stamp", dateTimeToString(delay->getStamp()));
	return delayElement.serialize();
}
Пример #4
0
QString Source::debugInfo() const
{
    QString info;
    info += QLatin1String("### Source: ###################\n");
    if (!title().isEmpty())
        info += QLatin1String("title: #") + title() + QLatin1String("#\n");
    if (!subtitle().isEmpty())
        info += QLatin1String("subtitle: #") + subtitle() + QLatin1String("#\n");
    if (!id().isEmpty())
        info += QLatin1String("id: #") + id() + QLatin1String("#\n");

    if (!rights().isEmpty())
        info += QLatin1String("rights: #") + rights() + QLatin1String("#\n");
    if (!icon().isEmpty())
        info += QLatin1String("icon: #") + icon() + QLatin1String("#\n");
    if (!logo().isEmpty())
        info += QLatin1String("logo: #") + logo() + QLatin1String("#\n");
    if (!generator().isNull())
        info += generator().debugInfo();
    
    
    QString dupdated = dateTimeToString(updated());
    if (!dupdated.isNull())
        info += QLatin1String("updated: #") + dupdated + QLatin1String("#\n");
    
    QList<Link> dlinks = links();
    QList<Link>::ConstIterator endlinks = dlinks.constEnd();
    for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it)
        info += (*it).debugInfo();
    
    QList<Category> dcats = categories();
    QList<Category>::ConstIterator endcats = dcats.constEnd();
    for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Authors: ###################\n");
    
    QList<Person> dauthors = authors();
    QList<Person>::ConstIterator endauthors = dauthors.constEnd();
    for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Contributors: ###################\n");
    
    QList<Person> dcontri = contributors();
    QList<Person>::ConstIterator endcontri = dcontri.constEnd();
    for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it)
        info += (*it).debugInfo();
    
    info += QLatin1String("### Source end ################\n");

    return info;
}
Пример #5
0
QJsonObject KNMusicDatabase::createRowObject(const int &row)
{
    QJsonObject currentSong;
    QJsonArray currentSongText;
    for(int i=0; i<KNMusicGlobal::MusicDataCount; i++)
    {
        currentSongText.append(m_model->itemText(row, i));
    }
    currentSong["Text"]=currentSongText;
    currentSong["Time"]=m_model->itemRoleData(row, KNMusicGlobal::Time, Qt::UserRole).toInt();
    currentSong["BitRate"]=m_model->itemRoleData(row, KNMusicGlobal::BitRate, Qt::UserRole).toFloat();
    currentSong["DateModified"]=dateTimeToString(m_model->itemRoleData(row, KNMusicGlobal::DateModified,
                                                      Qt::UserRole).toDateTime());
    currentSong["LastPlayed"]=dateTimeToString(m_model->itemRoleData(row, KNMusicGlobal::LastPlayed,
                                                      Qt::UserRole).toDateTime());
    currentSong["DateAdded"]=dateTimeToString(m_model->itemRoleData(row, KNMusicGlobal::DateAdded,
                                                      Qt::UserRole).toDateTime());
    currentSong["SampleRate"]=m_model->itemRoleData(row, KNMusicGlobal::SampleRate, Qt::UserRole).toFloat();
    currentSong["Size"]=m_model->itemRoleData(row, KNMusicGlobal::Size, Qt::UserRole).toInt();
    currentSong["Time"]=m_model->itemRoleData(row, KNMusicGlobal::Time, Qt::UserRole).toInt();
    currentSong["FilePath"]=m_model->itemRoleData(row, KNMusicGlobal::Name, Qt::UserRole).toString();
    currentSong["Rating"]=m_model->itemRoleData(row, KNMusicGlobal::Rating, Qt::DisplayRole).toInt();
    return currentSong;
}
Пример #6
0
QString Item::debugInfo() const
{
    QString info;
    info += QLatin1String("### Item: ###################\n");
    if (!title().isNull())
        info += QLatin1String("title: #") + title() + QLatin1String("#\n");
    if (!link().isNull())
        info += QLatin1String("link: #") + link() + QLatin1String("#\n");
    if (!description().isNull())
        info += QLatin1String("description: #") + description() + QLatin1String("#\n");
    if (!content().isNull())
        info += QLatin1String("content: #") + content() + QLatin1String("#\n");
    if (!author().isNull())
        info += QLatin1String("author: #") + author() + QLatin1String("#\n");
    if (!comments().isNull())
        info += QLatin1String("comments: #") + comments() + QLatin1String("#\n");
    QString dpubdate = dateTimeToString(pubDate());
    if (!dpubdate.isNull())
        info += QLatin1String("pubDate: #") + dpubdate + QLatin1String("#\n");
    if (!guid().isNull())
        info += QLatin1String("guid: #") + guid() + QLatin1String("#\n");
    if (guidIsPermaLink())
        info += QLatin1String("guid is PL: #true#\n");
    if (!source().isNull())
         info += source().debugInfo();
    
    QList<Category> cats = categories();
    for (QList<Category>::ConstIterator it = cats.constBegin(); it != cats.constEnd(); ++it)
        info += (*it).debugInfo();
    QList<Enclosure> encs = enclosures();
    for (QList<Enclosure>::ConstIterator it = encs.constBegin(); it != encs.constEnd(); ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Item end ################\n");
    return info;
}
Пример #7
0
QString Session::sessionData()
{
    QString out;
    out.append("[SESSION]\n");
    // S_NAME
    out.append(QString("%1\n").arg(s_name));
    // S_DATETIME
    out.append(dateTimeToString());
    // S_PASSMARK
    out.append(QString("\n%1").arg(s_passmark.archiveData()));
    // S_SCORINGSYSTEM
    out.append(QString("\n%1").arg(s_scoringsystem.data()));
    // S_SNUM
    out.append(QString("\n%1").arg(s_students.count()));
    // S_NUMLOGENTRIES
    out.append(QString("\n%1").arg(s_log.count()));
    // S_LOGENTRIES
    LogEntry log_entry;
    for (int i = 0; i < s_log.count(); ++i) {
        log_entry = s_log.at(i);
        out.append(QString("\n%1").arg(log_entry.entryData()));
    }
    return out;
}
Пример #8
0
std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard)  const {
	XMLElement queryElement("vCard", "vcard-temp");
	if (!vcard->getVersion().empty()) {
		queryElement.addNode(boost::make_shared<XMLElement>("VERSION", "", vcard->getVersion()));
	}
	if (!vcard->getFullName().empty()) {
		queryElement.addNode(boost::make_shared<XMLElement>("FN", "", vcard->getFullName()));
	}
	if (!vcard->getGivenName().empty() || !vcard->getFamilyName().empty() || !vcard->getMiddleName().empty() || !vcard->getPrefix().empty() || !vcard->getSuffix().empty()) {
		boost::shared_ptr<XMLElement> nameElement(new XMLElement("N"));
		if (!vcard->getFamilyName().empty()) {
			nameElement->addNode(boost::make_shared<XMLElement>("FAMILY", "", vcard->getFamilyName()));
		}
		if (!vcard->getGivenName().empty()) {
			nameElement->addNode(boost::make_shared<XMLElement>("GIVEN", "", vcard->getGivenName()));
		}
		if (!vcard->getMiddleName().empty()) {
			nameElement->addNode(boost::make_shared<XMLElement>("MIDDLE", "", vcard->getMiddleName()));
		}
		if (!vcard->getPrefix().empty()) {
			nameElement->addNode(boost::make_shared<XMLElement>("PREFIX", "", vcard->getPrefix()));
		}
		if (!vcard->getSuffix().empty()) {
			nameElement->addNode(boost::make_shared<XMLElement>("SUFFIX", "", vcard->getSuffix()));
		}
		queryElement.addNode(nameElement);
	}
	foreach(const VCard::EMailAddress& emailAddress, vcard->getEMailAddresses()) {
		boost::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL"));
		emailElement->addNode(boost::make_shared<XMLElement>("USERID", "", emailAddress.address));
		if (emailAddress.isHome) {
			emailElement->addNode(boost::make_shared<XMLElement>("HOME"));
		}
		if (emailAddress.isWork) {
			emailElement->addNode(boost::make_shared<XMLElement>("WORK"));
		}
		if (emailAddress.isInternet) {
			emailElement->addNode(boost::make_shared<XMLElement>("INTERNET"));
		}
		if (emailAddress.isPreferred) {
			emailElement->addNode(boost::make_shared<XMLElement>("PREF"));
		}
		if (emailAddress.isX400) {
			emailElement->addNode(boost::make_shared<XMLElement>("X400"));
		}
		queryElement.addNode(emailElement);
	}
	if (!vcard->getNickname().empty()) {
		queryElement.addNode(boost::make_shared<XMLElement>("NICKNAME", "", vcard->getNickname()));
	}
	if (!vcard->getPhoto().empty() || !vcard->getPhotoType().empty()) {
		XMLElement::ref photoElement(new XMLElement("PHOTO"));
		if (!vcard->getPhotoType().empty()) {
			photoElement->addNode(boost::make_shared<XMLElement>("TYPE", "", vcard->getPhotoType()));
		}
		if (!vcard->getPhoto().empty()) {
			photoElement->addNode(boost::make_shared<XMLElement>("BINVAL", "", Base64::encode(vcard->getPhoto())));
		}
		queryElement.addNode(photoElement);
	}
	if (!vcard->getBirthday().is_not_a_date_time()) {
		queryElement.addNode(boost::make_shared<XMLElement>("BDAY", "", dateTimeToString(vcard->getBirthday())));
	}

	foreach(const VCard::Telephone& telephone, vcard->getTelephones()) {
		boost::shared_ptr<XMLElement> telElement(new XMLElement("TEL"));
		telElement->addNode(boost::make_shared<XMLElement>("NUMBER", "", telephone.number));
		if (telephone.isHome) {
			telElement->addNode(boost::make_shared<XMLElement>("HOME"));
		}
		if (telephone.isWork) {
			telElement->addNode(boost::make_shared<XMLElement>("WORK"));
		}
		if (telephone.isVoice) {
			telElement->addNode(boost::make_shared<XMLElement>("VOICE"));
		}
		if (telephone.isFax) {
			telElement->addNode(boost::make_shared<XMLElement>("FAX"));
		}
		if (telephone.isPager) {
			telElement->addNode(boost::make_shared<XMLElement>("PAGER"));
		}
		if (telephone.isMSG) {
			telElement->addNode(boost::make_shared<XMLElement>("MSG"));
		}
		if (telephone.isCell) {
			telElement->addNode(boost::make_shared<XMLElement>("CELL"));
		}
		if (telephone.isVideo) {
			telElement->addNode(boost::make_shared<XMLElement>("VIDEO"));
		}
		if (telephone.isBBS) {
			telElement->addNode(boost::make_shared<XMLElement>("BBS"));
		}
		if (telephone.isModem) {
			telElement->addNode(boost::make_shared<XMLElement>("MODEM"));
		}
		if (telephone.isISDN) {
			telElement->addNode(boost::make_shared<XMLElement>("ISDN"));
		}
		if (telephone.isPCS) {
			telElement->addNode(boost::make_shared<XMLElement>("PCS"));
		}
		if (telephone.isPreferred) {
			telElement->addNode(boost::make_shared<XMLElement>("PREF"));
		}
		queryElement.addNode(telElement);
	}

	foreach(const VCard::Address& address, vcard->getAddresses()) {
		boost::shared_ptr<XMLElement> adrElement = boost::make_shared<XMLElement>("ADR");
		if (!address.poBox.empty()) {
			adrElement->addNode(boost::make_shared<XMLElement>("POBOX", "", address.poBox));
		}
		if (!address.addressExtension.empty()) {
			adrElement->addNode(boost::make_shared<XMLElement>("EXTADD", "", address.addressExtension));
		}
		if (!address.street.empty()) {
			adrElement->addNode(boost::make_shared<XMLElement>("STREET", "", address.street));
		}
		if (!address.locality.empty()) {
			adrElement->addNode(boost::make_shared<XMLElement>("LOCALITY", "", address.locality));
		}
		if (!address.region.empty()) {
			adrElement->addNode(boost::make_shared<XMLElement>("REGION", "", address.region));
		}
		if (!address.postalCode.empty()) {
			adrElement->addNode(boost::make_shared<XMLElement>("PCODE", "", address.postalCode));
		}
		if (!address.country.empty()) {
			adrElement->addNode(boost::make_shared<XMLElement>("CTRY", "", address.country));
		}

		if (address.isHome) {
			adrElement->addNode(boost::make_shared<XMLElement>("HOME"));
		}
		if (address.isWork) {
			adrElement->addNode(boost::make_shared<XMLElement>("WORK"));
		}
		if (address.isPostal) {
			adrElement->addNode(boost::make_shared<XMLElement>("POSTAL"));
		}
		if (address.isParcel) {
			adrElement->addNode(boost::make_shared<XMLElement>("PARCEL"));
		}
		if (address.deliveryType == VCard::DomesticDelivery) {
			adrElement->addNode(boost::make_shared<XMLElement>("DOM"));
		}
		if (address.deliveryType == VCard::InternationalDelivery) {
			adrElement->addNode(boost::make_shared<XMLElement>("INTL"));
		}
		if (address.isPreferred) {
			adrElement->addNode(boost::make_shared<XMLElement>("PREF"));
		}
		queryElement.addNode(adrElement);
	}

	foreach(const VCard::AddressLabel& addressLabel, vcard->getAddressLabels()) {
		boost::shared_ptr<XMLElement> labelElement = boost::make_shared<XMLElement>("LABEL");

		foreach(const std::string& line, addressLabel.lines) {
			labelElement->addNode(boost::make_shared<XMLElement>("LINE", "", line));
		}

		if (addressLabel.isHome) {
			labelElement->addNode(boost::make_shared<XMLElement>("HOME"));
		}
		if (addressLabel.isWork) {
			labelElement->addNode(boost::make_shared<XMLElement>("WORK"));
		}
		if (addressLabel.isPostal) {
			labelElement->addNode(boost::make_shared<XMLElement>("POSTAL"));
		}
		if (addressLabel.isParcel) {
			labelElement->addNode(boost::make_shared<XMLElement>("PARCEL"));
		}
		if (addressLabel.deliveryType == VCard::DomesticDelivery) {
			labelElement->addNode(boost::make_shared<XMLElement>("DOM"));
		}
		if (addressLabel.deliveryType == VCard::InternationalDelivery) {
			labelElement->addNode(boost::make_shared<XMLElement>("INTL"));
		}
		if (addressLabel.isPreferred) {
			labelElement->addNode(boost::make_shared<XMLElement>("PREF"));
		}
		queryElement.addNode(labelElement);
	}

	foreach(const JID& jid, vcard->getJIDs()) {
		queryElement.addNode(boost::make_shared<XMLElement>("JID", "", jid.toString()));
	}

	if (!vcard->getDescription().empty()) {
		queryElement.addNode(boost::make_shared<XMLElement>("DESC", "", vcard->getDescription()));
	}

	foreach(const VCard::Organization& org, vcard->getOrganizations()) {
		boost::shared_ptr<XMLElement> orgElement = boost::make_shared<XMLElement>("ORG");
		if (!org.name.empty()) {
			orgElement->addNode(boost::make_shared<XMLElement>("ORGNAME", "", org.name));
		}
		if (!org.units.empty()) {
			foreach(const std::string& unit, org.units) {
				orgElement->addNode(boost::make_shared<XMLElement>("ORGUNIT", "", unit));
			}
		}
		queryElement.addNode(orgElement);
	}
Пример #9
0
QVariant HistoryModel::data(const QModelIndex &index, int role) const
{
    HistoryItem* item = itemFromIndex(index);

    if (index.row() < 0 || !item) {
        return QVariant();
    }

    if (item->isTopLevel()) {
        switch (role) {
        case IsTopLevelRole:
            return true;
        case TimestampStartRole:
            return item->startTimestamp();
        case TimestampEndRole:
            return item->endTimestamp();
        case Qt::DisplayRole:
        case Qt::EditRole:
            return index.column() == 0 ? item->title : QVariant();
        case Qt::DecorationRole:
            return index.column() == 0 ? QIcon(":/icons/menu/history_entry.png") : QVariant();
        }

        return QVariant();
    }

    const HistoryEntry &entry = item->historyEntry;

    switch (role) {
    case IdRole:
        return entry.id;
    case TitleRole:
        return entry.title;
    case UrlRole:
        return entry.url;
    case UrlStringRole:
        return entry.urlString;
    case IconRole:
        return item->icon();
    case IconLoadedRole:
        return item->iconLoaded();
    case IsTopLevelRole:
        return false;
    case TimestampStartRole:
        return -1;
    case TimestampEndRole:
        return -1;
    case Qt::ToolTipRole:
        if (index.column() == 0) {
            return QString("%1\n%2").arg(entry.title, entry.urlString);
        }
    case Qt::DisplayRole:
    case Qt::EditRole:
        switch (index.column()) {
        case 0:
            return entry.title;
        case 1:
            return entry.urlString;
        case 2:
            return dateTimeToString(entry.date);
        case 3:
            return entry.count;
        }
        break;
    case Qt::DecorationRole:
        if (index.column() == 0) {
            return item->icon().isNull() ? qIconProvider->emptyWebIcon() : item->icon();
        }
    }

    return QVariant();
}
Пример #10
0
    void dump_item( const Outlook::_AppointmentItemPtr &item, QXmlStreamWriter &stream, bool dump_exception )
    {
        TRACE(OutlookSyncPlugin) << "OutlookDatebookSync::dump_item";

        Outlook::OlRecurrenceState recstate = item->GetRecurrenceState();
        if ( recstate == Outlook::olApptOccurrence ) {
            WARNING() << "Cannot sync occurrences!";
            return;
        }
        if ( (dump_exception && recstate != Outlook::olApptException) ||
             (!dump_exception && recstate == Outlook::olApptException) ) {
            WARNING() << "Found" << (recstate == Outlook::olApptException?"Exception":"non-Exception")
                      << "when syncing" << (dump_exception?"Exceptions":"non-Exceptions");
            return;
        }

        Outlook::UserPropertiesPtr props = item->GetUserProperties();
        Q_ASSERT(props);

        PREPARE_MAPI_DATEBOOK(Appointment, dump_exception);

        stream.writeStartElement("Appointment");
        DUMP_STRING(Identifier,EntryID);
        DUMP_STRING(Description,Subject);
        DUMP_STRING(Location,Location);
        QString timezone;
        {
            Outlook::UserPropertyPtr up = props->Find("Qtopia Timezone");
            if ( up ) {
                timezone = variant_to_qstring(up->GetValue());
            }
        }
        DUMP_EXPR(TimeZone,timezone);
        stream.writeStartElement("When");
        if ( item->GetAllDayEvent() ) {
            DUMP_DATE(StartDate,Start);
            // We can't just dump the end date because Outlook does it differently to Qtopia.
            // Qtopia expects something like "starts 7/10/08, ends 7/10/08" but Outlook
            // has given us "starts 7/10/08 00:00:00, ends 8/10/08 00:00:00".
            // Simply remove one day from the end date to get something Qtopia won't barf over.
            QDate dt = date_to_qdatetime(item->GetEnd()).date();
            dt = dt.addDays(-1);
            DUMP_EXPR(EndDate,escape(dateToString(dt)));
        } else {
            QDateTime dt = date_to_qdatetime(item->GetStart());
            bool utc = !timezone.isEmpty();
            if ( utc )
                dt = dt.toUTC();
            DUMP_EXPR(Start,escape(dateTimeToString(dt, utc)));
            dt = date_to_qdatetime(item->GetEnd());
            if ( utc )
                dt = dt.toUTC();
            DUMP_EXPR(End,escape(dateTimeToString(dt, utc)));
        }
        stream.writeEndElement();
        stream.writeStartElement("Alarm");
        if ( item->GetReminderSet() ) {
            DUMP_EXPR(Type,item->GetReminderPlaySound()?"Audible":"Visible");
            DUMP_INT(Delay,ReminderMinutesBeforeStart);
        }
        stream.writeEndElement();
        if ( !dump_exception ) {
            stream.writeStartElement("Repeat");
            if ( recstate != Outlook::olApptNotRecurring && item->GetIsRecurring() ) {
                Q_ASSERT(recstate == Outlook::olApptMaster);
                Outlook::RecurrencePatternPtr recpat = item->GetRecurrencePattern();
                Q_ASSERT(recpat);

                Outlook::OlRecurrenceType rectype = recpat->GetRecurrenceType();
                LOG() << "recpat->RecurrenceType" << rectype;

                QString type;
                if ( rectype == Outlook::olRecursDaily && !recpat->GetDayOfWeekMask() )
                    type = "Daily";
                else if ( ( rectype == Outlook::olRecursDaily && recpat->GetDayOfWeekMask() ) || rectype == Outlook::olRecursWeekly )
                    type = "Weekly";
                else if ( rectype == Outlook::olRecursMonthly )
                    type = "MonthlyDate";
                else if ( ( rectype == Outlook::olRecursMonthNth || rectype == Outlook::olRecursYearNth ) && recpat->GetInstance() != 5 )
                    type = "MonthlyDay";
                else if ( ( rectype == Outlook::olRecursMonthNth || rectype == Outlook::olRecursYearNth ) && recpat->GetInstance() == 5 )
                    type = "MonthlyEndDay";
                else if ( rectype == Outlook::olRecursYearly )
                    type = "Yearly";
                Q_ASSERT(!type.isEmpty());
                LOG() << "Type" << type << "Instance" << recpat->GetInstance();
                stream.writeStartElement("Type");
                stream.writeCharacters(type);
                stream.writeEndElement();

                int frequency = recpat->GetInterval();
                LOG() << "recpat->GetInterval" << frequency;
                if ( rectype == Outlook::olRecursDaily && recpat->GetDayOfWeekMask() )
                    frequency = 1;
                stream.writeStartElement("Frequency");
                stream.writeCharacters(QString::number(frequency));
                stream.writeEndElement();

                stream.writeStartElement("Until");
                if ( !recpat->GetNoEndDate() ) {
                    LOG() << "recpat->GetPatternEndDate" << date_to_qdatetime(recpat->GetPatternEndDate()).date();
                    stream.writeCharacters(dateToString(date_to_qdatetime(recpat->GetPatternEndDate()).date()));
                }
                stream.writeEndElement();

                if ( type == "Weekly" || type == "MonthlyDay" || type == "MonthlyEndDay" ) {
                    stream.writeStartElement("WeekMask");
                    if ( recpat->GetDayOfWeekMask() ) {
                        int mask = recpat->GetDayOfWeekMask();
                        LOG() << "recpat->GetDayOfWeekMask" << mask;
                        QStringList list;
                        if ( mask & Outlook::olMonday )
                            list << "Monday";
                        if ( mask & Outlook::olTuesday )
                            list << "Tuesday";
                        if ( mask & Outlook::olWednesday )
                            list << "Wednesday";
                        if ( mask & Outlook::olThursday )
                            list << "Thursday";
                        if ( mask & Outlook::olFriday )
                            list << "Friday";
                        if ( mask & Outlook::olSaturday )
                            list << "Saturday";
                        if ( mask & Outlook::olSunday )
                            list << "Sunday";
                        stream.writeCharacters(list.join(" "));
                    } else {
                        LOG() << "recpat->GetDayOfWeekMask" << 0;
                    }
                    stream.writeEndElement();
                }

                Outlook::ExceptionsPtr exceptions = recpat->GetExceptions();
                if ( exceptions ) {
                    int expcount = exceptions->GetCount();
                    for ( int i = 0; i < expcount; i++ ) {
                        stream.writeStartElement("Exception");

                        long item_to_get = i+1;
                        Outlook::ExceptionPtr exception = exceptions->Item(item_to_get);
                        Q_ASSERT(exception);

                        DUMP_DATE_ITEM(OriginalDate,OriginalDate,exception);
                        if ( !exception->GetDeleted() ) {
                            Outlook::_AppointmentItemPtr exceptionItem = exception->GetAppointmentItem();
                            dump_item( exceptionItem, stream, true );
                        }

                        stream.writeEndElement();
                    }
                }
            }
            stream.writeEndElement();
        }
        DUMP_MAPI(Notes,Body);
        stream.writeStartElement("Categories");
        foreach ( const QString &category, bstr_to_qstring(item->GetCategories()).split(", ", QString::SkipEmptyParts) )
            DUMP_EXPR(Category,category);
        stream.writeEndElement();
        stream.writeEndElement();
    }