DLLEXPORT(void) cleanVObjects(VObject *list) { while (list) { VObject *t = list; list = nextVObjectInList(list); cleanVObject(t); } }
void printVObjectsToFile(char *fname,VObject *list) { FILE *fp = fopen(fname,"w"); if (fp) { while (list) { printVObject(fp,list); list = nextVObjectInList(list); } fclose(fp); } }
char* writeMemVObjects(char *s, int *len, VObject *list) { OFile ofp; initMemOFile(&ofp,s,len?*len:0); while (list) { writeVObject_(&ofp,list); list = nextVObjectInList(list); } if (len) *len = ofp.len; appendcOFile(&ofp,0); return ofp.s; }
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); } }
bool OContactAccessBackend_VCard::load () { m_map.clear(); m_dirty = false; VObject* obj = 0l; if ( QFile::exists(m_file) ) { obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); if ( !obj ) return false; } else { qWarning("File \"%s\" not found !", m_file.latin1() ); return false; } while ( obj ) { OContact con = parseVObject( obj ); /* * if uid is 0 assign a new one * this at least happens on * Nokia6210 */ if ( con.uid() == 0 ) { con.setUid( 1 ); qWarning("assigned new uid %d",con.uid() ); } m_map.insert( con.uid(), con ); VObject *t = obj; obj = nextVObjectInList(obj); cleanVObject( t ); } return true; }