+// frmContactEditorAddress.cpp - frmContactEditorAddress form.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
+
#include "frmContactEditorAddress.h"
#include <map>
#include <wx/tokenzr.h>
// Add the label to the list (maps).
- AddressListLabelPtr->insert(std::make_pair(AddressListIndex, txtLabel->GetValue()));
+ wxString LabelData = txtLabel->GetValue();
+ LabelData.Prepend("\"");
+ LabelData.Append("\"");
+ AddressListLabelPtr->insert(std::make_pair(AddressListIndex, LabelData));
// Add the language to the list (maps).
// Add the label to the list (maps).
AddressListLabelPtr->erase(AddressListIndex);
- AddressListLabelPtr->insert(std::make_pair(AddressListIndex, txtLabel->GetValue()));
+
+ wxString LabelData = txtLabel->GetValue();
+ LabelData.Prepend("\"");
+ LabelData.Append("\"");
+ AddressListLabelPtr->insert(std::make_pair(AddressListIndex, LabelData));
// Add the language to the list (maps).
striter = AddressListPtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex &&
+ striter != AddressListPtr->end()){
txtAddress->SetValue(striter->second);
striter = AddressListTownPtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex &&
+ striter != AddressListTownPtr->end()){
txtTownCity->SetValue(striter->second);
striter = AddressListCountyPtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex &&
+ striter != AddressListCountyPtr->end()){
txtCounty->SetValue(striter->second);
striter = AddressListPostCodePtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex &&
+ striter != AddressListPostCodePtr->end()){
txtPostCode->SetValue(striter->second);
striter = AddressListCountryPtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex &&
+ striter != AddressListCountryPtr->end()){
txtCountry->SetValue(striter->second);
intiter = AddressListPrefPtr->find(AddressListIndex);
- if (intiter->first == AddressListIndex && intiter->second > 0){
+ if (intiter->first == AddressListIndex && intiter->second > 0 && intiter != AddressListPrefPtr->end() &&
+ intiter != AddressListPrefPtr->end()){
sliPriority->SetValue(intiter->second);
sliPriority->Enable();
striter = AddressListLabelPtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex && striter != AddressListLabelPtr->end() &&
+ striter != AddressListLabelPtr->end()){
strValue = striter->second;
+ if (strValue.Left(1) == "\"" && strValue.Right(1) == "\""){
+ strValue.erase(0, 1);
+ strValue.RemoveLast();
+ }
}
striter = AddressListLangPtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex && striter != AddressListLangPtr->end()){
strValue = striter->second;
-
+
}
cmbLanguage->SetValue(strValue);
striter = AddressListGeoPtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex && striter != AddressListGeoPtr->end()){
strValue = striter->second;
striter = AddressListTimezonePtr->find(AddressListIndex);
- if (striter->first == AddressListIndex){
+ if (striter->first == AddressListIndex && striter != AddressListTimezonePtr->end()){
strValue = striter->second;