bool ODateBookAccessBackend_VCal::save() {
    if (!m_changed)
        return true;

    QFile file( m_file );
    if (!file.open(IO_WriteOnly ) )
        return false;

    VObject *obj;
    obj = newVObject( VCCalProp );
    addPropValue( obj, VCVersionProp, "1.0" );
    VObject *vo;
    for(QMap<int, OPimEvent>::ConstIterator it=m_raw.begin(); it !=m_raw.end(); ++it ){
        vo = createVObject( it.data() );
        addVObjectProp(obj, vo );
    }
    for(QMap<int, OPimEvent>::ConstIterator it=m_rep.begin(); it !=m_rep.end(); ++it ){
        vo = createVObject( it.data() );
        addVObjectProp(obj, vo );
    }
    writeVObject( file.fh, obj ); //FIXME: HACK!!!
    cleanVObject( obj );
    cleanStrTbl();

    m_changed = false;
    return true;
}
bool OContactAccessBackend_VCard::save()
{
    if (!m_dirty )
        return true;

    QFileDirect file( m_file );
    if (!file.open(IO_WriteOnly ) )
        return false;

    VObject *obj;
    obj = newVObject( VCCalProp );
    addPropValue( obj, VCVersionProp, "1.0" );

    VObject *vo;
    for(QMap<int, OContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ) {
        vo = createVObject( *it );
        writeVObject( file.directHandle() , vo );
        cleanVObject( vo );
    }
    cleanStrTbl();
    deleteVObject( obj );

    m_dirty = false;
    return true;


}
示例#3
0
void writeVObjectToFile(char *fname, VObject *o)
{
    FILE *fp = fopen(fname,"w");
    if (fp) {
	writeVObject(fp,o);
	fclose(fp);
	}
}
示例#4
0
DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o)
{
	QFileDirect f( fname);
	if ( !f.open( IO_WriteOnly ) ) {
		qWarning("Unable to open vobject write %s", fname);
		return;
	}

    writeVObject( f.directHandle(),o );
}
示例#5
0
void writeVObjectsToFile(char *fname, VObject *list)
{
    FILE *fp = fopen(fname,"w");
    if (fp) {
	while (list) {
	    writeVObject(fp,list);
	    list = nextVObjectInList(list);
	    }
	fclose(fp);
	}
}
示例#6
0
DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list)
{
	QFileDirect f( fname);
	if ( !f.open( IO_WriteOnly ) ) {
		qWarning("Unable to open vobject write %s", fname);
		return;
	}

	while (list) {
	    writeVObject(f.directHandle(),list);
	    list = nextVObjectInList(list);
	    }
}
示例#7
0
bool OPimTodoAccessVCal::save()
{
    if (!m_dirty )
        return true;

    QFile file( m_file );
    if (!file.open(IO_WriteOnly ) )
        return false;

    VObject *obj;
    obj = newVObject( VCCalProp );
    addPropValue( obj, VCVersionProp, "1.0" );
    VObject *vo;
    for(QMap<int, OPimTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){
        vo = vobjByEvent( it.data() );
        addVObjectProp(obj, vo );
    }
    writeVObject( file.fh, obj ); //FIXME: HACK!!!
    cleanVObject( obj );
    cleanStrTbl();

    m_dirty = false;
    return true;
}