:
frmContactEditorKeyADT( parent )
{
+
+ // Setup the window.
+
EditorMode = FALSE;
- sliPriority->Disable();
+ priorityCtrl = new XABPriorityCtrl(tabGeneral);
+ szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5);
// Setup the control boxes and hide tabs unless they are
// needed.
}
-void frmContactEditorKey::EnablePriority( wxCommandEvent& event )
-{
- 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
striter = KeyListDataTypePtr->find(KeyListIndex);
- if (striter->first == KeyListIndex){
+ if (striter->first == KeyListIndex &&
+ striter != KeyListDataTypePtr->end()){
strValue = striter->second;
striter = KeyListDataTypePtr->find(KeyListIndex);
- if (striter->first == KeyListIndex){
+ if (striter->first == KeyListIndex &&
+ striter != KeyListDataTypePtr->end()){
strValue = striter->second;
striter = KeyListTypePtr->find(KeyListIndex);
- if (striter->first == KeyListIndex){
+ if (striter->first == KeyListIndex &&
+ striter != KeyListTypePtr->end()){
strValue = striter->second;
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();
- chkUsePref->SetValue(TRUE);
+ priorityCtrl->SetValue(intiter->second);
+ priorityCtrl->EnablePriority(true);
}
void frmContactEditorKey::ProcessAction( wxCommandEvent& event )
{
+
+ // Process action.
+
long ListCtrlIndex;
int intKeyType = 0;
// Get Key priority.
- if (chkUsePref->IsChecked()){
+ if (priorityCtrl->IsPriorityChecked()){
- KeyListPrefPtr->insert(std::make_pair(KeyListIndex, sliPriority->GetValue()));
- KeyListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+ KeyListPrefPtr->insert(std::make_pair(KeyListIndex, priorityCtrl->GetValue()));
+ KeyListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
} else {
}
- if (chkUsePref->IsChecked()){
-
- }
-
this->Close();
} else if (EditorMode == TRUE){
KeyListPrefPtr->erase(KeyListIndex);
- if (chkUsePref->IsChecked()){
+ if (priorityCtrl->IsPriorityChecked()){
- KeyListPrefPtr->insert(std::make_pair(KeyListIndex, sliPriority->GetValue()));
- KeyListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+ KeyListPrefPtr->insert(std::make_pair(KeyListIndex, priorityCtrl->GetValue()));
+ KeyListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
} else {
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();
void frmContactEditorKey::ConvertURLType( wxCommandEvent& event )
{
+ // Convert the URL type.
+
wxString strValue;
strValue = cmbURL->GetString(cmbURL->GetCurrentSelection());
void frmContactEditorKey::ConvertKeyType( wxCommandEvent& event )
{
+ // Convert the key type.
+
wxString strValue;
strValue = cmbKeyType->GetString(cmbKeyType->GetCurrentSelection());
void frmContactEditorKey::CloseWindow( wxCommandEvent& event )
{
+
+ // Close this window.
+
this->Close();
+
}
void frmContactEditorKey::SetupPointers(std::map<int, wxString> *KeyList,
int KeyIndex )
{
+ // Setup the pointers.
+
KeyListPtr = KeyList;
KeyListAltIDPtr = KeyListAltID;
KeyListPIDPtr = KeyListPID;