+// frmContactEditorKey.cpp - frmContactEditorKey form.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
+
#include "frmContactEditorKey.h"
#include <wx/tokenzr.h>
#include "../common/textprocessing.h"
:
frmContactEditorKeyADT( parent )
{
+
+ // Setup the window.
+
EditorMode = FALSE;
sliPriority->Disable();
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
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();
void frmContactEditorKey::ProcessAction( wxCommandEvent& event )
{
+
+ // Process action.
+
long ListCtrlIndex;
int intKeyType = 0;
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;