From adc92a22d0a1313dceb6e17b68263fe657933f30 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 6 Jan 2016 18:04:46 +0000 Subject: [PATCH] Updated IMPP and TEL support. --- .../contacteditor/cdo/ContactDataObject.cpp | 59 +++++++++++++++---- source/contacteditor/cdo/ContactDataObject.h | 3 + 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/source/contacteditor/cdo/ContactDataObject.cpp b/source/contacteditor/cdo/ContactDataObject.cpp index 1a6e6be..cda6933 100644 --- a/source/contacteditor/cdo/ContactDataObject.cpp +++ b/source/contacteditor/cdo/ContactDataObject.cpp @@ -1875,7 +1875,8 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, std::map *IMListAltID = NULL; std::map *IMListPID = NULL; std::map *IMListTokens = NULL; - std::map *IMListMediatype = NULL; + std::map *IMListMediatype = NULL; + std::map *IMListTypeInfo = NULL; std::map *IMListPref = NULL; switch(PropType){ @@ -1886,6 +1887,7 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, IMListPID = &GeneralIMListPID; IMListTokens = &GeneralIMListTokens; IMListMediatype = &GeneralIMListMediatype; + IMListTypeInfo = &GeneralIMListTypeInfo; IMListPref = &GeneralIMListPref; break; case PROPERTY_HOME: @@ -1894,7 +1896,8 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, IMListAltID = &HomeIMListAltID; IMListPID = &HomeIMListPID; IMListTokens = &HomeIMListTokens; - IMListMediatype = &HomeIMListMediatype; + IMListMediatype = &HomeIMListMediatype; + IMListTypeInfo = &HomeIMListTypeInfo; IMListPref = &HomeIMListPref; break; case PROPERTY_WORK: @@ -1903,7 +1906,8 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, IMListAltID = &BusinessIMListAltID; IMListPID = &BusinessIMListPID; IMListTokens = &BusinessIMListTokens; - IMListMediatype = &BusinessIMListMediatype; + IMListMediatype = &BusinessIMListMediatype; + IMListTypeInfo = &BusinessIMListTypeInfo; IMListPref = &BusinessIMListPref; break; } @@ -1946,7 +1950,19 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, } - IMList->insert(std::make_pair(*IMCount, PropertySeg2)); + wxStringTokenizer IMPPSplitData(PropertySeg2, wxT(":")); + + if (IMPPSplitData.CountTokens() > 1){ + + IMListTypeInfo->insert(std::make_pair(*IMCount, IMPPSplitData.GetNextToken())); + IMList->insert(std::make_pair(*IMCount, IMPPSplitData.GetString())); + + } else { + + IMList->insert(std::make_pair(*IMCount, PropertySeg2)); + IMListTypeInfo->insert(std::make_pair(*IMCount, "none")); + + } // Add the name token data. @@ -2061,7 +2077,7 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert for (std::map::iterator typeiter = TypeSplitPoints.begin(); typeiter != TypeSplitPoints.end(); ++typeiter){ - + wxString TypePropertyName; TSLiter = TypeSplitLength.find(typeiter->first); @@ -2076,7 +2092,7 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert TelTypeUI.Append(wxT(",")); } - + if (TypePropertyName == wxT("home")){ PropType = PROPERTY_HOME; @@ -2105,7 +2121,7 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert } else if (TypePropertyName == wxT("cell")){ - TelTypeUI.Append(_("mobile")); + TelTypeUI.Append(_("cell")); intTypeSeek++; } else if (TypePropertyName == wxT("video")){ @@ -2136,7 +2152,8 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert std::map *TelephoneListAltID = NULL; std::map *TelephoneListPID = NULL; std::map *TelephoneListTokens = NULL; - std::map *TelephoneListTypeInfo = NULL; + std::map *TelephoneListTypeInfo = NULL; + std::map *TelephoneListDataType = NULL; std::map *TelephoneListPref = NULL; switch(PropType){ @@ -2147,6 +2164,7 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert TelephoneListPID = &GeneralTelephoneListPID; TelephoneListTokens = &GeneralTelephoneListTokens; TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo; + TelephoneListDataType = &GeneralTelephoneListDataType; TelephoneListPref = &GeneralTelephoneListPref; break; case PROPERTY_HOME: @@ -2155,7 +2173,8 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert TelephoneListAltID = &HomeTelephoneListAltID; TelephoneListPID = &HomeTelephoneListPID; TelephoneListTokens = &HomeTelephoneListTokens; - TelephoneListTypeInfo = &HomeTelephoneListTypeInfo; + TelephoneListTypeInfo = &HomeTelephoneListTypeInfo; + TelephoneListDataType = &HomeTelephoneListDataType; TelephoneListPref = &HomeTelephoneListPref; break; case PROPERTY_WORK: @@ -2164,7 +2183,8 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert TelephoneListAltID = &BusinessTelephoneListAltID; TelephoneListPID = &BusinessTelephoneListPID; TelephoneListTokens = &BusinessTelephoneListTokens; - TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo; + TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo; + TelephoneListDataType = &BusinessTelephoneListDataType; TelephoneListPref = &BusinessTelephoneListPref; break; } @@ -2210,9 +2230,24 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert } - TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2)); - TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI)); + // Check for the type information and split it down. + + wxStringTokenizer TelSplitData(PropertySeg2, wxT(":")); + + if (TelSplitData.CountTokens() > 1){ + + TelephoneListDataType->insert(std::make_pair(*TelephoneCount, TelSplitData.GetNextToken())); + TelephoneList->insert(std::make_pair(*TelephoneCount, TelSplitData.GetString())); + + } else { + TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2)); + TelephoneListDataType->insert(std::make_pair(*TelephoneCount, "tel")); + + } + + TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI)); + // Add the name token data. if (!PropertyTokens.IsEmpty()){ diff --git a/source/contacteditor/cdo/ContactDataObject.h b/source/contacteditor/cdo/ContactDataObject.h index 46edb7e..c481f8d 100644 --- a/source/contacteditor/cdo/ContactDataObject.h +++ b/source/contacteditor/cdo/ContactDataObject.h @@ -194,6 +194,7 @@ class ContactDataObject{ std::map GeneralTelephoneListType; std::map GeneralTelephoneListTokens; std::map GeneralTelephoneListTypeInfo; + std::map GeneralTelephoneListDataType; std::map GeneralTelephoneListPref; std::map GeneralLanguageList; @@ -317,6 +318,7 @@ class ContactDataObject{ std::map HomeTelephoneListType; std::map HomeTelephoneListTokens; std::map HomeTelephoneListTypeInfo; + std::map HomeTelephoneListDataType; std::map HomeTelephoneListPref; std::map HomeLanguageList; @@ -431,6 +433,7 @@ class ContactDataObject{ std::map BusinessTelephoneListType; std::map BusinessTelephoneListTypeInfo; std::map BusinessTelephoneListTokens; + std::map BusinessTelephoneListDataType; std::map BusinessTelephoneListPref; std::map BusinessLanguageList; -- 2.39.5