Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditor: Stop XAB crashing when pressing Modify/Delete
[xestiaab/.git] / source / contacteditor / frmContactEditor-Category.cpp
1 // frmContactEditor-Category.cpp - frmContactEditor Category 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 "frmContactEditorCategory.h"
22 void frmContactEditor::AddCategory( wxCommandEvent& event )
23 {
25         // Bring up the window to add a category.
26     
27         frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
28         frameCECategory->SetEditorMode(FALSE);
29         frameCECategory->SetupPointers(&ContactEditorData.CategoriesList,
30                 &ContactEditorData.CategoriesListAltID,
31                 &ContactEditorData.CategoriesListPID,
32                 &ContactEditorData.CategoriesListType,
33                 &ContactEditorData.CategoriesListTokens,
34                 &ContactEditorData.CategoriesListPref,
35                 lboCategories,
36                 (intValueSeek));
37         frameCECategory->ShowModal();
38         delete frameCECategory;
39         frameCECategory = NULL;
40         
41 }
43 void frmContactEditor::ModifyCategory( wxCommandEvent& event )
44 {
46         // Bring up the window to edit a category.
48         long longSelected = -1;
49         int intSelectedData = 0;
50     
51         if (lboCategories->GetItemCount() == 0 || !GetSelectedItem(lboCategories,
52                 &longSelected,
53                 &intSelectedData)){
54                 
55                 return;
56                 
57         }
58     
59         frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
60         frameCECategory->SetupPointers(&ContactEditorData.CategoriesList,
61                 &ContactEditorData.CategoriesListAltID,
62                 &ContactEditorData.CategoriesListPID,
63                 &ContactEditorData.CategoriesListType,
64                 &ContactEditorData.CategoriesListTokens,
65                 &ContactEditorData.CategoriesListPref,
66                 lboCategories,
67                 intSelectedData);
68         frameCECategory->SetEditorMode(TRUE);
69         frameCECategory->ShowModal();
70         delete frameCECategory;
71         frameCECategory = NULL;
72         
73 }
75 void frmContactEditor::DeleteCategory( wxCommandEvent& event )
76 {
78         // Bring up the window to delete the category.
80         long longSelected = -1;
81         int intSelectedData = 0;
82     
83         if (lboCategories->GetItemCount() == 0 || !GetSelectedItem(lboCategories,
84                 &longSelected,
85                 &intSelectedData)){
86                 
87                 return;
88                 
89         }
90     
91         lboCategories->DeleteItem(longSelected);
92     
93         DeleteMapData(intSelectedData, &ContactEditorData.CategoriesList,
94                 &ContactEditorData.CategoriesListAltID, &ContactEditorData.CategoriesListPID,
95                 &ContactEditorData.CategoriesListType, &ContactEditorData.CategoriesListTokens,
96                 &ContactEditorData.CategoriesListPref);
97  
98 }
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