X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditorAddress.cpp;h=6c6811793ac7658d218df60f3e0473e5a6e9b8a9;hb=bfe817b5bfae33a1eb666c463643ec119cd1d66d;hp=bc1b44c97dd95036ae877de33cfcc65fedab25cb;hpb=c6ccf99af72092905b595cbd53613f8c06849a35;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditorAddress.cpp b/source/contacteditor/frmContactEditorAddress.cpp index bc1b44c..6c68117 100644 --- a/source/contacteditor/frmContactEditorAddress.cpp +++ b/source/contacteditor/frmContactEditorAddress.cpp @@ -26,8 +26,12 @@ frmContactEditorAddress::frmContactEditorAddress( wxWindow* parent ) : frmContactEditorAddressADT( parent ) { + + // Setup the window. + EditorMode = FALSE; sliPriority->Disable(); + } void frmContactEditorAddress::InitAddressEditor( wxInitDialogEvent& event ) @@ -37,16 +41,22 @@ void frmContactEditorAddress::InitAddressEditor( wxInitDialogEvent& event ) void frmContactEditorAddress::EnablePriority( wxCommandEvent& event ) { + + // Enable/disable the priority setting. + if (chkUsePref->IsChecked()){ sliPriority->Enable(); } else { sliPriority->Disable(); } + } void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) { + // Process data. + // Check what edit mode we are in and go from there. long ListCtrlIndex; @@ -109,16 +119,11 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) AddressListTypePtr->insert(std::make_pair(AddressListIndex, wxT("work"))); } - - //AddressListTypePtr = &AddressListType; - + // Add the mediatype to the list (maps). AddressListMediatypePtr->insert(std::make_pair(AddressListIndex, wxT("text/plain"))); - //AddressListMediatypePtr = &AddressListMediatype; - //AddressListPrefPtr = &AddressListPref; - if (chkUsePref->IsChecked()){ AddressListPrefPtr->insert(std::make_pair(AddressListIndex, sliPriority->GetValue())); @@ -158,24 +163,6 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) wxString strValue; long longSelected = -1; - /* - strAddress.Append(wxT(";;")); - - strAddress.Append(txtAddress->GetValue()); - strAddress.Append(wxT(";")); - - strAddress.Append(txtTownCity->GetValue()); - strAddress.Append(wxT(";")); - - strAddress.Append(txtCounty->GetValue()); - strAddress.Append(wxT(";")); - - strAddress.Append(txtPostCode->GetValue()); - strAddress.Append(wxT(";")); - - strAddress.Append(txtCountry->GetValue()); - */ - AddressListPtr->erase(AddressListIndex); AddressListPtr->insert(std::make_pair(AddressListIndex, txtAddress->GetValue())); @@ -191,8 +178,6 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) AddressListCountryPtr->erase(AddressListIndex); AddressListCountryPtr->insert(std::make_pair(AddressListIndex, txtCountry->GetValue())); - //AddressListLabelPtr = &AddressListLabel; - // Add the label to the list (maps). AddressListLabelPtr->erase(AddressListIndex); @@ -204,8 +189,6 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) // Add the language to the list (maps). - //AddressListLangPtr = &AddressListLang; - AddressListLangPtr->erase(AddressListIndex); AddressListLangPtr->insert(std::make_pair(AddressListIndex, cmbLanguage->GetValue())); @@ -227,19 +210,12 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) AddressListTimezonePtr->erase(AddressListIndex); AddressListTimezonePtr->insert(std::make_pair(AddressListIndex, txtTimezone->GetValue())); - - // No need to update type since it will not have changed. - - //AddressListTypePtr = &AddressListType; // Add the mediatype to the list (maps). AddressListMediatypePtr->erase(AddressListIndex); AddressListMediatypePtr->insert(std::make_pair(AddressListIndex, wxT("text/plain"))); - //AddressListMediatypePtr = &AddressListMediatype; - //AddressListPrefPtr = &AddressListPref; - AddressListPrefPtr->erase(AddressListIndex); if (chkUsePref->IsChecked()){ @@ -285,12 +261,18 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) void frmContactEditorAddress::CloseWindow( wxCommandEvent& event ) { + + // Close the window. + this->Close(); + } void frmContactEditorAddress::CopyAddress( wxCommandEvent& event ) { + // Copy the address. + wxString MailingLabel; bool AddComma = FALSE; @@ -363,6 +345,9 @@ void frmContactEditorAddress::CopyAddress( wxCommandEvent& event ) void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType ) { + + // Set the editor mode. + // Set if the editor is adding or editing an address. // FALSE = Add // TRUE = Edit @@ -388,7 +373,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListPtr->end()){ txtAddress->SetValue(striter->second); @@ -396,7 +382,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListTownPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListTownPtr->end()){ txtTownCity->SetValue(striter->second); @@ -404,7 +391,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListCountyPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListCountyPtr->end()){ txtCounty->SetValue(striter->second); @@ -412,7 +400,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListPostCodePtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListPostCodePtr->end()){ txtPostCode->SetValue(striter->second); @@ -420,20 +409,19 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListCountryPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListCountryPtr->end()){ txtCountry->SetValue(striter->second); } - //CaptureString(&strValue, TRUE); - //->Replace(wxT("\;"), wxT("\;;"), TRUE); - // Setup the Slider. intiter = AddressListPrefPtr->find(AddressListIndex); - if (intiter->first == AddressListIndex && intiter->second > 0 && intiter != AddressListPrefPtr->end()){ + if (intiter->first == AddressListIndex && intiter->second > 0 && intiter != AddressListPrefPtr->end() && + intiter != AddressListPrefPtr->end()){ sliPriority->SetValue(intiter->second); sliPriority->Enable(); @@ -445,7 +433,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListLabelPtr->find(AddressListIndex); - if (striter->first == AddressListIndex && striter != AddressListLabelPtr->end()){ + if (striter->first == AddressListIndex && striter != AddressListLabelPtr->end() && + striter != AddressListLabelPtr->end()){ strValue = striter->second; if (strValue.Left(1) == "\"" && strValue.Right(1) == "\""){ @@ -481,7 +470,7 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListTimezonePtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && striter != AddressListTimezonePtr->end()){ strValue = striter->second; @@ -513,6 +502,8 @@ void frmContactEditorAddress::SetupPointers( std::map *AddressLis int AddressIndex ) { + // Setup the pointers. + AddressListPtr = AddressList; AddressListTownPtr = AddressListTown; AddressListCountyPtr = AddressListCounty;