// frmSearch-contact.cpp - Search contact subroutines. // // (c) 2012-2015 Xestia Software Development. // // This file is part of Xestia Address Book. // // Xestia Address Book is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by the // Free Software Foundation, version 3 of the license. // // Xestia Address Book is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with Xestia Address Book. If not, see #include "frmSearch.h" #include "../frmMain.h" #include "../frmContact.h" void frmSearch::OpenContact( wxCommandEvent& event ){ // Check if a contact has been selected. long intSelected = -1; long intContactSeekNum = -1; intSelected = lstResults->GetNextItem(intSelected, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (intSelected == -1){ return; } intContactSeekNum = lstResults->GetItemData(intSelected); if (SearchMode == TRUE){ vCard Person; Person.LoadFile(SearchResultFilename[intContactSeekNum]); wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png)); wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG); wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1); wxIcon contacticon; contacticon.CopyFromBitmap(contacticonbmp); frmContact *Contact = new frmContact( this ); Contact->SetupPointers(&SearchModeMemoryFSPtr); Contact->SetupContactData(&Person); Contact->SetIcon(contacticon); Contact->Show(true); } else { UCNotif *uc = new UCNotif; uc->ContactAccount = SearchResultAccount[intContactSeekNum]; uc->ContactFilename = SearchResultFilename[intContactSeekNum]; wxCommandEvent oc(CE_OPENCONTACT); oc.SetClientData(uc); wxPostEvent(this->GetParent(), oc); } } void frmSearch::EditContact( wxCommandEvent& event ){ // Check if a contact has been selected. long intSelected = -1; long intContactSeekNum = -1; intSelected = lstResults->GetNextItem(intSelected, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (intSelected == -1){ return; } intContactSeekNum = lstResults->GetItemData(intSelected); UCNotif *uc = new UCNotif; uc->ContactAccount = SearchResultAccount[intContactSeekNum]; uc->ContactFilename = SearchResultFilename[intContactSeekNum]; wxCommandEvent ec(CE_EDITCONTACT); ec.SetClientData(uc); ec.SetInt(1); wxPostEvent(this->GetParent(), ec); } void frmSearch::RevealContact( wxCommandEvent& event ){ // Check if a contact has been selected. long intSelected = -1; long intContactSeekNum = -1; intSelected = lstResults->GetNextItem(intSelected, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (intSelected == -1){ return; } intContactSeekNum = lstResults->GetItemData(intSelected); UCNotif *uc = new UCNotif; uc->ContactAccount = SearchResultAccount[intContactSeekNum]; uc->ContactFilename = SearchResultFilename[intContactSeekNum]; wxCommandEvent rc(CE_REVEALCONTACT); rc.SetClientData(uc); rc.SetInt(1); wxPostEvent(this->GetParent(), rc); } void frmSearch::ShowContactMenu( wxMouseEvent& event ){ // Show the contact menu. ContactMenu->SetupPointersSearch(this, lstResults, SearchMode); PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition); }