Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added check for address list geographic and language for frmContactEdiotrAddress
[xestiaab/.git] / source / contacteditor / frmContactEditorAddress.cpp
index f613e0a..bc1b44c 100644 (file)
@@ -1,3 +1,21 @@
+// 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>
@@ -54,7 +72,10 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event )
                
                // 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).
                
@@ -175,7 +196,11 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event )
                // 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).
                
@@ -408,7 +433,7 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType
                
                intiter = AddressListPrefPtr->find(AddressListIndex);
                
-               if (intiter->first == AddressListIndex && intiter->second > 0){
+               if (intiter->first == AddressListIndex && intiter->second > 0 && intiter != AddressListPrefPtr->end()){
                
                        sliPriority->SetValue(intiter->second);
                        sliPriority->Enable();
@@ -420,9 +445,13 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType
                
                striter = AddressListLabelPtr->find(AddressListIndex);
                 
-               if (striter->first == AddressListIndex){
+               if (striter->first == AddressListIndex && striter != AddressListLabelPtr->end()){
                
                        strValue = striter->second;
+                       if (strValue.Left(1) == "\"" && strValue.Right(1) == "\""){
+                               strValue.erase(0, 1);
+                               strValue.RemoveLast();
+                       }
                
                }
 
@@ -432,17 +461,17 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType
                
                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;
                
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