Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Split frmContactEditor-Load.cpp into 24 files to make it more manageable.
[xestiaab/.git] / source / contacteditor / frmContactEditor-LoadBADays.cpp
1 #include "frmContactEditor.h"
3 void frmContactEditor::LoadBDay(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *BirthdayProcessed){
5         // Process date. Preserve the remainder in the string.
7         std::map<int, int> SplitPoints;
8         std::map<int, int> SplitLength;
9         std::map<int, int>::iterator SLiter;                    
10         wxString PropertyData;
11         wxString PropertyName;
12         wxString PropertyValue;
13         wxString PropertyTokens;
14         bool BirthdayText = FALSE;
15         int intPrevValue = 6;
17         SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
19         intPrevValue = 5;
21         // Look for type before continuing.
23         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
24         intiter != SplitPoints.end(); ++intiter){
26                 SLiter = SplitLength.find(intiter->first);
28                 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
29         
30                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
31                 PropertyName = PropertyElement.GetNextToken();                          
32                 PropertyValue = PropertyElement.GetNextToken();
33         
34                 intPrevValue = intiter->second;
35         
36                 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
37         
38                         ProcessCaptureStrings(&wxSPropertySeg2);
39                         txtBirthday->SetValue(wxSPropertySeg2);
40                         Birthday = wxSPropertySeg2;
41                         BirthdayText = TRUE;
42         
43                 }
45         }
47         // Setup blank lines for later on.
48         
49         intPrevValue = 5;
51         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
52         intiter != SplitPoints.end(); ++intiter){
54                 SLiter = SplitLength.find(intiter->first);
56                 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
57         
58                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
59                 PropertyName = PropertyElement.GetNextToken();                          
60                 PropertyValue = PropertyElement.GetNextToken();
61         
62                 intPrevValue = intiter->second;
63         
64                 // Process properties.
65         
66                 ProcessCaptureStrings(&PropertyValue);
67         
68                 size_t intPropertyValueLen = PropertyValue.Len();
69         
70                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
71                 
72                         PropertyValue.Trim();
73                         PropertyValue.RemoveLast();
74                 
75                 }                               
76         
77                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
78                 
79                         PropertyValue.Remove(0, 1);
80                 
81                 }                               
82         
83                 if (PropertyName == wxT("ALTID")){
85                         BirthdayAltID = PropertyValue;
86         
87                 } else if (PropertyName == wxT("CALSCALE")){
88         
89                         BirthdayCalScale = PropertyValue;
90         
91                 } else if (PropertyName != wxT("VALUE")) {
92         
93                         // Something else we don't know about so append
94                         // to the tokens variable.
95                 
96                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
97                 
98                                 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
99                                 
100                         }
101                         
102                 }
104         }       
106         // Add the data to the variables and form.
107         
108         if (BirthdayText == FALSE){
109         
110                 Birthday = wxSPropertySeg2;
111                 int DateYear = 0;
112                 wxDateTime::Month DateMonth;
113                 unsigned int DateDay;
114                 
115                 wxString wxSData;
116                 
117                 if (Birthday.Mid(0, 2) == wxT("--")){
118                 
119                         // Skip year.
120                 
121                 } else {
122                 
123                         DateYear = wxAtoi(Birthday.Mid(0,4));
124                 
125                 }
126                 
127                 DateMonth = (wxDateTime::Month)(wxAtoi(Birthday.Mid(4,2)) - 1);
128                 DateDay = wxAtoi(Birthday.Mid(6,2));
129         
130                 wxDateTime BDayDate(DateDay,DateMonth,DateYear);
131         
132                 /*BDayDate.SetDay(DateDay);
133                 BDayDate.SetMonth(wxDateTime::Month::Jan);
134                 BDayDate.SetYear(DateYear);*/
135         
136                 dapBirthday->SetValue(BDayDate);                                
137         
138         }
139         
140         BirthdayTokens = PropertyTokens;
141         
142         *BirthdayProcessed = TRUE;
146 void frmContactEditor::LoadAnniversary(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *AnniversaryProcessed){
148         // Process date. Preserve the remainder in the string.
149                 
150         std::map<int, int> SplitPoints;
151         std::map<int, int> SplitLength;
152         std::map<int, int>::iterator SLiter;                    
153         wxString PropertyData;
154         wxString PropertyName;
155         wxString PropertyValue;
156         wxString PropertyTokens;
157         bool AnniversaryText = FALSE;
158         int intPrevValue = 13;
160         SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
162         intPrevValue = 12;
164         // Look for type before continuing.
166         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
167         intiter != SplitPoints.end(); ++intiter){
169                 SLiter = SplitLength.find(intiter->first);
171                 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
172         
173                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
174                 PropertyName = PropertyElement.GetNextToken();                          
175                 PropertyValue = PropertyElement.GetNextToken();
176         
177                 intPrevValue = intiter->second;
178         
179                 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
180         
181                         ProcessCaptureStrings(&wxSPropertySeg2);
182                         txtAnniversary->SetValue(wxSPropertySeg2);
183                         Anniversary = wxSPropertySeg2;
184                         AnniversaryText = TRUE;
185         
186                 }
188         }
190         // Setup blank lines for later on.
192         intPrevValue = 12;
194         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
195         intiter != SplitPoints.end(); ++intiter){
197                 SLiter = SplitLength.find(intiter->first);
199                 PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
200         
201                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
202                 PropertyName = PropertyElement.GetNextToken();                          
203                 PropertyValue = PropertyElement.GetNextToken();
204         
205                 intPrevValue = intiter->second;
206         
207                 // Process properties.
208         
209                 size_t intPropertyValueLen = PropertyValue.Len();
210         
211                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
212                 
213                         PropertyValue.Trim();
214                         PropertyValue.RemoveLast();
215                 
216                 }                               
217         
218                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
219                 
220                         PropertyValue.Remove(0, 1);
221                 
222                 }
223                 
224                 ProcessCaptureStrings(&PropertyValue);          
225         
226                 if (PropertyName == wxT("ALTID")){
228                         AnniversaryAltID = PropertyValue;
229         
230                 } else if (PropertyName == wxT("CALSCALE")){
231         
232                         AnniversaryCalScale = PropertyValue;
233         
234                 } else if (PropertyName != wxT("VALUE")) {
235         
236                         // Something else we don't know about so append
237                         // to the tokens variable.
238                         
239                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
240                 
241                                 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
242                                 
243                         }
244         
245                 }
247         }       
249         // Add the data to the variables and form.
250         
251         if (AnniversaryText == FALSE){
252         
253                 Anniversary = wxSPropertySeg2;
254                 int DateYear = 0;
255                 wxDateTime::Month DateMonth;
256                 int DateDay;
257                 
258                 wxString wxSData;
259                 
260                 if (Anniversary.Mid(0, 2) == wxT("--")){
261                 
262                         // Skip year.
263                 
264                 } else {
265                 
266                         DateYear = wxAtoi(Anniversary.Mid(0,4));
267                 
268                 }
269                 
270                 DateMonth = (wxDateTime::Month)(wxAtoi(Anniversary.Mid(4,2)) - 1);
271                 DateDay = wxAtoi(Anniversary.Mid(6,2));                                 
272         
273                 wxDateTime ADayDate(DateDay,DateMonth,DateYear);
274         
275                 dapAnniversary->SetValue(ADayDate);
276         
277         }
278         
279         AnniversaryTokens = PropertyTokens;
280         
281         *AnniversaryProcessed = TRUE;
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