1 // frmContactEditor-Load.cpp - frmContactEditor load contact subroutines.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
22 #include <wx/tokenzr.h>
23 #include <wx/datetime.h>
26 #include "frmContactEditor.h"
29 #include "../version.h"
30 #include "../vcard/vcard.h"
31 #include "../common/textprocessing.h"
32 #include "../common/dirs.h"
33 #include "cdo/ContactDataObject.h"
35 bool frmContactEditor::LoadContact(wxString Filename){
37 // Load the contact into the contact editor.
40 wxString wxSContactString;
44 if (StartupEditMode == FALSE){
45 XVMData = MainPtr->GetViewMode();
48 wxSContactFilename = Filename;
50 // Check if we are using wxWidgets version 2.8 or less and
51 // execute the required command accordingly.
53 #if wxABI_VERSION < 20900
54 ContactFile.Open(Filename.c_str(), wxT("r"));
56 ContactFile.Open(Filename, wxT("r"));
59 if (ContactFile.IsOpened() == FALSE){
65 ContactEditorData.LoadFile(Filename);
67 ContactFile.ReadAll(&wxSContactString, wxConvAuto());
71 std::map<int, wxString> ContactFileLines;
72 std::map<int, wxString>::iterator striter;
74 wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n"));
76 int ContactLineSeek = 0;
78 while (wSTContactFileLines.HasMoreTokens() == TRUE){
80 ContactLine = wSTContactFileLines.GetNextToken();
81 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
88 bool QuoteMode = FALSE;
89 bool PropertyFind = TRUE;
90 bool HasExtraNicknames = FALSE;
91 bool IgnoreGender = FALSE;
92 bool ExtraLineSeek = TRUE;
93 //bool BirthdayProcessed = FALSE;
94 //bool AnniversaryProcessed = FALSE;
95 bool FNProcessed = FALSE;
96 bool GenderProcessed = FALSE;
97 bool NameProcessed = FALSE;
98 //bool UIDProcessed = FALSE;
99 //bool KindProcessed = FALSE;
100 bool ETagFound = FALSE;
101 bool ETagOrigFound = FALSE;
102 bool VersionProcessed = FALSE;
103 int intExtraNickname = 0;
104 wxString wxSProperty;
105 wxString wxSPropertySeg1;
106 wxString wxSPropertySeg2;
107 wxString wxSPropertyNextLine;
108 size_t ContactLineLen = 0;
109 int QuoteBreakPoint = 0;
112 int NicknameCount = 0;
121 int RelatedCount = 0;
126 int CategoryCount = 0;
132 int CalReqAdrCount = 0;
133 int FreeBusyCount = 0;
137 //int intValueSeek = 1;
139 // Process the unique ID (UID)
141 UIDToken = ContactEditorData.UIDToken;
143 // Process the contact type (KIND) (frmContactEditor-LoadGroup.cpp)
145 LoadKind(&ContactEditorData.ContactKind);
147 // Process the Birthday (BDAY) (frmContactEditor-LoadBADays.cpp)
149 LoadBirthday(&ContactEditorData.Birthday, &ContactEditorData.BirthdayText);
151 // Process the Anniversary (ANNIVERSARY) (frmContactEditor-LoadBADays.cpp)
153 LoadAnniversary(&ContactEditorData.Anniversary, &ContactEditorData.AnniversaryText);
155 // Process the Gender (GENDER) (frmContactEditor-LoadGender.cpp)
157 LoadGender(&ContactEditorData.Gender, &ContactEditorData.GenderDetails);
159 // Process the Name (N) (frmContactEditor-LoadName.cpp)
161 LoadName(&ContactEditorData.NameTitle, &ContactEditorData.NameForename,
162 &ContactEditorData.NameSurname, &ContactEditorData.NameOtherNames,
163 &ContactEditorData.NameSuffix);
165 // Process the group members (MEMBER) (frmContactEditor-LoadGroup.cpp)
167 LoadMember(&ContactEditorData.GroupsList);
169 // Process the addresses (ADR) (frmContactEditor-LoadAddress.cpp)
171 LoadAddress(&ContactEditorData.GeneralAddressList,
172 &ContactEditorData.GeneralAddressListTown,
173 &ContactEditorData.GeneralAddressListCounty,
174 &ContactEditorData.GeneralAddressListPostCode,
175 &ContactEditorData.GeneralAddressListPref,
176 &ContactEditorData.HomeAddressList,
177 &ContactEditorData.HomeAddressListTown,
178 &ContactEditorData.HomeAddressListCounty,
179 &ContactEditorData.HomeAddressListPostCode,
180 &ContactEditorData.HomeAddressListPref,
181 &ContactEditorData.BusinessAddressList,
182 &ContactEditorData.BusinessAddressListTown,
183 &ContactEditorData.BusinessAddressListCounty,
184 &ContactEditorData.BusinessAddressListPostCode,
185 &ContactEditorData.BusinessAddressListPref,
188 // Process the timezones (TZ).
190 LoadData(&ContactEditorData.GeneralTZList,
191 &ContactEditorData.GeneralTZListPref,
193 &ContactEditorData.HomeTZList,
194 &ContactEditorData.HomeTZListPref,
196 &ContactEditorData.BusinessTZList,
197 &ContactEditorData.BusinessTZListPref,
198 lboBusinessTimezones,
201 // Process the emails (EMAIL).
203 LoadData(&ContactEditorData.GeneralEmailList,
204 &ContactEditorData.GeneralEmailListPref,
206 &ContactEditorData.HomeEmailList,
207 &ContactEditorData.HomeEmailListPref,
209 &ContactEditorData.BusinessEmailList,
210 &ContactEditorData.BusinessEmailListPref,
214 // Process the nicknames (NICKNAME).
216 LoadData(&ContactEditorData.GeneralNicknamesList,
217 &ContactEditorData.GeneralNicknamesListPref,
219 &ContactEditorData.HomeNicknamesList,
220 &ContactEditorData.HomeNicknamesListPref,
222 &ContactEditorData.BusinessNicknamesList,
223 &ContactEditorData.BusinessNicknamesListPref,
224 lboBusinessNicknames,
227 // Process the languages (LANG).
229 LoadData(&ContactEditorData.GeneralLanguageList,
230 &ContactEditorData.GeneralLanguageListPref,
232 &ContactEditorData.HomeLanguageList,
233 &ContactEditorData.HomeLanguageListPref,
235 &ContactEditorData.BusinessLanguageList,
236 &ContactEditorData.BusinessLanguageListPref,
237 lboBusinessLanguages,
240 // Process the geopositiosn (GEO).
242 LoadData(&ContactEditorData.GeneralGeographyList,
243 &ContactEditorData.GeneralGeographyListPref,
245 &ContactEditorData.HomeGeographyList,
246 &ContactEditorData.HomeGeographyListPref,
248 &ContactEditorData.BusinessGeographyList,
249 &ContactEditorData.BusinessGeographyListPref,
250 lboBusinessGeoposition,
253 // Process the websites (URL).
255 LoadData(&ContactEditorData.GeneralWebsiteList,
256 &ContactEditorData.GeneralWebsiteListPref,
258 &ContactEditorData.HomeWebsiteList,
259 &ContactEditorData.HomeWebsiteListPref,
261 &ContactEditorData.BusinessWebsiteList,
262 &ContactEditorData.BusinessWebsiteListPref,
266 // Process the titles (TITLE).
268 LoadData(&ContactEditorData.GeneralTitleList,
269 &ContactEditorData.GeneralTitleListPref,
271 &ContactEditorData.HomeTitleList,
272 &ContactEditorData.HomeTitleListPref,
274 &ContactEditorData.BusinessTitleList,
275 &ContactEditorData.BusinessTitleListPref,
279 // Process the roles (ROLE).
281 LoadData(&ContactEditorData.GeneralRoleList,
282 &ContactEditorData.GeneralRoleListPref,
284 &ContactEditorData.HomeRoleList,
285 &ContactEditorData.HomeRoleListPref,
287 &ContactEditorData.BusinessRoleList,
288 &ContactEditorData.BusinessRoleListPref,
292 // Process the roles (ORG).
294 LoadData(&ContactEditorData.GeneralOrganisationsList,
295 &ContactEditorData.GeneralOrganisationsListPref,
297 &ContactEditorData.HomeOrganisationsList,
298 &ContactEditorData.HomeOrganisationsListPref,
299 lboHomeOrganisations,
300 &ContactEditorData.BusinessOrganisationsList,
301 &ContactEditorData.BusinessOrganisationsListPref,
302 lboBusinessOrganisations,
305 // Process the notes (NOTE).
307 LoadData(&ContactEditorData.GeneralNoteList,
308 &ContactEditorData.GeneralNoteListPref,
310 &ContactEditorData.HomeNoteList,
311 &ContactEditorData.HomeNoteListPref,
313 &ContactEditorData.BusinessNoteList,
314 &ContactEditorData.BusinessNoteListPref,
318 // Process the categories (CATEGORIES).
320 LoadData(&ContactEditorData.CategoriesList,
321 &ContactEditorData.CategoriesListPref,
325 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
326 iter != ContactFileLines.end(); ++iter){
328 // Find the colon which splits the start bit from the data part.
330 ContactLine = iter->second;
332 while (ExtraLineSeek == TRUE){
334 // Check if there is extra data on the next line
335 // (indicated by space or tab at the start) and add data.
339 if (iter == ContactFileLines.end()){
346 wxSPropertyNextLine = iter->second;
349 if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
351 wxSPropertyNextLine.Remove(0, 1);
352 //wxSPropertyNextLine.Trim(FALSE);
353 //ContactLine.Trim();
354 ContactLine.Append(wxSPropertyNextLine);
359 ExtraLineSeek = FALSE;
365 ContactLineLen = ContactLine.Len();
367 // Make sure we are not in quotation mode.
368 // Make sure colon does not have \ or \\ before it.
370 for (int i = 0; i <= ContactLineLen; i++){
372 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
374 PropertyFind = FALSE;
376 } else if (PropertyFind == TRUE){
378 wxSProperty.Append(ContactLine.Mid(i, 1));
382 if (ContactLine.Mid(i, 1) == wxT("\"")){
384 if (QuoteMode == TRUE){
396 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
405 // Split that line at the point into two variables (ignore the colon).
407 wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
408 wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
410 // Add the data into the contact editor depending on what it is.
412 if (wxSProperty == wxT("VERSION") && VersionProcessed == FALSE){
414 // Check if version is 4.0, otherwise don't
417 if (wxSPropertySeg2 != wxT("4.0")){
418 wxMessageBox(_("This file is not a vCard 4.0 contact and is not supported under Xestia Address Book."),
419 _("Contact not supported"), wxICON_ERROR);
424 VersionProcessed = TRUE;
426 }/* if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){
428 // See frmContactEditor-LoadGroup.cpp
430 LoadKind(wxSPropertySeg2);
432 }/* else if (wxSProperty == wxT("MEMBER")){
434 // See frmContactEditor-LoadGroup.cpp
436 LoadMember(wxSPropertySeg2, &GroupCount);
438 }*/ else if (wxSProperty == wxT("FN")){
440 // See frmContactEditor-LoadName.cpp
442 LoadFN(wxSPropertySeg1, wxSPropertySeg2, &FNCount, &FNProcessed, &ContactData);
444 }/* else if (wxSProperty == wxT("N") && NameProcessed == FALSE){
446 // See frmContactEditor-LoadName.cpp
448 LoadN(wxSPropertySeg1, wxSPropertySeg2, &NameProcessed, &ContactData);
450 } else if (wxSProperty == wxT("NICKNAME")){
452 // See frmContactEditor-LoadNickname.cpp
454 LoadNickname(wxSPropertySeg1, wxSPropertySeg2, &NicknameCount, &ContactData);
456 } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){
458 // See frmContactEditor-LoadGender.cpp
460 LoadGender(wxSPropertySeg1, wxSPropertySeg2, &GenderProcessed, &ContactData);
462 } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){
464 // See frmContactEditor-LoadBADays.cpp
466 LoadBDay(wxSPropertySeg1, wxSPropertySeg2, &BirthdayProcessed);
468 } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
470 // See frmContactEditor-LoadBADays.cpp
472 LoadAnniversary(wxSPropertySeg1, wxSPropertySeg2, &AnniversaryProcessed);
474 } else if (wxSProperty == wxT("TZ")){
476 // See frmContactEditor-LoadTimeZone.cpp
478 LoadTimeZone(wxSPropertySeg1, wxSPropertySeg2, &TZCount);
480 } else if (wxSProperty == wxT("ADR")){
482 // See frmContactEditor-LoadAddress.cpp
484 LoadADR(wxSPropertySeg1, wxSPropertySeg2, &ADRCount);
486 } else if (wxSProperty == wxT("EMAIL")){
488 // See frmContactEditor-LoadEmail.cpp
490 LoadEmail(wxSPropertySeg1, wxSPropertySeg2, &EmailCount);
492 }*/ else if (wxSProperty == wxT("IMPP")){
494 // See frmContactEditor-LoadIM.cpp
496 LoadIM(wxSPropertySeg1, wxSPropertySeg2, &IMPPCount);
498 } else if (wxSProperty == wxT("TEL")){
500 // See frmContactEditor-LoadTelephone.cpp
502 LoadTelephone(wxSPropertySeg1, wxSPropertySeg2, &TelCount);
504 }/* else if (wxSProperty == wxT("LANG")){
506 // See frmContactEditor-LoadLanguage.cpp
508 LoadLanguage(wxSPropertySeg1, wxSPropertySeg2, &LangCount);
510 } else if (wxSProperty == wxT("GEO")){
512 // See frmContactEditor-LoadGeo.cpp
514 LoadGeo(wxSPropertySeg1, wxSPropertySeg2, &GeoCount);
516 }*/ else if (wxSProperty == wxT("RELATED")){
518 // See fromContactEditor-LoadRelated.cpp
520 LoadRelated(wxSPropertySeg1, wxSPropertySeg2, &RelatedCount);
522 }/* else if (wxSProperty == wxT("URL")){
524 // See frmContactEditor-LoadURL.cpp
526 LoadURL(wxSPropertySeg1, wxSPropertySeg2, &URLCount);
528 } else if (wxSProperty == wxT("TITLE")) {
530 // See frmContactEditor-LoadTitle.cpp
532 LoadTitle(wxSPropertySeg1, wxSPropertySeg2, &TitleCount);
534 } else if (wxSProperty == wxT("ROLE")) {
536 // See frmContactEditor-LoadRole.cpp
538 LoadRole(wxSPropertySeg1, wxSPropertySeg2, &RoleCount);
540 } else if (wxSProperty == wxT("ORG")) {
542 // See frmContactEditor-LoadOrg.cpp
544 LoadOrg(wxSPropertySeg1, wxSPropertySeg2, &OrgCount);
546 } else if (wxSProperty == wxT("NOTE")) {
548 // See frmContactEditor-LoadNote.cpp
550 LoadNote(wxSPropertySeg1, wxSPropertySeg2, &NoteCount);
552 } else if (wxSProperty == wxT("CATEGORIES")) {
554 // See frmContactEditor-LoadCategory.cpp
556 LoadCategory(wxSPropertySeg1, wxSPropertySeg2, &CategoryCount);
558 }*/ else if (wxSProperty == wxT("PHOTO")) {
560 // See frmContactEditor-LoadPhoto.cpp
562 LoadPhoto(wxSPropertySeg1, wxSPropertySeg2, &PhotoCount);
564 } else if (wxSProperty == wxT("LOGO")) {
566 // See frmContactEditor-LoadLogo.cpp
568 LoadLogo(wxSPropertySeg1, wxSPropertySeg2, &LogoCount);
570 } else if (wxSProperty == wxT("SOUND")) {
572 // See frmContactEditor-LoadSound.cpp
574 LoadSound(wxSPropertySeg1, wxSPropertySeg2, &SoundCount);
576 } else if (wxSProperty == wxT("CALURI")){
578 // See frmContactEditor-LoadCalendar.cpp
580 LoadCalURI(wxSPropertySeg1, wxSPropertySeg2, &CalAdrCount);
582 } else if (wxSProperty == wxT("CALADRURI")){
584 // See frmContactEditor-LoadCalendar.cpp
586 LoadCalAdrURI(wxSPropertySeg1, wxSPropertySeg2, &CalReqAdrCount);
588 } else if (wxSProperty == wxT("FBURL")){
590 // See frmContactEditor-LoadCalendar.cpp
592 LoadCalFreeBusy(wxSPropertySeg1, wxSPropertySeg2, &FreeBusyCount);
594 } else if (wxSProperty == wxT("KEY")){
596 // See frmContactEditor-LoadKey.cpp
598 LoadKey(wxSPropertySeg1, wxSPropertySeg2, &KeyCount);
600 }/* else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){
602 UIDToken = wxSPropertySeg2;
605 }*/ else if (wxSProperty.Mid(0, 3) == wxT("VND")){
607 // Split the Vendor three ways.
609 wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-"));
612 wxString wxSVNDPropName;
615 while (wSTVendorDetails.HasMoreTokens() == TRUE){
617 wSTVendorDetails.GetNextToken();
618 wxSVNDID = wSTVendorDetails.GetNextToken();
619 wxSVNDPropName = wSTVendorDetails.GetNextToken();
624 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
626 // Setup the values for later processing.
628 VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
629 VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
630 VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
632 // Add the data to the vendor variables.
636 coldata.SetId(intValueSeek);
637 coldata.SetData(intValueSeek);
638 coldata.SetText(wxSVNDID + wxT("-") + wxSVNDPropName);
640 ListCtrlIndex = lboVendorNamespace->InsertItem(coldata);
642 VendorList.erase(intValueSeek);
643 VendorListPEN.erase(intValueSeek);
644 VendorListElement.erase(intValueSeek);
646 VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
647 VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
648 VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
655 } else if (wxSProperty.Mid(0, 2) == wxT("X-")){
659 XTokenList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
660 XTokenListTokens.insert(std::make_pair(intValueSeek, wxSPropertySeg1.Mid(2)));
666 coldata.SetId(intValueSeek);
667 coldata.SetData(intValueSeek);
668 coldata.SetText(wxSPropertySeg1.Mid(2));
670 ListCtrlIndex = lboXToken->InsertItem(coldata);
678 // Reset the variables.
682 ExtraLineSeek = TRUE;
690 FMTimer.SetFilename(Filename);
691 FMTimer.Start(10000, FALSE);
698 void frmContactEditor::SplitValues(wxString *PropertyLine,
699 std::map<int,int> *SplitPoints,
700 std::map<int,int> *SplitLength,
703 size_t intPropertyLen = PropertyLine->Len();
704 int intSplitsFound = 0;
705 int intSplitSize = 0;
706 int intSplitSeek = 0;
708 for (int i = intSize; i <= intPropertyLen; i++){
712 if (PropertyLine->Mid(i, 1) == wxT(";") &&
713 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
715 if (intSplitsFound == 0){
717 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
721 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
725 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
735 if (intSplitsFound == 0){
737 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
738 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
742 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
743 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
749 void frmContactEditor::LoadData(std::map<int, wxString> *GeneralList,
750 std::map<int, int> *GeneralListPref,
751 wxListCtrl *GeneralListCtrl,
752 std::map<int, wxString> *HomeList,
753 std::map<int, int> *HomeListPref,
754 wxListCtrl *HomeListCtrl,
755 std::map<int, wxString> *BusinessList,
756 std::map<int, int> *BusinessListPref,
757 wxListCtrl *BusinessListCtrl,
760 long ListCtrlIndex = -1;
762 // Deal with the general items.
764 for (std::map<int,wxString>::iterator Iter = GeneralList->begin();
765 Iter != GeneralList->end();
770 coldata.SetId(*DataCount);
771 coldata.SetData(*DataCount);
772 coldata.SetText(Iter->second);
774 ListCtrlIndex = GeneralListCtrl->InsertItem(coldata);
776 if (MapDataExists(DataCount, GeneralListPref)){
778 GeneralListCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", GeneralListPref->find(*DataCount)->second));
786 // Deal with the home items.
788 for (std::map<int,wxString>::iterator Iter = HomeList->begin();
789 Iter != HomeList->end();
794 coldata.SetId(*DataCount);
795 coldata.SetData(*DataCount);
796 coldata.SetText(Iter->second);
798 ListCtrlIndex = HomeListCtrl->InsertItem(coldata);
800 if (MapDataExists(DataCount, HomeListPref)){
802 HomeListCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", HomeListPref->find(*DataCount)->second));
810 // Deal with the work items.
812 for (std::map<int,wxString>::iterator Iter = BusinessList->begin();
813 Iter != BusinessList->end();
818 coldata.SetId(*DataCount);
819 coldata.SetData(*DataCount);
820 coldata.SetText(Iter->second);
822 ListCtrlIndex = BusinessListCtrl->InsertItem(coldata);
824 if (MapDataExists(DataCount, BusinessListPref)){
826 BusinessListCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", BusinessListPref->find(*DataCount)->second));
836 void frmContactEditor::LoadData(std::map<int,wxString> *ItemList,
837 std::map<int,int> *ItemListPref,
838 wxListCtrl *ItemCtrl,
841 long ListCtrlIndex = -1;
843 for (std::map<int,wxString>::iterator Iter = ItemList->begin();
844 Iter != ItemList->end();
849 coldata.SetId(*DataCount);
850 coldata.SetData(*DataCount);
851 coldata.SetText(Iter->second);
853 ListCtrlIndex = ItemCtrl->InsertItem(coldata);
855 if (MapDataExists(DataCount, ItemListPref)){
857 ItemCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", ItemListPref->find(*DataCount)->second));