X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditorIM.cpp;h=cfee2d3125ae1432e5fba2c0e7e35dcbecd2351b;hp=40bfef1485d94b68b51da11012ede86e00283ca7;hb=ada42724cf083b0a311cf22260485d61516c25c8;hpb=d4a3b50aae4237e9b5a0f4b3bd0a2eb4e8b69c3c diff --git a/source/contacteditor/frmContactEditorIM.cpp b/source/contacteditor/frmContactEditorIM.cpp index 40bfef1..cfee2d3 100644 --- a/source/contacteditor/frmContactEditorIM.cpp +++ b/source/contacteditor/frmContactEditorIM.cpp @@ -26,8 +26,13 @@ frmContactEditorIM::frmContactEditorIM( wxWindow* parent ) : frmContactEditorIMADT( parent ) { + + // Setup the window. + EditorMode = FALSE; - sliPriority->Disable(); + priorityCtrl = new XABPriorityCtrl(tabGeneral); + szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5); + szrGeneral->Layout(); // Add some values to the drop down box for IM types. @@ -41,18 +46,11 @@ frmContactEditorIMADT( parent ) } -void frmContactEditorIM::EnablePriority( wxCommandEvent& event ) -{ - if (chkUsePref->IsChecked()){ - sliPriority->Enable(); - } else { - sliPriority->Disable(); - } -} - void frmContactEditorIM::ProcessAction( wxCommandEvent& event ) { + // Process the action. + long ListCtrlIndex; // Check if IM type is empty and if it is then @@ -142,9 +140,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event ) // Set the priority. - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - IMListPrefPtr->insert(std::make_pair(IMListIndex, sliPriority->GetValue())); + IMListPrefPtr->insert(std::make_pair(IMListIndex, priorityCtrl->GetValue())); } else { @@ -163,9 +161,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event ) IMListCtrlPtr->SetItem(ListCtrlIndex, 1, txtUsername->GetValue()); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - IMListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), sliPriority->GetValue())); + IMListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue())); } @@ -222,9 +220,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event ) IMListPrefPtr->erase(IMListIndex); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - IMListPrefPtr->insert(std::make_pair(IMListIndex, sliPriority->GetValue())); + IMListPrefPtr->insert(std::make_pair(IMListIndex, priorityCtrl->GetValue())); } else { @@ -245,9 +243,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event ) IMListCtrlPtr->SetItem(longSelected, 0, cmbIMType->GetValue()); IMListCtrlPtr->SetItem(longSelected, 1, txtUsername->GetValue()); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - IMListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), sliPriority->GetValue())); + IMListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue())); } else { @@ -263,11 +261,18 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event ) void frmContactEditorIM::CloseWindow( wxCommandEvent& event ) { + + // Close the window. + this->Close(); + } void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType) { + + // Set the editor mode. + // Set if the editor is adding or editing an address. // FALSE = Add // TRUE = Edit @@ -300,8 +305,17 @@ void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType) } - strIMUser = IMListPtr->find(IMListIndex)->second; - strIMType = IMListTypeInfoPtr->find(IMListIndex)->second; + if (IMListPtr->find(IMListIndex) != IMListPtr->end()){ + + strIMUser = IMListPtr->find(IMListIndex)->second; + + } + + if (IMListTypeInfoPtr->find(IMListIndex) != IMListTypeInfoPtr->end()){ + + strIMType = IMListTypeInfoPtr->find(IMListIndex)->second; + + } if (strIMType == wxT("aim")){ @@ -348,11 +362,11 @@ void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType) intiter = IMListPrefPtr->find(IMListIndex); - if (intiter->first == IMListIndex && intiter->second > 0){ + if (intiter->first == IMListIndex && intiter->second > 0 && + intiter != IMListPrefPtr->end()){ - sliPriority->SetValue(intiter->second); - sliPriority->Enable(); - chkUsePref->SetValue(TRUE); + priorityCtrl->SetValue(intiter->second); + priorityCtrl->EnablePriority(true); } @@ -374,6 +388,8 @@ void frmContactEditorIM::SetupPointers( std::map *IMList, int IMIndex ) { + // Setup the pointers. + IMListPtr = IMList; IMListAltIDPtr = IMListAltID; IMListPIDPtr = IMListPID;