Exemple #1
0
bool QLandmarkFileHandlerLmx::writeLandmark(const QLandmark &landmark)
{
    m_writer->writeStartElement(m_ns, "landmark");

    if (!landmark.name().isEmpty())
        m_writer->writeTextElement(m_ns, "name", landmark.name());

    if (!landmark.description().isEmpty())
        m_writer->writeTextElement(m_ns, "description", landmark.description());

    if (landmark.coordinate().isValid())
        if (!writeCoordinates(landmark))
            return false;

    if (landmark.radius() > 0)
        m_writer->writeTextElement(m_ns, "coverageRadius", QString::number(landmark.radius()));

    if (!writeAddressInfo(landmark))
        return false;

    if (!landmark.url().isEmpty())
        if (!writeMediaLink(landmark))
            return false;

    if (m_option != QLandmarkManager::ExcludeCategoryData) {
        for (int i = 0; i < landmark.categoryIds().size(); ++i) {
            if (!writeCategory(landmark.categoryIds().at(i)))
                return false;
        }
    }

    m_writer->writeEndElement();

    return true;
}
Exemple #2
0
void XmlWriter::writeCategory( QXmlStreamWriter &stream, const Category *category )
{
    Q_ASSERT( category );

    stream.writeStartElement( "category" );
    stream.writeAttribute( "id", QString::number( categoryIdentifier( category ) ) );

    stream.writeTextElement( "name", category->name() );
    writeColor( stream, category->color() );
    writeLimit( stream,
                category->minimumLimitEnabled(), category->minimumLimit(),
                category->maximumLimitEnabled(), category->maximumLimit() );

    writeObjectData( stream, category );

    for( int i = 0; i < category->countCategories(); ++i ) {
        writeCategory( stream, category->category( i ) );
    }

    stream.writeEndElement(); // category
}
Exemple #3
0
void XmlWriter::writeAccount( QXmlStreamWriter &stream, const Account *acc )
{
    stream.writeStartElement( "account" );

    //FIXME
    //stream.writeAttribute( "level", QString::number( acc->securityLevel() ) );

    stream.writeTextElement( "name", acc->name() );

    if( !acc->number().isEmpty() ) {
        stream.writeTextElement( "number", acc->number() );
    }

    if( !acc->iban().isEmpty() ) {
        stream.writeTextElement( "iban", acc->iban() );
    }

    if( !acc->description().isEmpty() ) {
        stream.writeTextElement( "description", acc->description() );
    }

    stream.writeStartElement( "opening" );
    stream.writeAttribute( "date", acc->openingDate().toString( Qt::ISODate ) );
    stream.writeCharacters( QString::number( acc->openingBalance().cents() ) );
    stream.writeEndElement(); //opening

    writeLimit( stream, acc->minimumBalanceEnabled(), acc->minimumBalance(),
                acc->maximumBalanceEnabled(), acc->maximumBalance() );

    if( !acc->owner().isEmpty() ) {
        stream.writeTextElement( "owner", acc->owner() );
    }

    if( !acc->bic().isEmpty() || !acc->institution().isEmpty() ) {
        if( acc->institution().isEmpty() ) {
            stream.writeEmptyElement( "institution" );
        } else {
            stream.writeStartElement( "institution" );
        }

        if( !acc->bic().isEmpty() ) {
            stream.writeAttribute( "bic", acc->bic() );
        }

        if( !acc->institution().isEmpty() ) {
            stream.writeCharacters( acc->institution() );
            stream.writeEndElement(); //institution
        }
    }

    writeObjectData( stream, acc );

    // write categories...
    if( acc->rootCategory()->countCategories() <= 0 ) {
        stream.writeEmptyElement( "categories" );
    } else {
        stream.writeStartElement( "categories" );
        for( int i = 0; i < acc->rootCategory()->countCategories(); ++i ) {
            writeCategory( stream, acc->rootCategory()->category( i ) );
        }
        stream.writeEndElement();
    }

    // write postings...
    if( acc->countPostings() <= 0 ) {
        stream.writeEmptyElement( "postings" );
    } else {
        stream.writeStartElement( "postings" );
        for( int i = 0; i < acc->countPostings(); ++i ) {
            writePosting( stream, acc->posting( i ) );
        }
        stream.writeEndElement();
    }

    stream.writeEndElement(); // account
}