Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Version 0.18 release
[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         long intContactSeekNum = -1;
30         intSelected = lstResults->GetNextItem(intSelected, 
31                 wxLIST_NEXT_ALL,
32                 wxLIST_STATE_SELECTED);
34         if (intSelected == -1){
35                 return;
36         }
38         intContactSeekNum = lstResults->GetItemData(intSelected);
40         if (SearchMode == TRUE){
41     
42                 vCard Person;
43     
44                 Person.LoadFile(SearchResultFilename[intContactSeekNum]);
45     
46                 wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
47                 wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
48                 wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
49                 wxIcon contacticon;
50                 contacticon.CopyFromBitmap(contacticonbmp);
51     
52                 frmContact *Contact = new frmContact( this );
53     
54                 Contact->SetupPointers(&SearchModeMemoryFSPtr);
55                 Contact->SetupContactData(&Person);
56     
57                 Contact->SetIcon(contacticon);
58                 Contact->Show(true);
60         } else {
62                 UCNotif *uc = new UCNotif;
64                 uc->ContactAccount = SearchResultAccount[intContactSeekNum];
65                 uc->ContactFilename = SearchResultFilename[intContactSeekNum];
67                 wxCommandEvent oc(CE_OPENCONTACT);
68                 oc.SetClientData(uc);
69                 wxPostEvent(this->GetParent(), oc);
71         }
73 }
75 void frmSearch::EditContact( wxCommandEvent& event ){
77         // Check if a contact has been selected.
79         long intSelected = -1;
80         long intContactSeekNum = -1;
82         intSelected = lstResults->GetNextItem(intSelected, 
83                 wxLIST_NEXT_ALL,
84                 wxLIST_STATE_SELECTED);
86         if (intSelected == -1){
87                 return;
88         }
90         intContactSeekNum = lstResults->GetItemData(intSelected);
92         UCNotif *uc = new UCNotif;
94         uc->ContactAccount = SearchResultAccount[intContactSeekNum];
95         uc->ContactFilename = SearchResultFilename[intContactSeekNum];
97         wxCommandEvent ec(CE_EDITCONTACT);
98         ec.SetClientData(uc);
99         ec.SetInt(1);
100         wxPostEvent(this->GetParent(), ec);
104 void frmSearch::RevealContact( wxCommandEvent& event ){
106         // Check if a contact has been selected.
108         long intSelected = -1;
109         long intContactSeekNum = -1;
111         intSelected = lstResults->GetNextItem(intSelected, 
112                 wxLIST_NEXT_ALL,
113                 wxLIST_STATE_SELECTED);
115         if (intSelected == -1){
116                 return;
117         }
119         intContactSeekNum = lstResults->GetItemData(intSelected);
121         UCNotif *uc = new UCNotif;
123         uc->ContactAccount = SearchResultAccount[intContactSeekNum];
124         uc->ContactFilename = SearchResultFilename[intContactSeekNum];
126         wxCommandEvent rc(CE_REVEALCONTACT);
127         rc.SetClientData(uc);
128         rc.SetInt(1);
129         wxPostEvent(this->GetParent(), rc);
133 void frmSearch::ShowContactMenu( wxMouseEvent& event ){
135         // Show the contact menu.
136         
137         ContactMenu->SetupPointersSearch(this, lstResults, SearchMode);
139         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