Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorNickname/Notes: Use list of ISO 639-1 languages
[xestiaab/.git] / source / contacteditor / frmContactEditorNotes.cpp
index 0dbfb78..ab0a64d 100644 (file)
 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
 
 #include "frmContactEditorNotes.h"
-#include "../common/textprocessing.h"
-#include <wx/tokenzr.h>
 
 frmContactEditorNotes::frmContactEditorNotes( wxWindow* parent )
 :
 frmContactEditorNotesADT( parent )
 {
+       
+       // Setup the editor window.
+       
        EditorMode = FALSE;
        sliPriority->Disable();
+       
+       // Setup the language combo box.
+       
+       std::vector<std::string> LanguageCodeList = GetLanguageCodeList();
+       
+       wxArrayString LanguageList;
+       
+       for (auto LanguageItem : LanguageCodeList){
+               
+               LanguageList.Add((wxString)LanguageItem, 1);
+               
+       }
+       
+       cmbLanguage->Append(LanguageList);
+       
 }
 
 void frmContactEditorNotes::EnablePriority( wxCommandEvent& event )
 {
+       
+       // Enable/disable the priority setting.
+       
        if (chkUsePref->IsChecked()){
                sliPriority->Enable();
        } else {
                sliPriority->Disable();
        }
+       
 }
 
 void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
 {
+       
+       // Process action.
+       
        long ListCtrlIndex;
        
        if (EditorMode == FALSE){
@@ -184,6 +207,9 @@ void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
 
 void frmContactEditorNotes::SetEditorMode(bool EditMode, SectionType SectType)
 {
+       
+       // Set the editor mode.
+       
        // Set if the editor is adding or editing an address.
        // FALSE = Add
        // TRUE = Edit
@@ -220,7 +246,10 @@ void frmContactEditorNotes::SetEditorMode(bool EditMode, SectionType SectType)
                
                striter = NotesListLangPtr->find(NotesListIndex);
                
-               if (striter->first == NotesListIndex){
+               strValue.clear();
+               
+               if (striter->first == NotesListIndex &&
+                       striter != NotesListLangPtr->end()){
                
                        strValue = striter->second;
                
@@ -232,7 +261,8 @@ void frmContactEditorNotes::SetEditorMode(bool EditMode, SectionType SectType)
                
                intiter = NotesListPrefPtr->find(NotesListIndex);
                
-               if (intiter->first == NotesListIndex && intiter->second > 0){
+               if (intiter->first == NotesListIndex && intiter->second > 0 &&
+                       intiter != NotesListPrefPtr->end()){
                
                        sliPriority->SetValue(intiter->second);
                        sliPriority->Enable();
@@ -248,7 +278,11 @@ void frmContactEditorNotes::SetEditorMode(bool EditMode, SectionType SectType)
 
 void frmContactEditorNotes::CloseWindow( wxCommandEvent& event )
 {
+       
+       // Close the window.
+       
        this->Close();
+       
 }
 
 
@@ -263,6 +297,8 @@ void frmContactEditorNotes::SetupPointers(std::map<int, wxString> *NotesList,
        int NotesIndex )
 {
 
+       // Setup the pointers.
+       
        NotesListPtr = NotesList;
        NotesListLangPtr = NotesListLang;
        NotesListAltIDPtr = NotesListAltID;
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