X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditorAddress.cpp;h=a653d271ae9e9d6c773f895713680c331ae75e48;hb=ee9b71949005734012f18251774807c38b989ae2;hp=bc1b44c97dd95036ae877de33cfcc65fedab25cb;hpb=c6ccf99af72092905b595cbd53613f8c06849a35;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditorAddress.cpp b/source/contacteditor/frmContactEditorAddress.cpp index bc1b44c..a653d27 100644 --- a/source/contacteditor/frmContactEditorAddress.cpp +++ b/source/contacteditor/frmContactEditorAddress.cpp @@ -26,8 +26,14 @@ frmContactEditorAddress::frmContactEditorAddress( wxWindow* parent ) : frmContactEditorAddressADT( parent ) { + + // Setup the window. + EditorMode = FALSE; - sliPriority->Disable(); + priorityCtrl = new XABPriorityCtrl(tabGeneral); + szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5); + szrGeneral->Layout(); + } void frmContactEditorAddress::InitAddressEditor( wxInitDialogEvent& event ) @@ -35,18 +41,11 @@ void frmContactEditorAddress::InitAddressEditor( wxInitDialogEvent& event ) // Do nothing with this subroutine at this time. } -void frmContactEditorAddress::EnablePriority( wxCommandEvent& event ) -{ - 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,19 +108,14 @@ 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()){ + if (priorityCtrl->IsPriorityChecked()){ - AddressListPrefPtr->insert(std::make_pair(AddressListIndex, sliPriority->GetValue())); + AddressListPrefPtr->insert(std::make_pair(AddressListIndex, priorityCtrl->GetValue())); } else { @@ -142,9 +136,9 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) AddressListCtrlPtr->SetItem(ListCtrlIndex, 2, txtCounty->GetValue()); AddressListCtrlPtr->SetItem(ListCtrlIndex, 3, txtPostCode->GetValue()); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - AddressListCtrlPtr->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), sliPriority->GetValue())); + AddressListCtrlPtr->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), priorityCtrl->GetValue())); } @@ -158,24 +152,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 +167,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 +178,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,24 +199,17 @@ 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()){ + if (priorityCtrl->IsPriorityChecked()){ - AddressListPrefPtr->insert(std::make_pair(AddressListIndex, sliPriority->GetValue())); + AddressListPrefPtr->insert(std::make_pair(AddressListIndex, priorityCtrl->GetValue())); } else { @@ -267,9 +232,9 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event ) AddressListCtrlPtr->SetItem(longSelected, 2, txtCounty->GetValue()); AddressListCtrlPtr->SetItem(longSelected, 3, txtPostCode->GetValue()); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - AddressListCtrlPtr->SetItem(longSelected, 4, wxString::Format(wxT("%i"), sliPriority->GetValue())); + AddressListCtrlPtr->SetItem(longSelected, 4, wxString::Format(wxT("%i"), priorityCtrl->GetValue())); } else { @@ -285,12 +250,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 +334,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 +362,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 +371,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 +380,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 +389,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,24 +398,22 @@ 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(); - chkUsePref->SetValue(TRUE); + priorityCtrl->SetValue(intiter->second); + priorityCtrl->EnablePriority(true); } @@ -445,7 +421,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 +458,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 +490,8 @@ void frmContactEditorAddress::SetupPointers( std::map *AddressLis int AddressIndex ) { + // Setup the pointers. + AddressListPtr = AddressList; AddressListTownPtr = AddressListTown; AddressListCountyPtr = AddressListCounty;