X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FContactDataObject.cpp;h=3d4d319fd2dece36ef51a8d02525bf562a253bfc;hb=cdd1530fcf2b19be9187604deb6aa78fba091366;hp=927089546446a040f0e69ab0fc28dc31ae15ee51;hpb=d2c744f3bcfe1ff78525e4311302f7ffd3a6a6c6;p=xestiaab%2F.git diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 9270895..3d4d319 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -26,6 +26,36 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){ } + wxFile ContactFile; + + if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){ + + return CONTACTLOAD_FILEERROR; + + } + + // Check that the vCard is a valid vCard 4.0 file. + + vCard vCard4FormatCheck; + + vCard4FormatCheck.LoadFile(Filename); + + if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){ + + return CONTACTLOAD_FILEINVALIDFORMAT; + + } + + // Check that the vCard meets the base specification. + + if (!vCard4FormatCheck.MeetBaseSpecification()){ + + return CONTACTLOAD_FILEBASESPECFAIL; + + } + + + return CONTACTLOAD_UNITTESTFAIL; } \ No newline at end of file