X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditorOrganisations.cpp;h=fa0ca456e821a13996138f96a2ec43a8eb315215;hb=cb31afce9cc7f778ed1519c8d3b17cce6f7bc1a3;hp=b6c2e19fcdb1cb459040e246b97f802a5560fc0a;hpb=da64d37d0a13895554e4ad945c46dd0af6d1c0e6;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditorOrganisations.cpp b/source/contacteditor/frmContactEditorOrganisations.cpp index b6c2e19..fa0ca45 100644 --- a/source/contacteditor/frmContactEditorOrganisations.cpp +++ b/source/contacteditor/frmContactEditorOrganisations.cpp @@ -24,13 +24,19 @@ frmContactEditorOrganisations::frmContactEditorOrganisations( wxWindow* parent ) : frmContactEditorOrganisationsADT( parent ) { + + // Setup the window. + EditorMode = FALSE; sliPriority->Disable(); + } void frmContactEditorOrganisations::UpdateSortAs( wxCommandEvent& event ) { + // Update the predefined SortAs listings. + // Clear out the options for the combo box. cmbSortAs->Clear(); @@ -69,16 +75,22 @@ void frmContactEditorOrganisations::UpdateSortAs( wxCommandEvent& event ) void frmContactEditorOrganisations::EnablePriority( wxCommandEvent& event ) { + + // Enable/disable the priority setting. + if (chkUsePref->IsChecked()){ sliPriority->Enable(); } else { sliPriority->Disable(); } + } void frmContactEditorOrganisations::ProcessAction( wxCommandEvent& event ) { + // Process action. + long ListCtrlIndex; if (EditorMode == FALSE){ @@ -199,6 +211,9 @@ void frmContactEditorOrganisations::ProcessAction( wxCommandEvent& event ) void frmContactEditorOrganisations::SetEditorMode(bool EditMode, SectionType SectType) { + + // Set the editor mode. + // Set if the editor is adding or editing an address. // FALSE = Add // TRUE = Edit @@ -239,7 +254,8 @@ void frmContactEditorOrganisations::SetEditorMode(bool EditMode, SectionType Sec striter = OrganisationListSortAsPtr->find(OrganisationListIndex); - if (striter->first == OrganisationListIndex){ + if (striter->first == OrganisationListIndex && + striter != OrganisationListSortAsPtr->end()){ strValue = striter->second; @@ -251,7 +267,8 @@ void frmContactEditorOrganisations::SetEditorMode(bool EditMode, SectionType Sec intiter = OrganisationListPrefPtr->find(OrganisationListIndex); - if (intiter->first == OrganisationListIndex && intiter->second > 0){ + if (intiter->first == OrganisationListIndex && intiter->second > 0 && + intiter != OrganisationListPrefPtr->end()){ sliPriority->SetValue(intiter->second); sliPriority->Enable(); @@ -267,7 +284,11 @@ void frmContactEditorOrganisations::SetEditorMode(bool EditMode, SectionType Sec void frmContactEditorOrganisations::CloseWindow( wxCommandEvent& event ) { + + // Close the window. + this->Close(); + } void frmContactEditorOrganisations::SetupPointers(std::map *OrganisationList, @@ -282,6 +303,8 @@ void frmContactEditorOrganisations::SetupPointers(std::map *Organ int OrganisationIndex ) { + // Setup the pointers. + OrganisationListPtr = OrganisationList; OrganisationListLanguagePtr = OrganisationListLanguage; OrganisationListSortAsPtr = OrganisationListSortAs;