Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditor: Check save was successful before closing
[xestiaab/.git] / source / contacteditor / frmContactEditor.h
1 // frmContactEditor.h - frmContactEditor form header.
2 //
3 // (c) 2012-2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
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.
10 //
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.
15 //
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 #ifndef __frmContactEditor__
20 #define __frmContactEditor__
22 #include <wx/wx.h>
24 #include <map>
25 #include <string>
27 #include <SFML/Audio.hpp>
29 /**
30 @file
31 Subclass of frmContactEditorADT, which is generated by wxFormBuilder.
32 */
34 #include "../AppXestiaAddrBk.h"
35 #include "../vcard/vcard.h"
36 #include "../common/textprocessing.h"
37 #include "../common/etag.h"
38 #include "../common/timers.h"
40 #include "../actmgr/frmActivityMgr.h"
41 #include "../frmMain.h"
42 #include "frmContactEditorSound.h"
44 #include "cdo/ContactDataObject.h"
46 #define CE_NICKNAME wxT("Nickname")
47 #define CE_ADDRESS wxT("Address")
48 #define CE_EMAIL wxT("Email")
49 #define CE_IM wxT("IM")
50 #define CE_TELEPHONE wxT("Telephone")
51 #define CE_LANG wxT("Languages")
52 #define CE_TZ wxT("Timezone")
53 #define CE_RELATED wxT("Related")
54 #define CE_WEBSITE wxT("Websites")
55 #define CE_TITLE wxT("Titles")
56 #define CE_GEOPOSITION wxT("Geoposition")
57 #define CE_ROLE wxT("Roles")
58 #define CE_ORG wxT("Organisations")
59 #define CE_NOTE wxT("Notes")
60 #define CE_CATEGORIES wxT("Categories")
61 #define CE_GROUPS wxT("Groups")
62 #define CE_PICTURES wxT("Pictures")
63 #define CE_SOUNDS wxT("Sounds")
64 #define CE_CALENDAR wxT("Calendar")
65 #define CE_KEY wxT("Key")
66 #define CE_TOKEN wxT("Token")
68 //// end generated include
70 struct frmMain;
71 struct frmActivityMgr;
73 // Special Audio Stream for detecting when a sound has stopped playing.
74 class AudioStream: public sf::Music
75 {
76 private:
78    bool onGetData(SoundStream::Chunk& data)
79    {
80        FilePlaying = TRUE;
81        bool running = sf::Music::onGetData(data);
82        if(!running)
83            OnMusicEnd();
84        return running;
85    }
86 public:
87    void OnMusicEnd() { }
88    bool GetPlayingStatus(){ return FilePlaying; }   
90     bool FilePlaying = TRUE;
91 };
93 /** Implementing frmContactEditorADT */
94 class frmContactEditor : public frmContactEditorADT
95 {
96         protected:
97                 // Handlers for frmContactEditorADT events.
98                 void AddGeneralNickname( wxCommandEvent& event );
99                 void ModifyGeneralNickname( wxCommandEvent& event );
100                 void DeleteGeneralNickname( wxCommandEvent& event );
101                 void AddHomeNickname( wxCommandEvent& event );
102                 void ModifyHomeNickname( wxCommandEvent& event );
103                 void DeleteHomeNickname( wxCommandEvent& event );
104                 void AddBusinessNickname( wxCommandEvent& event );
105                 void ModifyBusinessNickname( wxCommandEvent& event );
106                 void DeleteBusinessNickname( wxCommandEvent& event );
107                 void AddGeneralAddress( wxCommandEvent& event );
108                 void ModifyGeneralAddress( wxCommandEvent& event );
109                 void DeleteGeneralAddress( wxCommandEvent& event );
110                 void AddGeneralEmail( wxCommandEvent& event );
111                 void ModifyGeneralEmail( wxCommandEvent& event );
112                 void DeleteGeneralEmail( wxCommandEvent& event );
113                 void AddGeneralIM( wxCommandEvent& event );
114                 void ModifyGeneralIM( wxCommandEvent& event );
115                 void DeleteGeneralIM( wxCommandEvent& event );
116                 void MoveGeneralIMUp( wxCommandEvent& event );
117                 void MoveGeneralIMDown( wxCommandEvent& event );
118                 void AddGeneralTelephone( wxCommandEvent& event );
119                 void ModifyGeneralTelephone( wxCommandEvent& event );
120                 void DeleteGeneralTelephone( wxCommandEvent& event );
121                 void AddGeneralLanguages( wxCommandEvent& event );
122                 void ModifyGeneralLanguages( wxCommandEvent& event );
123                 void DeleteGeneralLanguage( wxCommandEvent& event );
124                 void AddGeneralTimezone( wxCommandEvent& event );
125                 void ModifyGeneralTimezone( wxCommandEvent& event );
126                 void DeleteGeneralTimezone( wxCommandEvent& event );
127                 void AddGeneralGeoposition( wxCommandEvent& event );
128                 void ModifyGeneralGeoposition( wxCommandEvent& event );
129                 void DeleteGeneralGeoposition( wxCommandEvent& event ); 
130                 void AddGeneralRelated( wxCommandEvent& event );
131                 void ModifyGeneralRelated( wxCommandEvent& event );
132                 void DeleteGeneralRelated( wxCommandEvent& event );
133                 void AddGeneralWebsite( wxCommandEvent& event );
134                 void ModifyGeneralWebsite( wxCommandEvent& event );
135                 void DeleteGeneralWebsite( wxCommandEvent& event );
136                 void MoveGeneralWebsiteUp( wxCommandEvent& event );
137                 void MoveGeneralWebsiteDown( wxCommandEvent& event );
138                 void AddGeneralTitle( wxCommandEvent& event );
139                 void ModifyGeneralTitle( wxCommandEvent& event );
140                 void DeleteGeneralTitle( wxCommandEvent& event );
141                 void MoveGeneralTitleUp( wxCommandEvent& event );
142                 void MoveGeneralTitleDown( wxCommandEvent& event );
143                 void AddGeneralRole( wxCommandEvent& event );
144                 void ModifyGeneralRole( wxCommandEvent& event );
145                 void DeleteGeneralRole( wxCommandEvent& event );
146                 void MoveGeneralRoleUp( wxCommandEvent& event );
147                 void MoveGeneralRoleDown( wxCommandEvent& event );
148                 void AddGeneralOrganisation( wxCommandEvent& event );
149                 void ModifyGeneralOrganisation( wxCommandEvent& event );
150                 void DeleteGeneralOrganisation( wxCommandEvent& event );
151                 void MoveGeneralOrganisationUp( wxCommandEvent& event );
152                 void MoveGeneralOrganisationDown( wxCommandEvent& event );
153                 void AddGeneralNote( wxCommandEvent& event );
154                 void ModifyGeneralNote( wxCommandEvent& event );
155                 void DeleteGeneralNote( wxCommandEvent& event );
156                 void MoveGeneralNoteUp( wxCommandEvent& event );
157                 void MoveGeneralNoteDown( wxCommandEvent& event );
158                 void AddHomeAddress( wxCommandEvent& event );
159                 void ModifyHomeAddress( wxCommandEvent& event );
160                 void DeleteHomeAddress( wxCommandEvent& event );
161                 void AddHomeEmail( wxCommandEvent& event );
162                 void ModifyHomeEmail( wxCommandEvent& event );
163                 void DeleteHomeEmail( wxCommandEvent& event );          
164                 void AddHomeIM( wxCommandEvent& event );
165                 void ModifyHomeIM( wxCommandEvent& event );
166                 void DeleteHomeIM( wxCommandEvent& event );
167                 void AddHomeTelephone( wxCommandEvent& event );
168                 void ModifyHomeTelephone( wxCommandEvent& event );
169                 void DeleteHomeTelephone( wxCommandEvent& event );
170                 void AddHomeLanguage( wxCommandEvent& event );
171                 void ModifyHomeLanguage( wxCommandEvent& event );
172                 void DeleteHomeLanguage( wxCommandEvent& event );
173                 void AddHomeTimezone( wxCommandEvent& event );
174                 void ModifyHomeTimezone( wxCommandEvent& event );
175                 void DeleteHomeTimezone( wxCommandEvent& event );
176                 void AddHomeGeoposition( wxCommandEvent& event );
177                 void ModifyHomeGeoposition( wxCommandEvent& event );
178                 void DeleteHomeGeoposition( wxCommandEvent& event );
179                 void AddHomeRelated( wxCommandEvent& event );
180                 void ModifyHomeRelated( wxCommandEvent& event );
181                 void DeleteHomeRelated( wxCommandEvent& event );
182                 void AddHomeWebsite( wxCommandEvent& event );
183                 void ModifyHomeWebsite( wxCommandEvent& event );
184                 void DeleteHomeWebsite( wxCommandEvent& event );
185                 void AddHomeTitle( wxCommandEvent& event );
186                 void ModifyHomeTitle( wxCommandEvent& event );
187                 void DeleteHomeTitle( wxCommandEvent& event );
188                 void AddHomeRole( wxCommandEvent& event );
189                 void ModifyHomeRole( wxCommandEvent& event );
190                 void DeleteHomeRole( wxCommandEvent& event );
191                 void MoveHomeRoleUp( wxCommandEvent& event );
192                 void MoveHomeRoleDown( wxCommandEvent& event );
193                 void AddHomeOrganisation( wxCommandEvent& event );
194                 void ModifyHomeOrganisation( wxCommandEvent& event );
195                 void DeleteHomeOrganisation( wxCommandEvent& event );
196                 void MoveHomeOrganisationUp( wxCommandEvent& event );
197                 void MoveHomeOrganisationDown( wxCommandEvent& event );
198                 void AddHomeNote( wxCommandEvent& event );
199                 void ModifyHomeNote( wxCommandEvent& event );
200                 void DeleteHomeNote( wxCommandEvent& event );
201                 void MoveHomeNoteUp( wxCommandEvent& event );
202                 void MoveHomeNoteDown( wxCommandEvent& event );
203                 void AddBusinessAddress( wxCommandEvent& event );
204                 void ModifyBusinessAddress( wxCommandEvent& event );
205                 void DeleteBusinessAddress( wxCommandEvent& event );
206                 void AddBusinessEmail( wxCommandEvent& event );
207                 void ModifyBusinessEmail( wxCommandEvent& event );
208                 void DeleteBusinessEmail( wxCommandEvent& event );
209                 void AddBusinessIM( wxCommandEvent& event );
210                 void ModifyBusinessIM( wxCommandEvent& event );
211                 void DeleteBusinessIM( wxCommandEvent& event );
212                 void AddBusinessTelephone( wxCommandEvent& event );
213                 void ModifyBusinessTelephone( wxCommandEvent& event );
214                 void DeleteBusinessTelephone( wxCommandEvent& event );
215                 void AddBusinessLanguage( wxCommandEvent& event );
216                 void ModifyBusinessLanguage( wxCommandEvent& event );
217                 void DeleteBusinessLanguage( wxCommandEvent& event );
218                 void AddBusinessTimezone( wxCommandEvent& event );
219                 void ModifyBusinessTimezone( wxCommandEvent& event );
220                 void DeleteBusinessTimezone( wxCommandEvent& event );
221                 void AddBusinessGeoposition( wxCommandEvent& event );
222                 void ModifyBusinessGeoposition( wxCommandEvent& event );
223                 void DeleteBusinessGeoposition( wxCommandEvent& event );
224                 void AddBusinessRelated( wxCommandEvent& event );
225                 void ModifyBusinessRelated( wxCommandEvent& event );
226                 void DeleteBusinessRelated( wxCommandEvent& event );
227                 void AddBusinessWebsite( wxCommandEvent& event );
228                 void ModifyBusinessWebsite( wxCommandEvent& event );
229                 void DeleteBusinessWebsite( wxCommandEvent& event );
230                 void AddBusinessTitle( wxCommandEvent& event );
231                 void ModifyBusinessTitle( wxCommandEvent& event );
232                 void DeleteBusinessTitle( wxCommandEvent& event );
233                 void MoveBusinessTitleUp( wxCommandEvent& event );
234                 void MoveBusinessTitleDown( wxCommandEvent& event );
235                 void AddBusinessRole( wxCommandEvent& event );
236                 void ModifyBusinessRole( wxCommandEvent& event );
237                 void DeleteBusinessRole( wxCommandEvent& event );
238                 void MoveBusinessRoleUp( wxCommandEvent& event );
239                 void MoveBusinessRoleDown( wxCommandEvent& event );
240                 void AddBusinessOrganisation( wxCommandEvent& event );
241                 void ModifyBusinessOrganisation( wxCommandEvent& event );
242                 void DeleteBusinessOrganisation( wxCommandEvent& event );
243                 void MoveBusinessOrganisationUp( wxCommandEvent& event );
244                 void MoveBusinessOrganisationDown( wxCommandEvent& event );
245                 void AddBusinessNote( wxCommandEvent& event );
246                 void ModifyBusinessNote( wxCommandEvent& event );
247                 void DeleteBusinessNote( wxCommandEvent& event );
248                 void MoveBusinessNoteUp( wxCommandEvent& event );
249                 void MoveBusinessNoteDown( wxCommandEvent& event );
250                 void AddCategory( wxCommandEvent& event );
251                 void ModifyCategory( wxCommandEvent& event );
252                 void DeleteCategory( wxCommandEvent& event );
253                 void AddGroup( wxCommandEvent& event );
254                 void ModifyGroup( wxCommandEvent& event );
255                 void DeleteGroup( wxCommandEvent& event );
256                 void AddPicture( wxCommandEvent& event );
257                 void ModifyPicture( wxCommandEvent& event );
258                 void DeletePicture( wxCommandEvent& event );
259                 void LoadPicture( wxListEvent& event );
260                 void SavePicture( wxCommandEvent& event);
261                 void AddLogo( wxCommandEvent& event );
262                 void ModifyLogo( wxCommandEvent& event );
263                 void DeleteLogo( wxCommandEvent& event );               
264                 void LoadLogo( wxListEvent& event );
265                 void SaveLogo( wxCommandEvent& event);  
266                 void AddSound( wxCommandEvent& event );
267                 void ModifySound( wxCommandEvent& event );
268                 void DeleteSound( wxCommandEvent& event );
269                 void SaveSound( wxCommandEvent& event); 
270                 void PlaySoundDetach();
271                 void PlaySound( wxCommandEvent& event );
272                 void StopSound( wxCommandEvent& event );
273                 void AddCalendarAddress( wxCommandEvent& event );
274                 void ModifyCalendarAddress( wxCommandEvent& event );
275                 void DeleteCalendarAddress( wxCommandEvent& event );
276                 void AddCalendarRequest( wxCommandEvent& event );
277                 void ModifyCalendarRequest( wxCommandEvent& event );
278                 void DeleteCalendarRequest( wxCommandEvent& event );
279                 void AddFreeBusy( wxCommandEvent& event );
280                 void ModifyFreeBusy( wxCommandEvent& event );
281                 void DeleteFreeBusy( wxCommandEvent& event );
282                 void AddKey( wxCommandEvent& event );
283                 void ModifyKey( wxCommandEvent& event );
284                 void DeleteKey( wxCommandEvent& event );
285                 void AddVendorNamespace( wxCommandEvent& event );
286                 void ModifyVendorNamespace( wxCommandEvent& event );
287                 void DeleteVendorNamespace( wxCommandEvent& event );
288                 void MoveVendorNamespaceUp( wxCommandEvent& event );
289                 void MoveVendorNamespaceDown( wxCommandEvent& event );
290                 void AddXToken( wxCommandEvent& event );
291                 void ModifyXToken( wxCommandEvent& event );
292                 void DeleteXToken( wxCommandEvent& event );
293                 void MoveXTokenUp( wxCommandEvent& event );
294                 void MoveXTokenDown( wxCommandEvent& event );
295                 void SaveContact( wxCommandEvent& event );
296                 void SaveCloseContact( wxCommandEvent& event );
297                 void CloseContact( wxCommandEvent& event );
298                 void CloseWindow( wxCloseEvent& event );
299                 void CutText( wxCommandEvent& event );
300                 void CopyText( wxCommandEvent& event );
301                 void PasteText( wxCommandEvent& event );
302                 void SetupColumn(wxString ColumnType, wxListCtrl *ListCtrl);
303                 void UpdateMembersTab( wxCommandEvent &event );
304                 void UpdateDisplayAs( wxCommandEvent &event );
305                 void UpdateName( wxCommandEvent &event );
306                 bool GetSelectedItem(wxListCtrl *ListCtrlPtr, 
307                         long *longSelected,
308                         int *intSelectedData);
309                 int GetLastInt(std::map<int, wxString> *MapData);
310                 int GetLastInt(std::map<int, std::string> *MapData);
311                 bool ProcessEvent(wxEvent& event);
312         public:
313                 /** Constructor */
314                 frmContactEditor( wxWindow* parent );
315                 ~frmContactEditor();
316                 void SetupHeaders();
317                 void SetupContact(wxString AccountName);
318                 void SetupAccountData(bool UnsupportedAccount);
319                 void SetupPointers(frmActivityMgr *ActMgr, wxETagProcessTimer *ETagProc,
320                                         frmMain *MainPtrInc);
321                 bool LoadContact(wxString Filename);
322                 void SetMode(bool StartupEditMode);
323                 void SetUID(int UID);
324         private:
325         
326                 void DeleteMapDataProcess(int IndexNum, std::map<int, std::string>* MapData);
327                 void DeleteMapDataProcess(int IndexNum, std::map<int, wxString>* MapData);
328                 void DeleteMapDataProcess(int IndexNum, std::map<int, bool>* MapData);
329                 void DeleteMapDataProcess(int IndexNum, std::map<int, int>* MapData);
331                 void DeleteMapDataB () {} ;
332         
333                 template<typename MapData, typename... Args>
334                 void DeleteMapDataB(MapData* mapdata, Args*... args) {
336                         DeleteMapDataProcess(intSeekSelectedData, mapdata);
337                         DeleteMapDataB(args...);
339                 }
341                 template<typename... Args>
342                 void DeleteMapData(int IndexNum, Args*... args) {
344                         //int intSeekSelectedData = 0;
346                         //DeleteMapDataProcess(IndexNum, Moo);
348                         intSeekSelectedData = IndexNum;
349                         DeleteMapDataB(args...);
350         
351                 }
353                 void ProcessSaveDataProc(wxString PropName,
354                                 std::map<int,int>* MapData);
355                 void ProcessSaveDataProc(wxString PropName,
356                                 std::map<int,wxString>* MapData);
357                 void ProcessSaveDataStrProc(wxString PropName,
358                                 std::map<int,int>* MapData);
359                 void ProcessSaveDataStrProc(wxString PropName,
360                                 std::map<int,wxString>* MapData);
361                 void ProcessSaveDataStrProc(wxString PropName,
362                                 std::map<int,std::string>* MapData);
364                 
365                 void ProcessSaveDataB () {  } ;
366                 void ProcessSaveDataC () {  } ;
367                 
368                 template<typename PropName, typename MapData, typename... Args>
369                 void ProcessSaveDataB(PropName propname, MapData* mapdata, Args*... args) {
371                         ProcessSaveDataProc(propname, mapdata);
372                         ProcessSaveDataB(args...);
373                         
374                 }
375                 
376                 template<typename PropName, typename MapData, typename... Args>
377                 void ProcessSaveDataC(PropName propname, MapData* mapdata, Args*... args) {
379                         ProcessSaveDataStrProc(propname, mapdata);
380                         ProcessSaveDataC(args...);
381                         
382                 }
384                 template<typename... Args>
385                 void ProcessSaveData(wxString strPropertyName,
386                         wxString *strPropertyInc, 
387                         bool *boolAdditionalInc, bool *boolExtraInc, 
388                         std::map<int,wxString>::iterator *iterDataInc,
389                         std::map<int,wxString> *MainMapData,
390                         std::map<int,wxString>::iterator *iterFileTypeInc,
391                         std::map<int,wxString>::iterator *iterFileEncInc,                       
392                         vCard *vCardData,
393                         Args*... args) {
395                         //int intSeekSelectedData = 0;
397                         //DeleteMapDataProcess(IndexNum, Moo);
398                         
399                         strPropertyPtr = strPropertyInc;
400                         boolAdditionalPtr = boolAdditionalInc;
401                         boolExtraPtr = boolExtraInc;
402                         iterDataPtr = iterDataInc;
403                         iterFileTypePtr = iterFileTypeInc;
404                         iterFileEncPtr = iterFileEncInc;
405                         ProcessSaveDataB(args...);
406                         
407                         std::map<int,wxString>::iterator strIter;
408                         std::map<int,wxString>::iterator strDataTypeIter;
409                         wxString strMainValue;
410                         
411                         int intSeekData = (*iterDataStringPtr)->first;
412                         strIter = MainMapData->find(intSeekData);
413                         
414                         wxString strFileType = (*iterFileTypePtr)->second;
415                         wxString strFileEnc = (*iterFileEncPtr)->second;
416                         
417                         EscapeString(&strFileType, FALSE);
418                         EscapeString(&strFileEnc, FALSE);
420                         if (strIter->first == intSeekData){
421         
422                                 strMainValue = strIter->second;
423                                 strMainValue.insert(0, wxT("data:") + strFileType + wxT(";") + strFileEnc + wxT(","));
424         
425                         }
426                         
427                         if (*boolExtraPtr == TRUE){
429                                 vCardData->AddRaw(strPropertyName + wxT(";") + *strPropertyPtr, strMainValue);
431                         } else {
433                                 vCardData->AddRaw(strPropertyName, strMainValue);
435                         }
436                         
437                         boolExtraPtr = FALSE;
438                         iterDataPtr = 0;
439         
440                 }
442                 template<typename... Args>
443                 void ProcessSaveData(wxString strPropertyName,
444                         wxString *strPropertyInc, 
445                         bool *boolAdditionalInc, bool *boolExtraInc, 
446                         std::map<int,std::string>::iterator *iterDataInc,
447                         std::map<int,std::string> *MainMapData,
448                         std::map<int,wxString>::iterator *iterFileTypeInc,
449                         std::map<int,wxString>::iterator *iterFileEncInc,                       
450                         vCard *vCardData,
451                         Args*... args) {
453                         //int intSeekSelectedData = 0;
455                         //DeleteMapDataProcess(IndexNum, Moo);
456                         
457                         strPropertyPtr = strPropertyInc;
458                         boolAdditionalPtr = boolAdditionalInc;
459                         boolExtraPtr = boolExtraInc;
460                         iterDataStringPtr = iterDataInc;
461                         iterFileTypePtr = iterFileTypeInc;
462                         iterFileEncPtr = iterFileEncInc;                        
464                         ProcessSaveDataC(args...);
465                         
466                         std::map<int,std::string>::iterator strIter;
467                         wxString strMainValue;
468                         
469                         int intSeekData = (*iterDataStringPtr)->first;
470                         strIter = MainMapData->find(intSeekData);
471                         
472                         wxString strFileType = (*iterFileTypePtr)->second;
473                         wxString strFileEnc = (*iterFileEncPtr)->second;
475                         EscapeString(&strFileType, FALSE);
476                         EscapeString(&strFileEnc, FALSE);
478                         if (strIter->first == intSeekData){
479         
480                                 strMainValue = wxString::FromAscii(strIter->second.c_str());
481                                 strMainValue.insert(0, wxT("data:") + strFileType + wxT(";") + strFileEnc + wxT(","));
482         
483                         }
484                         
485                         if (*boolExtraPtr == TRUE && !strPropertyPtr->IsEmpty()){
487                                 vCardData->AddRaw(strPropertyName + wxT(";") + *strPropertyPtr, strMainValue);
489                         } else {
491                                 vCardData->AddRaw(strPropertyName, strMainValue);
493                         }
494                         
495                         *boolExtraPtr = FALSE;
496                         *boolAdditionalPtr = FALSE;
497                         iterDataStringPtr = 0;
498         
499                 }
500                 
501                 template<typename... Args>
502                 void ProcessSaveData(wxString strPropertyName,
503                         wxString *strPropertyInc, 
504                         bool *boolAdditionalInc, bool *boolExtraInc, 
505                         std::map<int,wxString>::iterator *iterDataInc,
506                         std::map<int,wxString> *MainMapData,
507                         vCard *vCardData,
508                         Args*... args) {
510                         //int intSeekSelectedData = 0;
512                         //DeleteMapDataProcess(IndexNum, Moo);
513                         strPropertyPtr = strPropertyInc;
514                         boolAdditionalPtr = boolAdditionalInc;
515                         boolExtraPtr = boolExtraInc;
516                         iterDataPtr = iterDataInc;
517                         ProcessSaveDataB(args...);
518                         
519                         std::map<int,wxString>::iterator strIter;
520                         wxString strMainValue;
521                         
522                         int intSeekData = (*iterDataPtr)->first;
523                         strIter = MainMapData->find(intSeekData);
524         
525                         if (strIter->first == intSeekData){
526         
527                             strMainValue = strIter->second;
528         
529                         }
530                         
531                         EscapeString(&strMainValue, FALSE);
532                         
533                         if (*boolExtraPtr == TRUE && !strPropertyPtr->IsEmpty()){
535                                 vCardData->AddRaw(strPropertyName + wxT(";") + *strPropertyPtr, strMainValue);
537                         } else {
539                                 vCardData->AddRaw(strPropertyName, strMainValue);
541                         }
542                         
543                         *boolExtraPtr = FALSE;
544                         *boolAdditionalPtr = FALSE;
545                         iterDataPtr = 0;
546         
547                 }
548                 
549                 template<typename... Args>
550                 void ProcessSaveData(wxString strPropertyName,
551                         wxString *strPropertyInc, 
552                         bool *boolAdditionalInc, bool *boolExtraInc, 
553                         std::map<int,wxString>::iterator *iterDataInc,
554                         wxString *MainData,
555                         vCard *vCardData,
556                         Args*... args) {
558                         //int intSeekSelectedData = 0;
560                         //DeleteMapDataProcess(IndexNum, Moo);
561                         strPropertyPtr = strPropertyInc;
562                         boolAdditionalPtr = boolAdditionalInc;
563                         boolExtraPtr = boolExtraInc;
564                         iterDataPtr = iterDataInc;
565                         
566                         ProcessSaveDataB(args...);
567                         
568                         std::map<int,wxString>::iterator strIter;
570                         if (*boolExtraPtr == TRUE && !strPropertyPtr->IsEmpty()){
572                                 vCardData->AddRaw(strPropertyName + wxT(";") + *strPropertyPtr, *MainData);
574                         } else {
576                                 vCardData->AddRaw(strPropertyName, *MainData);
578                         }
579                         
580                         *boolExtraPtr = FALSE;
581                         *boolAdditionalPtr = FALSE;
582                         iterDataPtr = 0;
583         
584                 }
586                 void ProcessCaptureStringsB () {} ;
587                 
588                 void ProcessCaptureStringsProc(wxString *strCapture);
589                 
590                 template<typename StringCapture, typename... Args>
591                 void ProcessCaptureStringsB(StringCapture *string, Args*... args) {
593                         ProcessCaptureStringsProc(string);
594                         ProcessCaptureStringsB(args...);
596                 }
597                 
598                 template<typename... Args>
599                 void ProcessCaptureStrings(Args*... args) {
601                         //int intSeekSelectedData = 0;
603                         ProcessCaptureStringsB(args...);
604         
605                 }
606                 
607                 void ResetSaveProcessData();
608                 void ContactFileChanged( wxCommandEvent &event );
609                 void ClearContact();
611                 void LoadKind(ContactKindType *KindType);
612                 void LoadBirthday(wxString *BirthdayData, bool *BirthdayText);
613                 void LoadAnniversary(wxString *AnniversaryData, bool *AnniversaryText);
614                 void LoadGender(wxString *GenderComponent, wxString *GenderIdentity);
615                 void LoadName(wxString *NameTitle, wxString *NameForename,
616                         wxString *NameSurname, wxString *NameOtherNames, 
617                         wxString *NameSuffix);
618                 void LoadMember(std::map<int,wxString> *GroupList);
619                 void LoadAddress(std::map<int, wxString> *GeneralAddressList,
620                         std::map<int, wxString> *GeneralAddressListTown,
621                         std::map<int, wxString> *GeneralAddressListCounty,
622                         std::map<int, wxString> *GeneralAddressListPostCode,
623                         std::map<int, int> *GeneralAddressListPref,
624                         std::map<int, wxString> *HomeAddressList,
625                         std::map<int, wxString> *HomeAddressListTown,
626                         std::map<int, wxString> *HomeAddressListCounty,
627                         std::map<int, wxString> *HomeAddressListPostCode,
628                         std::map<int, int> *HomeAddressListPref,
629                         std::map<int, wxString> *BusinessAddressList,
630                         std::map<int, wxString> *BusinessAddressListTown,
631                         std::map<int, wxString> *BusinessAddressListCounty,
632                         std::map<int, wxString> *BusinessAddressListPostCode,
633                         std::map<int, int> *BusinessAddressListPref, 
634                         int *AddressCount);
635                 
636                 void LoadData(std::map<int, wxString> *GeneralList,
637                         std::map<int, int> *GeneralListPref,
638                         wxListCtrl *GeneralListCtrl,
639                         std::map<int, wxString> *HomeList,
640                         std::map<int, int> *HomeListPref,
641                         wxListCtrl *HomeListCtrl,
642                         std::map<int, wxString> *BusinessList,
643                         std::map<int, int> *BusinessTZPref,
644                         wxListCtrl *BusinessListCtrl,
645                         int *DataCount);
646                 
647                 void LoadData(std::map<int, wxString> *GeneralList,
648                         std::map<int, int> *GeneralListPref,
649                         std::map<int, wxString> *GeneralListType,
650                         wxListCtrl *GeneralListCtrl,
651                         std::map<int, wxString> *HomeList,
652                         std::map<int, int> *HomeListPref,
653                         std::map<int, wxString> *HomeListType,
654                         wxListCtrl *HomeListCtrl,
655                         std::map<int, wxString> *BusinessList,
656                         std::map<int, int> *BusinessListPref,
657                         std::map<int, wxString> *BusinessListType,
658                         wxListCtrl *BusinessListCtrl,
659                         int *DataCount);
660                 
661                 void LoadData(std::map<int,wxString> *ItemList,
662                         std::map<int,int> *ItemListPref,
663                         wxListCtrl *ItemCtrl,
664                         int *DataCount);
666                 void LoadData(std::map<int,wxString> *ItemList,
667                         std::map<int,int> *ItemListPref,
668                         std::map<int,wxString> *ItemListType,
669                         wxListCtrl *ItemCtrl,
670                         int *DataCount);
671         
672                 void LoadData(wxString ItemName,
673                         std::map<int,wxString> *ItemList,
674                         std::map<int,int> *ItemListPref,
675                         std::map<int,wxString> *ItemListType,
676                         std::map<int,wxString> *ItemListDataType,
677                         wxListCtrl *ItemCtrl,
678                         int *DataCount);
679                         
680                 void LoadPictureData(wxString ItemName, 
681                         std::map<int,std::string> *ItemList,
682                         std::map<int,int> *ItemListPref,
683                         std::map<int,wxString> *ItemListType,
684                         wxListCtrl *ItemCtrl,
685                         int *DataCount);
686                         
687                 void LoadVendorData(std::map<int,wxString> *ItemListPEN,
688                         std::map<int,wxString> *ItemListElement,
689                         wxListCtrl *ItemCtrl,
690                         int *DataCount);
692                 void LoadXTokenData(std::map<int,wxString> *ItemListTokens,
693                         wxListCtrl *ItemCtrl,
694                         int *DataCount);
695                         
696                 void LoadData(std::map<int,wxString> *ItemList,
697                         wxComboBox *ItemCtrl);
698                         
699                 void LoadRelatedData(std::map<int,wxString> *ItemList,
700                         std::map<int,int> *ItemListPref,
701                         std::map<int,wxString> *ItemListType,
702                         wxListCtrl *ItemCtrl,
703                         int *DataCount);
704         
705                 int intValueSeek = 1;
706                 bool IsGroup = FALSE;
707         
708                 /* Items on General Tab */
709         
710                 ContactDataObject ContactEditorData;                    
711         
712                 /* Items regarding account and filename */
713                 
714                 wxString wxSContactFilename;
715                 wxString wxSContactAccount;
716                 bool boolContactModified;
717                 bool boolUnsupportedAccount = false;
718                 
719                 int intSeekSelectedData;
720                 
721                 /* Section for saving/loading data */
722                 
723                 wxString *strPropertyPtr;
724                 bool *boolAdditionalPtr;
725                 bool *boolExtraPtr;
726                 std::map<int,wxString>::iterator *iterDataPtr = 0;
727                 std::map<int,std::string>::iterator *iterDataStringPtr = 0;
728                 std::map<int,wxString>::iterator *iterFileTypePtr = 0;
729                 std::map<int,wxString>::iterator *iterFileEncPtr = 0;
730                 
731                 wxString ETag;
732                 wxString ETagOriginal;
733                 
734                 wxString strValue;
735                 wxString strValue2;
736                 wxString strValue3;
738                 bool boolValue = FALSE;
739                 bool boolValue2 = FALSE;
740                 size_t intValue = 0;
741                 int intValue2 = 0;
742                 int intValue3 = 0;
743                 bool BinaryDataProc = FALSE;
744                 bool EditMode = FALSE;
745                 bool StartupEditMode = FALSE;
746                 bool DialogOpen = FALSE;
747                 bool saveSuccess = false;
748                 
749                 /*
750                 std::string base64dec;
751                 sf::Sound AudioPlayback;
752                 sf::SoundBuffer AudioBuffer;
753                 */
754                 
755                 size_t base64declen;
756                 std::string base64dec;
757                 AudioStream *AudioStreamPlaybackPointer = nullptr;
758                 
759                 wxBitmap PictureImage;
760                 wxBitmap LogoImage;
761                 
762                 void SplitValues(wxString *PropertyLine,
763                         std::map<int,int> *SplitPoints, 
764                         std::map<int,int> *SplitLength, 
765                         int intSize);
766                 
767                 frmMain *MainPtr;
768                 frmActivityMgr *ActMgrPtr;
769                 wxETagProcessTimer *ETagTmrPtr;
770                 wxContactFileMonitorTimer FMTimer;
771                 
772                 int ContactEditorUID;
773                 
774                 DECLARE_EVENT_TABLE()
775         
776         //// end generated class members
777         
778 };
780 #endif // __frmContactEditor__
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy