1 // frmContactEditor-Home.cpp - frmContactEditor Home tab subroutines.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmContactEditor.h"
20 #include "frmContactEditorNickname.h"
21 #include "frmContactEditorAddress.h"
22 #include "frmContactEditorEmail.h"
23 #include "frmContactEditorIM.h"
24 #include "frmContactEditorTelephone.h"
25 #include "frmContactEditorLanguages.h"
26 #include "frmContactEditorTimezones.h"
27 #include "frmContactEditorRelated.h"
28 #include "frmContactEditorWebsites.h"
29 #include "frmContactEditorTitles.h"
30 #include "frmContactEditorRoles.h"
31 #include "frmContactEditorGeoposition.h"
32 #include "frmContactEditorGroups.h"
33 #include "frmContactEditorOrganisations.h"
34 #include "frmContactEditorNotes.h"
36 void frmContactEditor::AddHomeNickname( wxCommandEvent& event )
40 frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
41 frameCENickname->SetEditorMode(FALSE, CE_HOME);
42 intResult = GetLastInt(&HomeNicknamesList);
43 frameCENickname->SetupPointers(&HomeNicknamesList,
44 &HomeNicknamesListAltID,
45 &HomeNicknamesListPID,
46 &HomeNicknamesListType,
47 &HomeNicknamesListLanguage,
48 &HomeNicknamesListTokens,
49 &HomeNicknamesListPref,
52 frameCENickname->ShowModal();
53 delete frameCENickname;
54 frameCENickname = NULL;
57 void frmContactEditor::ModifyHomeNickname( wxCommandEvent& event )
59 long longSelected = -1;
60 int intSelectedData = 0;
62 if (!GetSelectedItem(lboHomeNicknames,
68 frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
69 frameCENickname->SetupPointers(&HomeNicknamesList,
70 &HomeNicknamesListAltID,
71 &HomeNicknamesListPID,
72 &HomeNicknamesListType,
73 &HomeNicknamesListLanguage,
74 &HomeNicknamesListTokens,
75 &HomeNicknamesListPref,
78 frameCENickname->SetEditorMode(TRUE, CE_HOME);
79 frameCENickname->ShowModal();
80 delete frameCENickname;
81 frameCENickname = NULL;
84 void frmContactEditor::DeleteHomeNickname( wxCommandEvent& event )
87 long longSelected = -1;
88 int intSelectedData = 0;
90 if (!GetSelectedItem(lboHomeNicknames,
96 lboHomeNicknames->DeleteItem(longSelected);
98 DeleteMapData(intSelectedData,
100 &HomeNicknamesListLanguage,
101 &HomeNicknamesListAltID,
102 &HomeNicknamesListPID,
103 &HomeNicknamesListTokens,
104 &HomeNicknamesListType,
105 &HomeNicknamesListPref);
109 void frmContactEditor::AddHomeAddress( wxCommandEvent& event )
113 frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
114 frameCEAddress->SetEditorMode(FALSE, CE_HOME);
115 intResult = GetLastInt(&HomeAddressList);
116 frameCEAddress->SetupPointers(&HomeAddressList,
117 &HomeAddressListTown,
118 &HomeAddressListCounty,
119 &HomeAddressListPostCode,
120 &HomeAddressListCountry,
121 &HomeAddressListLabel,
122 &HomeAddressListLang,
123 &HomeAddressListAltID,
125 &HomeAddressListTokens,
127 &HomeAddressListTimezone,
128 &HomeAddressListType,
129 &HomeAddressListMediatype,
130 &HomeAddressListPref,
133 frameCEAddress->ShowModal();
134 delete frameCEAddress;
135 frameCEAddress = NULL;
138 void frmContactEditor::ModifyHomeAddress( wxCommandEvent& event )
140 long longSelected = -1;
141 int intSelectedData = 0;
143 if (!GetSelectedItem(lboHomeAddresses,
149 frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
150 frameCEAddress->SetupPointers(&HomeAddressList,
151 &HomeAddressListTown,
152 &HomeAddressListCounty,
153 &HomeAddressListPostCode,
154 &HomeAddressListCountry,
155 &HomeAddressListLabel,
156 &HomeAddressListLang,
157 &HomeAddressListAltID,
159 &HomeAddressListTokens,
161 &HomeAddressListTimezone,
162 &HomeAddressListType,
163 &HomeAddressListMediatype,
164 &HomeAddressListPref,
167 frameCEAddress->SetEditorMode(TRUE, CE_HOME);
168 frameCEAddress->ShowModal();
169 delete frameCEAddress;
170 frameCEAddress = NULL;
173 void frmContactEditor::DeleteHomeAddress( wxCommandEvent& event )
176 long longSelected = -1;
177 int intSelectedData = 0;
179 if (!GetSelectedItem(lboHomeAddresses,
185 lboHomeAddresses->DeleteItem(longSelected);
187 DeleteMapData(intSelectedData, &HomeAddressList,
188 &HomeAddressListTown, &HomeAddressListCounty,
189 &HomeAddressListPostCode, &HomeAddressListCountry,
190 &HomeAddressList, &HomeAddressListLabel,
191 &HomeAddressListLang, &HomeAddressListAltID,
192 &HomeAddressListPID, &HomeAddressListTokens,
193 &HomeAddressListGeo, &HomeAddressListTimezone,
194 &HomeAddressListType, &HomeAddressListMediatype,
195 &HomeAddressListPref);
199 void frmContactEditor::AddHomeEmail( wxCommandEvent& event )
203 frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
204 frameCEEmail->SetEditorMode(FALSE, CE_HOME);
205 intResult = GetLastInt(&HomeAddressList);
206 frameCEEmail->SetupPointers(&HomeEmailList,
210 &HomeEmailListTokens,
214 frameCEEmail->ShowModal();
219 void frmContactEditor::ModifyHomeEmail( wxCommandEvent& event )
221 long longSelected = -1;
222 int intSelectedData = 0;
224 if (!GetSelectedItem(lboHomeEmails,
230 frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
231 frameCEEmail->SetupPointers(&HomeEmailList,
235 &HomeEmailListTokens,
239 frameCEEmail->SetEditorMode(TRUE, CE_HOME);
240 frameCEEmail->ShowModal();
246 void frmContactEditor::DeleteHomeEmail( wxCommandEvent& event )
248 long longSelected = -1;
249 int intSelectedData = 0;
251 if (!GetSelectedItem(lboHomeEmails,
257 lboHomeEmails->DeleteItem(longSelected);
259 DeleteMapData(intSelectedData, &HomeEmailList,
260 &HomeEmailListAltID, &HomeEmailListPID,
261 &HomeEmailListType, &HomeEmailListTokens,
266 void frmContactEditor::AddHomeIM( wxCommandEvent& event )
270 frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
271 frameCEIM->SetEditorMode(FALSE, CE_HOME);
272 intResult = GetLastInt(&HomeIMList);
273 frameCEIM->SetupPointers(&HomeIMList,
278 &HomeIMListMediatype,
282 frameCEIM->ShowModal();
287 void frmContactEditor::ModifyHomeIM( wxCommandEvent& event )
289 long longSelected = -1;
290 int intSelectedData = 0;
292 if (!GetSelectedItem(lboHomeIM,
298 frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
299 frameCEIM->SetupPointers(&HomeIMList,
304 &HomeIMListMediatype,
308 frameCEIM->SetEditorMode(TRUE, CE_HOME);
309 frameCEIM->ShowModal();
314 void frmContactEditor::DeleteHomeIM( wxCommandEvent& event )
316 long longSelected = -1;
317 int intSelectedData = 0;
319 if (!GetSelectedItem(lboHomeIM,
325 lboHomeIM->DeleteItem(longSelected);
327 DeleteMapData(intSelectedData, &HomeIMList,
328 &HomeIMListAltID, &HomeIMListPID,
329 &HomeIMListType, &HomeIMListTokens,
330 &HomeIMListMediatype, &HomeIMListPref);
334 void frmContactEditor::AddHomeTelephone( wxCommandEvent& event )
338 frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
339 frameCETel->SetEditorMode(FALSE, CE_HOME);
340 intResult = GetLastInt(&HomeTelephoneList);
341 frameCETel->SetupPointers(&HomeTelephoneList,
342 &HomeTelephoneListAltID,
343 &HomeTelephoneListPID,
344 &HomeTelephoneListType,
345 &HomeTelephoneListTokens,
346 &HomeTelephoneListPref,
349 frameCETel->ShowModal();
354 void frmContactEditor::ModifyHomeTelephone( wxCommandEvent& event )
356 long longSelected = -1;
357 int intSelectedData = 0;
359 if (!GetSelectedItem(lboHomeTelephone,
365 frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
366 frameCETel->SetupPointers(&HomeTelephoneList,
367 &HomeTelephoneListAltID,
368 &HomeTelephoneListPID,
369 &HomeTelephoneListType,
370 &HomeTelephoneListTokens,
371 &HomeTelephoneListPref,
374 frameCETel->SetEditorMode(TRUE, CE_HOME);
375 frameCETel->ShowModal();
380 void frmContactEditor::DeleteHomeTelephone( wxCommandEvent& event )
382 long longSelected = -1;
383 int intSelectedData = 0;
385 if (!GetSelectedItem(lboHomeTelephone,
391 lboHomeTelephone->DeleteItem(longSelected);
393 DeleteMapData(intSelectedData, &HomeTelephoneList,
394 &HomeTelephoneListAltID, &HomeTelephoneListPID,
395 &HomeTelephoneListType, &HomeTelephoneListTokens,
396 &HomeTelephoneListPref);
400 void frmContactEditor::AddHomeLanguage( wxCommandEvent& event )
404 frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
405 frameCELang->SetEditorMode(FALSE, CE_HOME);
406 intResult = GetLastInt(&HomeLanguageList);
407 frameCELang->SetupPointers(&HomeLanguageList,
408 &HomeLanguageListAltID,
409 &HomeLanguageListPID,
410 &HomeLanguageListType,
411 &HomeLanguageListTokens,
412 &HomeLanguageListPref,
415 frameCELang->ShowModal();
420 void frmContactEditor::ModifyHomeLanguage( wxCommandEvent& event )
422 long longSelected = -1;
423 int intSelectedData = 0;
425 if (!GetSelectedItem(lboHomeLanguages,
431 frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
432 frameCELang->SetupPointers(&HomeLanguageList,
433 &HomeLanguageListAltID,
434 &HomeLanguageListPID,
435 &HomeLanguageListType,
436 &HomeLanguageListTokens,
437 &HomeLanguageListPref,
440 frameCELang->SetEditorMode(TRUE, CE_HOME);
441 frameCELang->ShowModal();
446 void frmContactEditor::DeleteHomeLanguage( wxCommandEvent& event )
448 long longSelected = -1;
449 int intSelectedData = 0;
451 if (!GetSelectedItem(lboHomeLanguages,
457 lboHomeLanguages->DeleteItem(longSelected);
459 DeleteMapData(intSelectedData, &HomeLanguageList,
460 &HomeLanguageListAltID, &HomeLanguageListPID,
461 &HomeLanguageListType, &HomeLanguageListTokens,
462 &HomeLanguageListPref);
466 void frmContactEditor::AddHomeTimezone( wxCommandEvent& event )
470 frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
471 frameCETZ->SetEditorMode(FALSE, CE_HOME);
472 intResult = GetLastInt(&HomeTZList);
473 frameCETZ->SetupPointers(&HomeTZList,
478 &HomeTZListMediatype,
482 frameCETZ->ShowModal();
487 void frmContactEditor::ModifyHomeTimezone( wxCommandEvent& event )
489 long longSelected = -1;
490 int intSelectedData = 0;
492 if (!GetSelectedItem(lboHomeTimezones,
498 frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
499 frameCETZ->SetupPointers(&HomeTZList,
504 &HomeTZListMediatype,
508 frameCETZ->SetEditorMode(TRUE, CE_HOME);
509 frameCETZ->ShowModal();
514 void frmContactEditor::DeleteHomeTimezone( wxCommandEvent& event )
516 long longSelected = -1;
517 int intSelectedData = 0;
519 if (!GetSelectedItem(lboHomeTimezones,
525 lboHomeTimezones->DeleteItem(longSelected);
527 DeleteMapData(intSelectedData, &HomeTZList,
528 &HomeTZListAltID, &HomeTZListPID,
529 &HomeTZListType, &HomeTZListTokens,
530 &HomeTZListMediatype, &HomeTZListPref);
534 void frmContactEditor::AddHomeGeoposition( wxCommandEvent& event )
538 frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
539 frameCEGeo->SetEditorMode(FALSE, CE_HOME);
540 intResult = GetLastInt(&HomeGeographyList);
541 frameCEGeo->SetupPointers(&HomeGeographyList,
542 &HomeGeographyListAltID,
543 &HomeGeographyListPID,
544 &HomeGeographyListType,
545 &HomeGeographyListTokens,
546 &HomeGeographyListMediatype,
547 &HomeGeographyListPref,
550 frameCEGeo->ShowModal();
555 void frmContactEditor::ModifyHomeGeoposition( wxCommandEvent& event )
557 long longSelected = -1;
558 int intSelectedData = 0;
560 if (!GetSelectedItem(lboHomeGeoposition,
566 frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
567 frameCEGeo->SetupPointers(&HomeGeographyList,
568 &HomeGeographyListAltID,
569 &HomeGeographyListPID,
570 &HomeGeographyListType,
571 &HomeGeographyListTokens,
572 &HomeGeographyListMediatype,
573 &HomeGeographyListPref,
576 frameCEGeo->SetEditorMode(TRUE, CE_HOME);
577 frameCEGeo->ShowModal();
582 void frmContactEditor::DeleteHomeGeoposition( wxCommandEvent& event )
584 long longSelected = -1;
585 int intSelectedData = 0;
587 if (!GetSelectedItem(lboHomeGeoposition,
593 lboHomeGeoposition->DeleteItem(longSelected);
595 DeleteMapData(intSelectedData, &HomeGeographyList,
596 &HomeGeographyListAltID, &HomeGeographyListPID,
597 &HomeGeographyListType, &HomeGeographyListTokens,
598 &HomeGeographyListMediatype, &HomeGeographyListPref);
602 void frmContactEditor::AddHomeWebsite( wxCommandEvent& event )
606 frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
607 frameCEWeb->SetEditorMode(FALSE, CE_HOME);
608 intResult = GetLastInt(&HomeWebsiteList);
609 frameCEWeb->SetupPointers(&HomeWebsiteList,
610 &HomeWebsiteListAltID,
612 &HomeWebsiteListType,
613 &HomeWebsiteListTokens,
614 &HomeWebsiteListMediatype,
615 &HomeWebsiteListPref,
618 frameCEWeb->ShowModal();
623 void frmContactEditor::ModifyHomeWebsite( wxCommandEvent& event )
625 long longSelected = -1;
626 int intSelectedData = 0;
628 if (!GetSelectedItem(lboHomeWebsites,
634 frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
635 frameCEWeb->SetupPointers(&HomeWebsiteList,
636 &HomeWebsiteListAltID,
638 &HomeWebsiteListType,
639 &HomeWebsiteListTokens,
640 &HomeWebsiteListMediatype,
641 &HomeWebsiteListPref,
644 frameCEWeb->SetEditorMode(TRUE, CE_HOME);
645 frameCEWeb->ShowModal();
650 void frmContactEditor::DeleteHomeWebsite( wxCommandEvent& event )
652 long longSelected = -1;
653 int intSelectedData = 0;
655 if (!GetSelectedItem(lboHomeWebsites,
661 lboHomeWebsites->DeleteItem(longSelected);
663 DeleteMapData(intSelectedData, &HomeWebsiteList,
664 &HomeWebsiteListAltID, &HomeWebsiteListPID,
665 &HomeWebsiteListType, &HomeWebsiteListTokens,
666 &HomeWebsiteListMediatype, &HomeWebsiteListPref);
670 void frmContactEditor::AddHomeTitle( wxCommandEvent& event )
674 frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
675 frameCETitle->SetEditorMode(FALSE, CE_HOME);
676 intResult = GetLastInt(&HomeTitleList);
677 frameCETitle->SetupPointers(&HomeTitleList,
678 &HomeTitleListLanguage,
682 &HomeTitleListTokens,
686 frameCETitle->ShowModal();
691 void frmContactEditor::ModifyHomeTitle( wxCommandEvent& event )
693 long longSelected = -1;
694 int intSelectedData = 0;
696 if (!GetSelectedItem(lboHomeTitles,
702 frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
703 frameCETitle->SetupPointers(&HomeTitleList,
704 &HomeTitleListLanguage,
708 &HomeTitleListTokens,
712 frameCETitle->SetEditorMode(TRUE, CE_HOME);
713 frameCETitle->ShowModal();
718 void frmContactEditor::DeleteHomeTitle( wxCommandEvent& event )
720 long longSelected = -1;
721 int intSelectedData = 0;
723 if (!GetSelectedItem(lboHomeTitles,
729 lboHomeTitles->DeleteItem(longSelected);
731 DeleteMapData(intSelectedData, &HomeTitleList,
732 &HomeTitleListLanguage, &HomeTitleListAltID,
733 &HomeTitleListPID, &HomeTitleListType,
734 &HomeTitleListTokens, &HomeTitleListPref);
738 void frmContactEditor::AddHomeRole( wxCommandEvent& event )
742 frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
743 frameCERole->SetEditorMode(FALSE, CE_HOME);
744 intResult = GetLastInt(&HomeRoleList);
745 frameCERole->SetupPointers(&HomeRoleList,
746 &HomeRoleListLanguage,
754 frameCERole->ShowModal();
759 void frmContactEditor::ModifyHomeRole( wxCommandEvent& event )
761 long longSelected = -1;
762 int intSelectedData = 0;
764 if (!GetSelectedItem(lboHomeRoles,
770 frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
771 frameCERole->SetupPointers(&HomeRoleList,
772 &HomeRoleListLanguage,
780 frameCERole->SetEditorMode(TRUE, CE_HOME);
781 frameCERole->ShowModal();
786 void frmContactEditor::DeleteHomeRole( wxCommandEvent& event )
788 long longSelected = -1;
789 int intSelectedData = 0;
791 if (!GetSelectedItem(lboHomeRoles,
797 lboHomeRoles->DeleteItem(longSelected);
799 DeleteMapData(intSelectedData, &HomeRoleList,
800 &HomeRoleListLanguage, &HomeRoleListAltID,
801 &HomeRoleListPID, &HomeRoleListType,
802 &HomeRoleListTokens, &HomeRoleListPref);
806 void frmContactEditor::AddHomeOrganisation( wxCommandEvent& event )
810 frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
811 frameCEOrg->SetEditorMode(FALSE, CE_HOME);
812 intResult = GetLastInt(&HomeOrganisationsList);
813 frameCEOrg->SetupPointers(&HomeOrganisationsList,
814 &HomeOrganisationsListLanguage,
815 &HomeOrganisationsListSortAs,
816 &HomeOrganisationsListAltID,
817 &HomeOrganisationsListPID,
818 &HomeOrganisationsListType,
819 &HomeOrganisationsListTokens,
820 &HomeOrganisationsListPref,
821 lboHomeOrganisations,
823 frameCEOrg->ShowModal();
828 void frmContactEditor::ModifyHomeOrganisation( wxCommandEvent& event )
830 long longSelected = -1;
831 int intSelectedData = 0;
833 if (!GetSelectedItem(lboHomeOrganisations,
839 frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
840 frameCEOrg->SetupPointers(&HomeOrganisationsList,
841 &HomeOrganisationsListLanguage,
842 &HomeOrganisationsListSortAs,
843 &HomeOrganisationsListAltID,
844 &HomeOrganisationsListPID,
845 &HomeOrganisationsListType,
846 &HomeOrganisationsListTokens,
847 &HomeOrganisationsListPref,
848 lboHomeOrganisations,
850 frameCEOrg->SetEditorMode(TRUE, CE_HOME);
851 frameCEOrg->ShowModal();
856 void frmContactEditor::DeleteHomeOrganisation( wxCommandEvent& event )
858 long longSelected = -1;
859 int intSelectedData = 0;
861 if (!GetSelectedItem(lboHomeOrganisations,
867 lboHomeOrganisations->DeleteItem(longSelected);
869 DeleteMapData(intSelectedData, &HomeOrganisationsList,
870 &HomeOrganisationsListLanguage, &HomeOrganisationsListSortAs,
871 &HomeOrganisationsListAltID, &HomeOrganisationsListPID,
872 &HomeOrganisationsListType, &HomeOrganisationsListTokens,
873 &HomeOrganisationsListPref);
877 void frmContactEditor::AddHomeNote( wxCommandEvent& event )
881 frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
882 frameCENote->SetEditorMode(FALSE, CE_HOME);
883 intResult = GetLastInt(&HomeNoteList);
884 frameCENote->SetupPointers(&HomeNoteList,
885 &HomeNoteListLanguage,
893 frameCENote->ShowModal();
898 void frmContactEditor::ModifyHomeNote( wxCommandEvent& event )
900 long longSelected = -1;
901 int intSelectedData = 0;
903 if (!GetSelectedItem(lboHomeNotes,
909 frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
910 frameCENote->SetupPointers(&HomeNoteList,
911 &HomeNoteListLanguage,
919 frameCENote->SetEditorMode(TRUE, CE_HOME);
920 frameCENote->ShowModal();
925 void frmContactEditor::DeleteHomeNote( wxCommandEvent& event )
927 long longSelected = -1;
928 int intSelectedData = 0;
930 if (!GetSelectedItem(lboHomeNotes,
936 lboNotes->DeleteItem(longSelected);
938 DeleteMapData(intSelectedData, &HomeNoteList,
939 &HomeNoteListLanguage, &HomeNoteListAltID,
940 &HomeNoteListPID, &HomeNoteListType,
941 &HomeNoteListTokens, &HomeNoteListPref);