Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditor: Stop XAB crashing when pressing Modify/Delete
[xestiaab/.git] / source / contacteditor / frmContactEditor-Calendar.cpp
1 // frmContactEditor-Calendar.cpp - frmContactEditor Calendar tab subroutines.
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 #include "frmContactEditor.h"
20 #include "frmContactEditorCalAdr.h"
22 void frmContactEditor::AddCalendarAddress( wxCommandEvent& event )
23 {
25         // Bring up the window to add the calendar address.
26     
27         frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
28         frameCECalAdr->SetEditorMode(FALSE);
29         frameCECalAdr->SetupPointers(&ContactEditorData.CalendarList,
30                 &ContactEditorData.CalendarListAltID,
31                 &ContactEditorData.CalendarListPID,
32                 &ContactEditorData.CalendarListType,
33                 &ContactEditorData.CalendarListTokens,
34                 &ContactEditorData.CalendarListPref,
35                 lboCalendarAddresses,
36                 (intValueSeek));
37         frameCECalAdr->ShowModal();
38         delete frameCECalAdr;
39         frameCECalAdr = NULL;
40         
41 }
43 void frmContactEditor::ModifyCalendarAddress( wxCommandEvent& event )
44 {
46         // Bring up the window to modify the calendar address.
48         long longSelected = -1;
49         int intSelectedData = 0;
50     
51         if (lboCalendarAddresses->GetItemCount() == 0 || !GetSelectedItem(lboCalendarAddresses,
52                 &longSelected,
53                 &intSelectedData)){
54                 
55                 return;
56                 
57         }
58     
59         frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
60         frameCECalAdr->SetupPointers(&ContactEditorData.CalendarList,
61                 &ContactEditorData.CalendarListAltID,
62                 &ContactEditorData.CalendarListPID,
63                 &ContactEditorData.CalendarListType,
64                 &ContactEditorData.CalendarListTokens,
65                 &ContactEditorData.CalendarListPref,
66                 lboCalendarAddresses,
67                 intSelectedData);
68         frameCECalAdr->SetEditorMode(TRUE);
69         frameCECalAdr->ShowModal();
70         delete frameCECalAdr;
71         frameCECalAdr = NULL;
72         
73 }
75 void frmContactEditor::DeleteCalendarAddress( wxCommandEvent& event )
76 {
78         // Bring up the window to delete the calendar address.
80         long longSelected = -1;
81         int intSelectedData = 0;
82     
83         if (lboCalendarAddresses->GetItemCount() == 0 || !GetSelectedItem(lboCalendarAddresses,
84                 &longSelected,
85                 &intSelectedData)){
86                 
87                 return;
88                 
89         }
90     
91         lboCalendarAddresses->DeleteItem(longSelected);
92     
93         DeleteMapData(intSelectedData, &ContactEditorData.CalendarList, &ContactEditorData.CalendarListAltID,
94                 &ContactEditorData.CalendarListPID, &ContactEditorData.CalendarListType, &ContactEditorData.CalendarListTokens,
95                 &ContactEditorData.CalendarListPref);
96     
97 }
99 void frmContactEditor::AddCalendarRequest( wxCommandEvent& event )
102         // Bring up the window to add a calendar request address.
103     
104         frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
105         frameCECalAdr->SetEditorMode(FALSE);
106         frameCECalAdr->SetupPointers(&ContactEditorData.CalendarRequestList,
107                 &ContactEditorData.CalendarRequestListAltID,
108                 &ContactEditorData.CalendarRequestListPID,
109                 &ContactEditorData.CalendarRequestListType,
110                 &ContactEditorData.CalendarRequestListTokens,
111                 &ContactEditorData.CalendarRequestListPref,
112                 lboCalendarRequestAddress,
113                 (intValueSeek));
114         frameCECalAdr->ShowModal();
115         delete frameCECalAdr;
116         frameCECalAdr = NULL;
117         
120 void frmContactEditor::ModifyCalendarRequest( wxCommandEvent& event )
123         // Bring up the window to modify a calendar request address.
125         long longSelected = -1;
126         int intSelectedData = 0;
127     
128         if (lboCalendarRequestAddress->GetItemCount() == 0 || !GetSelectedItem(lboCalendarRequestAddress,
129                 &longSelected,
130                 &intSelectedData)){
131                 
132                 return;
133                 
134         }
135     
136         frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
137         frameCECalAdr->SetupPointers(&ContactEditorData.CalendarRequestList,
138                 &ContactEditorData.CalendarRequestListAltID,
139                 &ContactEditorData.CalendarRequestListPID,
140                 &ContactEditorData.CalendarRequestListType,
141                 &ContactEditorData.CalendarRequestListTokens,
142                 &ContactEditorData.CalendarRequestListPref,
143                 lboCalendarRequestAddress,
144                 intSelectedData);
145         frameCECalAdr->SetEditorMode(TRUE);
146         frameCECalAdr->ShowModal();
147         delete frameCECalAdr;
148         frameCECalAdr = NULL;
149         
152 void frmContactEditor::DeleteCalendarRequest( wxCommandEvent& event )
155         // Bring up the window to delete a calendar request address.
157         long longSelected = -1;
158         int intSelectedData = 0;
159     
160         if (lboCalendarRequestAddress->GetItemCount() == 0 || !GetSelectedItem(lboCalendarRequestAddress,
161                 &longSelected,
162                 &intSelectedData)){
163                 
164                 return;
165                 
166         }
167     
168         lboCalendarRequestAddress->DeleteItem(longSelected);
169     
170         DeleteMapData(intSelectedData, &ContactEditorData.CalendarRequestList,
171                 &ContactEditorData.CalendarRequestListAltID, &ContactEditorData.CalendarRequestListPID,
172                 &ContactEditorData.CalendarRequestListType, &ContactEditorData.CalendarRequestListTokens,
173                 &ContactEditorData.CalendarRequestListPref);
174                 
177 void frmContactEditor::AddFreeBusy( wxCommandEvent& event )
180         // Bring up the window to add a calendar free/busy address.
181     
182         frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
183         frameCECalAdr->SetEditorMode(FALSE);
184         frameCECalAdr->SetupPointers(&ContactEditorData.FreeBusyList,
185                 &ContactEditorData.FreeBusyListAltID,
186                 &ContactEditorData.FreeBusyListPID,
187                 &ContactEditorData.FreeBusyListType,
188                 &ContactEditorData.FreeBusyListTokens,
189                 &ContactEditorData.FreeBusyListPref,
190                 lboFreeBusyAddresses,
191                 (intValueSeek));
192         frameCECalAdr->ShowModal();
193         delete frameCECalAdr;
194         frameCECalAdr = NULL;
195         
198 void frmContactEditor::ModifyFreeBusy( wxCommandEvent& event )
201         // Bring up the window to modify a calendar free/busy address.
203         long longSelected = -1;
204         int intSelectedData = 0;
205     
206         if (lboFreeBusyAddresses->GetItemCount() == 0 || !GetSelectedItem(lboFreeBusyAddresses,
207                 &longSelected,
208                 &intSelectedData)){
209                 
210                 return;
211                 
212         }
213     
214         frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
215         frameCECalAdr->SetupPointers(&ContactEditorData.FreeBusyList,
216                 &ContactEditorData.FreeBusyListAltID,
217                 &ContactEditorData.FreeBusyListPID,
218                 &ContactEditorData.FreeBusyListType,
219                 &ContactEditorData.FreeBusyListTokens,
220                 &ContactEditorData.FreeBusyListPref,
221                 lboFreeBusyAddresses,
222                 intSelectedData);
223         frameCECalAdr->SetEditorMode(TRUE);
224         frameCECalAdr->ShowModal();
225         delete frameCECalAdr;
226         frameCECalAdr = NULL;
227         
230 void frmContactEditor::DeleteFreeBusy( wxCommandEvent& event )
233         // Bring up the window to delete a calendar free/busy address.
235         long longSelected = -1;
236         int intSelectedData = 0;
237     
238         if (lboFreeBusyAddresses->GetItemCount() == 0 || !GetSelectedItem(lboFreeBusyAddresses,
239                 &longSelected,
240                 &intSelectedData)){
241                 
242                 return;
243                 
244         }
245     
246         lboFreeBusyAddresses->DeleteItem(longSelected);
247     
248         DeleteMapData(intSelectedData, &ContactEditorData.FreeBusyList, &ContactEditorData.FreeBusyListAltID,
249                 &ContactEditorData.FreeBusyListPID, &ContactEditorData.FreeBusyListType, &ContactEditorData.FreeBusyListTokens,
250                 &ContactEditorData.FreeBusyListPref);
251     
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