Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Initial import of code already done for Xestia Address Book
[xestiaab/.git] / source / import / import-vcard4.cpp
1 #include <map>
2 #include <wx/wx.h>
4 #include "../vcard/vcard.h"
5 #include "import-struct.h"
7 std::map<int,ImportDataContact> ImportVCard4(wxArrayString *FileListInc){
9         std::map<int,ImportDataContact> FinalData;
10         
11         // Go through each of the file names, load them up and collect the
12         // contact information.
13         
14         std::map<int,wxString>* CardData;
15         
16         for (int i = 0; i < FileListInc->GetCount(); i++){
17         
18                 vCard ContactData;
19                 
20                 ContactData.LoadFile(FileListInc->Item(i));
21                 
22                 CardData = ContactData.GetAllCards();
23                 int FileIndex = 0;
24                 
25                 for(std::map<int,wxString>::iterator iter = CardData->begin(); 
26                         iter != CardData->end();
27                         iter++){
28                 
29                         // Check if contact really is a vCard 4.0 contact.
30                         
31                         vCard ContactCheck;
32                         ContactCheck.LoadString(iter->second);
33                         
34                         wxString ContactVer = ContactCheck.Get(wxT("VERSION"));
35         
36                         if (ContactVer != wxT("4.0")){
37                         
38                                 continue;
39                         
40                         }
41                         
42                         // If contact is vCard 4.0 then continue otherwise
43                         // go to the next contact.
44                 
45                         ImportDataContact SelectedContact;
46                         SelectedContact.Filename = FileListInc->Item(i);
47                         SelectedContact.FilenameIndex = FileIndex;
48                         SelectedContact.ContactData = iter->second;
49                         SelectedContact.UIDValue = ContactCheck.Get(wxT("UID"));
50                 
51                         FinalData.insert(std::make_pair(FileIndex, SelectedContact));
52                 
53                         FileIndex++;
55                 }
56                 
57         }
58         
59         return FinalData;
61
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy