Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorNickname/Notes: Use list of ISO 639-1 languages
[xestiaab/.git] / source / contacteditor / frmContactEditorNickname.cpp
index 5261969..c67302c 100644 (file)
@@ -1,11 +1,40 @@
+// frmContactEditorNickname.cpp - frmContactEditorNickname 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 "frmContactEditorNickname.h"
-#include "../common/textprocessing.h"
 
 frmContactEditorNickname::frmContactEditorNickname( wxWindow* parent )
 :
 frmContactEditorNicknameADT( parent )
 {
 
+       std::vector<std::string> LanguageCodeList = GetLanguageCodeList();
+       
+       wxArrayString LanguageList;
+       
+       for (auto LanguageItem : LanguageCodeList){
+               
+               LanguageList.Add((wxString)LanguageItem, 1);
+               
+       }
+       
+       cmbLanguage->Append(LanguageList);
+       
 }
 
 void frmContactEditorNickname::InitAddressEditor( wxInitDialogEvent& event )
@@ -15,15 +44,22 @@ void frmContactEditorNickname::InitAddressEditor( wxInitDialogEvent& event )
 
 void frmContactEditorNickname::EnablePriority( wxCommandEvent& event )
 {
+       
+       // Enable/disable the priority.
+       
        if (chkUsePref->IsChecked()){
                sliPriority->Enable();
        } else {
                sliPriority->Disable();
        }
+       
 }
 
 void frmContactEditorNickname::ProcessData( wxCommandEvent& event )
 {
+       
+       // Process the data.
+       
        long ListCtrlIndex;
 
        if (EditorMode == FALSE){
@@ -139,11 +175,16 @@ void frmContactEditorNickname::ProcessData( wxCommandEvent& event )
 
 void frmContactEditorNickname::CloseWindow( wxCommandEvent& event )
 {
+       
+       // Close this window.
+       
        this->Close();
+       
 }
 
 void frmContactEditorNickname::SetEditorMode(bool EditMode, SectionType SectType)
 {
+       
        // Set if the editor is adding or editing an address.
        // FALSE = Add
        // TRUE = Edit
@@ -180,7 +221,8 @@ void frmContactEditorNickname::SetEditorMode(bool EditMode, SectionType SectType
                
                striter = NicknamesListLanguagePtr->find(NicknamesListIndex);
                 
-               if (striter->first == NicknamesListIndex){
+               if (striter->first == NicknamesListIndex &&
+                       striter != NicknamesListLanguagePtr->end()){
                
                        strValue = striter->second;
                
@@ -193,7 +235,8 @@ void frmContactEditorNickname::SetEditorMode(bool EditMode, SectionType SectType
                
                intiter = NicknamesListPrefPtr->find(NicknamesListIndex);
                
-               if (intiter->first == NicknamesListIndex && intiter->second > 0){
+               if (intiter->first == NicknamesListIndex && intiter->second > 0 &&
+                       intiter != NicknamesListPrefPtr->end()){
                
                        sliPriority->SetValue(intiter->second);
                        sliPriority->Enable();
@@ -218,6 +261,8 @@ void frmContactEditorNickname::SetupPointers(std::map<int, wxString> *NicknamesL
        int NicknamesIndex )
 {
 
+       // Setup the pointers.
+       
        NicknamesListPtr = NicknamesList;
        NicknamesListAltIDPtr = NicknamesListAltID;
        NicknamesListPIDPtr = NicknamesListPID;
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