1 // frmSearch-contact.cpp - Search contact subroutines.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
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.
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.
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 ){
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,
33 wxLIST_STATE_SELECTED);
35 if (intSelected == -1){
39 intContactSeekNum = lstResults->GetItemData(intSelected);
41 if (SearchMode == TRUE){
43 wxMessageBox(SearchResultFilename[intContactSeekNum]);
47 Person.LoadFile(SearchResultFilename[intContactSeekNum]);
49 wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
50 wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
51 wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
53 contacticon.CopyFromBitmap(contacticonbmp);
55 frmContact *Contact = new frmContact( this );
57 Contact->SetupPointers(&SearchModeMemoryFSPtr);
58 Contact->SetupContactData(&Person);
60 Contact->SetIcon(contacticon);
65 UCNotif *uc = new UCNotif;
67 uc->ContactAccount = SearchResultAccount[intContactSeekNum];
68 uc->ContactFilename = SearchResultFilename[intContactSeekNum];
70 wxCommandEvent oc(CE_OPENCONTACT);
72 wxPostEvent(this->GetParent(), oc);
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,
88 wxLIST_STATE_SELECTED);
90 if (intSelected == -1){
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);
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,
118 wxLIST_STATE_SELECTED);
120 if (intSelected == -1){
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);
134 wxPostEvent(this->GetParent(), rc);
138 void frmSearch::ShowContactMenu( wxMouseEvent& event ){
140 ContactMenu->SetupPointersSearch(this, lstResults, SearchMode);
142 PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition);