X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditorKey.cpp;h=fb6319b8591b73a289983382c78a99ccceee2c1b;hb=7c7382aec816add24a96a03f4cd37c461f48e9b6;hp=bcac1f534feab6ffcd81395ed3d8d6a0043972e6;hpb=da64d37d0a13895554e4ad945c46dd0af6d1c0e6;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditorKey.cpp b/source/contacteditor/frmContactEditorKey.cpp index bcac1f5..fb6319b 100644 --- a/source/contacteditor/frmContactEditorKey.cpp +++ b/source/contacteditor/frmContactEditorKey.cpp @@ -25,6 +25,9 @@ frmContactEditorKey::frmContactEditorKey( wxWindow* parent ) : frmContactEditorKeyADT( parent ) { + + // Setup the window. + EditorMode = FALSE; sliPriority->Disable(); @@ -37,26 +40,36 @@ frmContactEditorKeyADT( parent ) cmbKeyMainType->Append(_("URL")); cmbKeyMainType->Append(_("Key")); + cmbType->Append(""); cmbType->Append(_("Home")); cmbType->Append(_("Work")); cmbURL->Append(_("PGP Key")); cmbKeyType->Append(_("PGP Key")); + + cmbType->SetSelection(0); } void frmContactEditorKey::EnablePriority( wxCommandEvent& event ) { + + // Enable/disable the priority setting. + if (chkUsePref->IsChecked()){ sliPriority->Enable(); } else { sliPriority->Disable(); } + } void frmContactEditorKey::SetEditorMode(bool EditMode) { + + // Set the editor mode. + // Set if the editor is adding or editing an address. // FALSE = Add // TRUE = Edit @@ -110,7 +123,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) striter = KeyListDataTypePtr->find(KeyListIndex); - if (striter->first == KeyListIndex){ + if (striter->first == KeyListIndex && + striter != KeyListDataTypePtr->end()){ strValue = striter->second; @@ -149,7 +163,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) striter = KeyListDataTypePtr->find(KeyListIndex); - if (striter->first == KeyListIndex){ + if (striter->first == KeyListIndex && + striter != KeyListDataTypePtr->end()){ strValue = striter->second; @@ -165,7 +180,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) striter = KeyListTypePtr->find(KeyListIndex); - if (striter->first == KeyListIndex){ + if (striter->first == KeyListIndex && + striter != KeyListTypePtr->end()){ strValue = striter->second; @@ -189,7 +205,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) intiter = KeyListPrefPtr->find(KeyListIndex); - if (intiter->first == KeyListIndex && intiter->second > 0){ + if (intiter->first == KeyListIndex && intiter->second > 0 && + intiter != KeyListPrefPtr->end()){ sliPriority->SetValue(intiter->second); sliPriority->Enable(); @@ -203,6 +220,9 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) void frmContactEditorKey::ProcessAction( wxCommandEvent& event ) { + + // Process action. + long ListCtrlIndex; int intKeyType = 0; @@ -387,27 +407,17 @@ void frmContactEditorKey::ProcessAction( wxCommandEvent& event ) void frmContactEditorKey::ProcessKeyType( wxCommandEvent& event ) { - int intKeyType = 0; - - intKeyType = cmbKeyMainType->GetCurrentSelection(); - - if (intKeyType == 0){ - - tabURL->Show(); - tabKey->Hide(); - - } else if (intKeyType == 1){ - - tabURL->Hide(); - tabKey->Show(); - - } + // Process the key type (via wxCommandEvent). + ProcessKeyType(); + } void frmContactEditorKey::ProcessKeyType() { + // Process the key type. + int intKeyType = 0; intKeyType = cmbKeyMainType->GetCurrentSelection(); @@ -429,6 +439,8 @@ void frmContactEditorKey::ProcessKeyType() void frmContactEditorKey::ConvertURLType( wxCommandEvent& event ) { + // Convert the URL type. + wxString strValue; strValue = cmbURL->GetString(cmbURL->GetCurrentSelection()); @@ -444,6 +456,8 @@ void frmContactEditorKey::ConvertURLType( wxCommandEvent& event ) void frmContactEditorKey::ConvertKeyType( wxCommandEvent& event ) { + // Convert the key type. + wxString strValue; strValue = cmbKeyType->GetString(cmbKeyType->GetCurrentSelection()); @@ -458,7 +472,11 @@ void frmContactEditorKey::ConvertKeyType( wxCommandEvent& event ) void frmContactEditorKey::CloseWindow( wxCommandEvent& event ) { + + // Close this window. + this->Close(); + } void frmContactEditorKey::SetupPointers(std::map *KeyList, @@ -473,6 +491,8 @@ void frmContactEditorKey::SetupPointers(std::map *KeyList, int KeyIndex ) { + // Setup the pointers. + KeyListPtr = KeyList; KeyListAltIDPtr = KeyListAltID; KeyListPIDPtr = KeyListPID;