// with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
#include "frmContactEditorNotes.h"
-#include "../common/textprocessing.h"
-#include <wx/tokenzr.h>
frmContactEditorNotes::frmContactEditorNotes( wxWindow* parent )
:
frmContactEditorNotesADT( parent )
{
+
+ // Setup the editor window.
+
EditorMode = FALSE;
- sliPriority->Disable();
-}
-
-void frmContactEditorNotes::EnablePriority( wxCommandEvent& event )
-{
- if (chkUsePref->IsChecked()){
- sliPriority->Enable();
- } else {
- sliPriority->Disable();
+ priorityCtrl = new XABPriorityCtrl(tabPriority);
+ szrPriority->Add(priorityCtrl, 1, wxEXPAND, 5);
+ szrPriority->Layout();
+
+ // Setup the language combo box.
+
+ std::vector<std::string> LanguageCodeList = GetLanguageCodeList();
+
+ wxArrayString LanguageList;
+
+ for (auto LanguageItem : LanguageCodeList){
+
+ LanguageList.Add((wxString)LanguageItem, 1);
+
}
+
+ cmbLanguage->Append(LanguageList);
+
}
void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
{
+
+ // Process action.
+
long ListCtrlIndex;
if (EditorMode == FALSE){
// Add note priority.
- if (chkUsePref->IsChecked()){
+ if (priorityCtrl->IsPriorityChecked()){
- NotesListPrefPtr->insert(std::make_pair(NotesListIndex, sliPriority->GetValue()));
+ NotesListPrefPtr->insert(std::make_pair(NotesListIndex, priorityCtrl->GetValue()));
} else {
coldata.SetText(txtNote->GetValue());
ListCtrlIndex = NotesListCtrlPtr->InsertItem(coldata);
- if (chkUsePref->IsChecked()){
+ if (priorityCtrl->IsPriorityChecked()){
- NotesListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+ NotesListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
}
NotesListPrefPtr->erase(NotesListIndex);
- if (chkUsePref->IsChecked()){
+ if (priorityCtrl->IsPriorityChecked()){
- NotesListPrefPtr->insert(std::make_pair(NotesListIndex, sliPriority->GetValue()));
+ NotesListPrefPtr->insert(std::make_pair(NotesListIndex, priorityCtrl->GetValue()));
} else {
NotesListCtrlPtr->SetItem(longSelected, 0, txtNote->GetValue());
- if (chkUsePref->IsChecked()){
+ if (priorityCtrl->IsPriorityChecked()){
- NotesListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+ NotesListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
} else {
void frmContactEditorNotes::SetEditorMode(bool EditMode, SectionType SectType)
{
+
+ // Set the editor mode.
+
// Set if the editor is adding or editing an address.
// FALSE = Add
// TRUE = Edit
striter = NotesListLangPtr->find(NotesListIndex);
+ strValue.clear();
+
if (striter->first == NotesListIndex &&
striter != NotesListLangPtr->end()){
if (intiter->first == NotesListIndex && intiter->second > 0 &&
intiter != NotesListPrefPtr->end()){
- sliPriority->SetValue(intiter->second);
- sliPriority->Enable();
- chkUsePref->SetValue(TRUE);
+ priorityCtrl->SetValue(intiter->second);
+ priorityCtrl->EnablePriority(true);
}
void frmContactEditorNotes::CloseWindow( wxCommandEvent& event )
{
+
+ // Close the window.
+
this->Close();
+
}
int NotesIndex )
{
+ // Setup the pointers.
+
NotesListPtr = NotesList;
NotesListLangPtr = NotesListLang;
NotesListAltIDPtr = NotesListAltID;