Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Merge branch 'master' of ssh://gelforn.xestia.co.uk:/scmrepos/xestiaab
[xestiaab/.git] / source / search / frmSearch-contact.cpp
1 // frmSearch-contact.cpp - Search contact subroutines.
2 //
3 // (c) 2012-2015 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 "frmSearch.h"
20 #include "../frmMain.h"
21 #include "../frmContact.h"
23 void frmSearch::OpenContact( wxCommandEvent& event ){
24         
25         // Check if a contact has been selected.
27         long intSelected = -1;
28         int intSelectedData = 0;
29         long intContactSeekNum = -1;
31         intSelected = lstResults->GetNextItem(intSelected, 
32                 wxLIST_NEXT_ALL,
33                 wxLIST_STATE_SELECTED);
35         if (intSelected == -1){
36                 return;
37         }
39         intContactSeekNum = lstResults->GetItemData(intSelected);
41         if (SearchMode == TRUE){
42     
43                 wxMessageBox(SearchResultFilename[intContactSeekNum]);
44     
45                 vCard Person;
46     
47                 Person.LoadFile(SearchResultFilename[intContactSeekNum]);
48     
49                 wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
50                 wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
51                 wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
52                 wxIcon contacticon;
53                 contacticon.CopyFromBitmap(contacticonbmp);
54     
55                 frmContact *Contact = new frmContact( this );
56     
57                 Contact->SetupPointers(&SearchModeMemoryFSPtr);
58                 Contact->SetupContactData(&Person);
59     
60                 Contact->SetIcon(contacticon);
61                 Contact->Show(true);
63         } else {
65                 UCNotif *uc = new UCNotif;
67                 uc->ContactAccount = SearchResultAccount[intContactSeekNum];
68                 uc->ContactFilename = SearchResultFilename[intContactSeekNum];
70                 wxCommandEvent oc(CE_OPENCONTACT);
71                 oc.SetClientData(uc);
72                 wxPostEvent(this->GetParent(), oc);
74         }
76 }
78 void frmSearch::EditContact( wxCommandEvent& event ){
80         // Check if a contact has been selected.
82         long intSelected = -1;
83         int intSelectedData = 0;
84         long intContactSeekNum = -1;
86         intSelected = lstResults->GetNextItem(intSelected, 
87                 wxLIST_NEXT_ALL,
88                 wxLIST_STATE_SELECTED);
90         if (intSelected == -1){
91                 return;
92         }
94         intContactSeekNum = lstResults->GetItemData(intSelected);
96         UCNotif *uc = new UCNotif;
98         uc->ContactAccount = SearchResultAccount[intContactSeekNum];
99         uc->ContactFilename = SearchResultFilename[intContactSeekNum];
101         wxCommandEvent ec(CE_EDITCONTACT);
102         ec.SetClientData(uc);
103         ec.SetInt(1);
104         wxPostEvent(this->GetParent(), ec);
108 void frmSearch::RevealContact( wxCommandEvent& event ){
110         // Check if a contact has been selected.
112         long intSelected = -1;
113         int intSelectedData = 0;
114         long intContactSeekNum = -1;
116         intSelected = lstResults->GetNextItem(intSelected, 
117                 wxLIST_NEXT_ALL,
118                 wxLIST_STATE_SELECTED);
120         if (intSelected == -1){
121                 return;
122         }
124         intContactSeekNum = lstResults->GetItemData(intSelected);
126         UCNotif *uc = new UCNotif;
128         uc->ContactAccount = SearchResultAccount[intContactSeekNum];
129         uc->ContactFilename = SearchResultFilename[intContactSeekNum];
131         wxCommandEvent rc(CE_REVEALCONTACT);
132         rc.SetClientData(uc);
133         rc.SetInt(1);
134         wxPostEvent(this->GetParent(), rc);
138 void frmSearch::ShowContactMenu( wxMouseEvent& event ){
140         // Show the contact menu.
141         
142         ContactMenu->SetupPointersSearch(this, lstResults, SearchMode);
144         PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition);
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