X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Key.cpp;h=b9edcaf6c400a4e1b71a2ab909dd29c4471b6bd7;hb=ee9b71949005734012f18251774807c38b989ae2;hp=1242984eeaafa8f1e8032a7d989a4f3b078180d9;hpb=ced2926f7cc50f19d5c5be0a8c6d60e15f93caf5;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Key.cpp b/source/contacteditor/frmContactEditor-Key.cpp index 1242984..b9edcaf 100644 --- a/source/contacteditor/frmContactEditor-Key.cpp +++ b/source/contacteditor/frmContactEditor-Key.cpp @@ -21,69 +21,78 @@ void frmContactEditor::AddKey( wxCommandEvent& event ) { - int intResult = 0; - - frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this ); - frameCEKey->SetEditorMode(FALSE); - intResult = GetLastInt(&ContactEditorData.KeyList); - frameCEKey->SetupPointers(&ContactEditorData.KeyList, - &ContactEditorData.KeyListAltID, - &ContactEditorData.KeyListPID, - &ContactEditorData.KeyListKeyType, - &ContactEditorData.KeyListDataType, - &ContactEditorData.KeyListType, - &ContactEditorData.KeyListTokens, - &ContactEditorData.KeyListPref, - lboKeys, - (intValueSeek)); - frameCEKey->ShowModal(); - delete frameCEKey; - frameCEKey = NULL; + + // Bring up the window for adding a key. + + frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this ); + frameCEKey->SetEditorMode(FALSE); + frameCEKey->SetupPointers(&ContactEditorData.KeyList, + &ContactEditorData.KeyListAltID, + &ContactEditorData.KeyListPID, + &ContactEditorData.KeyListKeyType, + &ContactEditorData.KeyListDataType, + &ContactEditorData.KeyListType, + &ContactEditorData.KeyListTokens, + &ContactEditorData.KeyListPref, + lboKeys, + (intValueSeek)); + frameCEKey->ShowModal(); + delete frameCEKey; + frameCEKey = NULL; + intValueSeek++; + } void frmContactEditor::ModifyKey( wxCommandEvent& event ) { - long longSelected = -1; - int intSelectedData = 0; + + // Bring up the window for modifying a key. + + long longSelected = -1; + int intSelectedData = 0; - if (!GetSelectedItem(lboKeys, - &longSelected, - &intSelectedData)){ - return; - } + if (lboKeys->GetItemCount() == 0 || !GetSelectedItem(lboKeys, + &longSelected, + &intSelectedData)){ + return; + } - frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this ); - frameCEKey->SetupPointers(&ContactEditorData.KeyList, - &ContactEditorData.KeyListAltID, - &ContactEditorData.KeyListPID, - &ContactEditorData.KeyListKeyType, - &ContactEditorData.KeyListDataType, - &ContactEditorData.KeyListType, - &ContactEditorData.KeyListTokens, - &ContactEditorData.KeyListPref, - lboKeys, - intSelectedData); - frameCEKey->SetEditorMode(TRUE); - frameCEKey->ShowModal(); - delete frameCEKey; - frameCEKey = NULL; + frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this ); + frameCEKey->SetupPointers(&ContactEditorData.KeyList, + &ContactEditorData.KeyListAltID, + &ContactEditorData.KeyListPID, + &ContactEditorData.KeyListKeyType, + &ContactEditorData.KeyListDataType, + &ContactEditorData.KeyListType, + &ContactEditorData.KeyListTokens, + &ContactEditorData.KeyListPref, + lboKeys, + intSelectedData); + frameCEKey->SetEditorMode(TRUE); + frameCEKey->ShowModal(); + delete frameCEKey; + frameCEKey = NULL; + } void frmContactEditor::DeleteKey( wxCommandEvent& event ) { - long longSelected = -1; - int intSelectedData = 0; + + // Delete a key. + + long longSelected = -1; + int intSelectedData = 0; - if (!GetSelectedItem(lboKeys, - &longSelected, - &intSelectedData)){ - return; - } + if (lboKeys->GetItemCount() == 0 || !GetSelectedItem(lboKeys, + &longSelected, + &intSelectedData)){ + return; + } - lboKeys->DeleteItem(longSelected); + lboKeys->DeleteItem(longSelected); - DeleteMapData(intSelectedData, &ContactEditorData.KeyList, &ContactEditorData.KeyListAltID, - &ContactEditorData.KeyListPID, &ContactEditorData.KeyListKeyType, &ContactEditorData.KeyListDataType, &ContactEditorData.KeyListType, - &ContactEditorData.KeyListTokens, &ContactEditorData.KeyListPref); + DeleteMapData(intSelectedData, &ContactEditorData.KeyList, &ContactEditorData.KeyListAltID, + &ContactEditorData.KeyListPID, &ContactEditorData.KeyListKeyType, &ContactEditorData.KeyListDataType, &ContactEditorData.KeyListType, + &ContactEditorData.KeyListTokens, &ContactEditorData.KeyListPref); }