#include "frmSearch.h"
#include "frmMain.h"
+#include "frmContact.h"
#include "search/XABSearchPanel.h"
#include "search/frmSearchAccounts.h"
#include "common/preferences.h"
#include "vcard/vcard.h"
#include <thread>
+#include <wx/fs_mem.h>
/*#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>*/
void frmSearch::ReloadAccountList( wxCommandEvent& event ){
+ // Currently unimplemented.
+
}
void frmSearch::AddResult( wxCommandEvent& event ){
intContactSeekNum = lstResults->GetItemData(intSelected);
- UCNotif *uc = new UCNotif;
+ if (SearchMode == TRUE){
+
+ wxMessageBox(SearchResultFilename[intContactSeekNum]);
+
+ 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);
- uc->ContactAccount = SearchResultAccount[intContactSeekNum];
- uc->ContactFilename = SearchResultFilename[intContactSeekNum];
+ } else {
+
+ UCNotif *uc = new UCNotif;
+
+ uc->ContactAccount = SearchResultAccount[intContactSeekNum];
+ uc->ContactFilename = SearchResultFilename[intContactSeekNum];
- wxCommandEvent oc(CE_OPENCONTACT);
- oc.SetClientData(uc);
- wxPostEvent(this->GetParent(), oc);
+ wxCommandEvent oc(CE_OPENCONTACT);
+ oc.SetClientData(uc);
+ wxPostEvent(this->GetParent(), oc);
+
+ }
}
SearchUID = UID;
+}
+
+void frmSearch::SetSearchMode(bool SearchModeIn){
+
+ SearchMode = SearchModeIn;
+
+ if (SearchMode == TRUE){
+
+ mnuContactEdit->Enable(FALSE);
+ mnuContactReveal->Enable(FALSE);
+
+ wxFileSystem::AddHandler(new wxMemoryFSHandler);
+ wxImage ciicon_png;
+
+ wxMemoryInputStream ciptostream(icons_cipto_png, sizeof(icons_cipto_png));
+ ciicon_png.LoadFile(ciptostream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cipto.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+
+ wxMemoryInputStream cilogstream(icons_cilog_png, sizeof(icons_cilog_png));
+ ciicon_png.LoadFile(cilogstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cilog.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+
+ wxMemoryInputStream cisndstream(icons_cisnd_png, sizeof(icons_cisnd_png));
+ ciicon_png.LoadFile(cisndstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cisnd.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+
+ wxMemoryInputStream cikeystream(icons_cikey_png, sizeof(icons_cikey_png));
+ ciicon_png.LoadFile(cikeystream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cikey.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+
+ wxMemoryInputStream civenstream(icons_civen_png, sizeof(icons_civen_png));
+ ciicon_png.LoadFile(civenstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("civen.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+
+ wxMemoryInputStream ciextstream(icons_ciext_png, sizeof(icons_ciext_png));
+ ciicon_png.LoadFile(ciextstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("ciext.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+
+ } else {
+
+ mnuContactEdit->Enable(TRUE);
+ mnuContactReveal->Enable(TRUE);
+
+ }
+
}
\ No newline at end of file