Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added ActivityListAccSettings to eventually replace ActivityListConn
[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                 wxMessageBox(SearchResultFilename[intContactSeekNum]);
43     
44                 vCard Person;
45     
46                 Person.LoadFile(SearchResultFilename[intContactSeekNum]);
47     
48                 wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
49                 wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
50                 wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
51                 wxIcon contacticon;
52                 contacticon.CopyFromBitmap(contacticonbmp);
53     
54                 frmContact *Contact = new frmContact( this );
55     
56                 Contact->SetupPointers(&SearchModeMemoryFSPtr);
57                 Contact->SetupContactData(&Person);
58     
59                 Contact->SetIcon(contacticon);
60                 Contact->Show(true);
62         } else {
64                 UCNotif *uc = new UCNotif;
66                 uc->ContactAccount = SearchResultAccount[intContactSeekNum];
67                 uc->ContactFilename = SearchResultFilename[intContactSeekNum];
69                 wxCommandEvent oc(CE_OPENCONTACT);
70                 oc.SetClientData(uc);
71                 wxPostEvent(this->GetParent(), oc);
73         }
75 }
77 void frmSearch::EditContact( wxCommandEvent& event ){
79         // Check if a contact has been selected.
81         long intSelected = -1;
82         long intContactSeekNum = -1;
84         intSelected = lstResults->GetNextItem(intSelected, 
85                 wxLIST_NEXT_ALL,
86                 wxLIST_STATE_SELECTED);
88         if (intSelected == -1){
89                 return;
90         }
92         intContactSeekNum = lstResults->GetItemData(intSelected);
94         UCNotif *uc = new UCNotif;
96         uc->ContactAccount = SearchResultAccount[intContactSeekNum];
97         uc->ContactFilename = SearchResultFilename[intContactSeekNum];
99         wxCommandEvent ec(CE_EDITCONTACT);
100         ec.SetClientData(uc);
101         ec.SetInt(1);
102         wxPostEvent(this->GetParent(), ec);
106 void frmSearch::RevealContact( wxCommandEvent& event ){
108         // Check if a contact has been selected.
110         long intSelected = -1;
111         long intContactSeekNum = -1;
113         intSelected = lstResults->GetNextItem(intSelected, 
114                 wxLIST_NEXT_ALL,
115                 wxLIST_STATE_SELECTED);
117         if (intSelected == -1){
118                 return;
119         }
121         intContactSeekNum = lstResults->GetItemData(intSelected);
123         UCNotif *uc = new UCNotif;
125         uc->ContactAccount = SearchResultAccount[intContactSeekNum];
126         uc->ContactFilename = SearchResultFilename[intContactSeekNum];
128         wxCommandEvent rc(CE_REVEALCONTACT);
129         rc.SetClientData(uc);
130         rc.SetInt(1);
131         wxPostEvent(this->GetParent(), rc);
135 void frmSearch::ShowContactMenu( wxMouseEvent& event ){
137         // Show the contact menu.
138         
139         ContactMenu->SetupPointersSearch(this, lstResults, SearchMode);
141         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