From: Steve Brokenshire Date: Sat, 10 Oct 2015 09:15:13 +0000 (+0100) Subject: Implemented search mode support using the -s/--search switch on the command line. X-Git-Tag: release-0.05~36 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=8f9ee6da0f290bb201962732d7567257e6f6f072 Implemented search mode support using the -s/--search switch on the command line. --- diff --git a/source/frmSearch.cpp b/source/frmSearch.cpp index 50d8b5c..f3ae077 100644 --- a/source/frmSearch.cpp +++ b/source/frmSearch.cpp @@ -1,5 +1,6 @@ #include "frmSearch.h" #include "frmMain.h" +#include "frmContact.h" #include "search/XABSearchPanel.h" #include "search/frmSearchAccounts.h" #include "common/preferences.h" @@ -7,6 +8,7 @@ #include "vcard/vcard.h" #include +#include /*#include #include #include */ @@ -1242,6 +1244,8 @@ void frmSearch::RemoveSearchSetting( wxCommandEvent& event ) void frmSearch::ReloadAccountList( wxCommandEvent& event ){ + // Currently unimplemented. + } void frmSearch::AddResult( wxCommandEvent& event ){ @@ -1366,14 +1370,40 @@ void frmSearch::OpenContact( 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); + + } } @@ -1665,4 +1695,49 @@ void frmSearch::SetUID(int UID){ 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 diff --git a/source/frmSearch.h b/source/frmSearch.h index 4153719..c167f0c 100644 --- a/source/frmSearch.h +++ b/source/frmSearch.h @@ -42,10 +42,12 @@ class frmSearch : public frmSearchADT std::map SearchAccountsPaths; std::map SearchResultAccount; std::map SearchResultFilename; + std::map SearchModeMemoryFSPtr; int ScrollGen = 0; int SearchUID = 0; bool SearchEnabled = FALSE; bool StopMode = FALSE; + bool SearchMode = FALSE; bool CheckDuplicate(wxString Filename, wxString Account, std::map *SRAcc, @@ -74,6 +76,7 @@ class frmSearch : public frmSearchADT /** Constructor */ frmSearch( wxWindow* parent ); void SetUID(int UID); + void SetSearchMode(bool SearchModeIn); DECLARE_EVENT_TABLE() //// end generated class members diff --git a/source/main.cpp b/source/main.cpp index 386e30d..c900927 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -13,6 +13,7 @@ #include "bitmaps.h" #include "version.h" #include "frmActivityMgr.h" +#include "frmSearch.h" #include "common/timers.h" #include "common/defaults.h" @@ -49,9 +50,9 @@ bool XestiaABApp::OnInit() { wxCMD_LINE_SWITCH, wxT_2("h"), wxT_2("help"), wxTRANSLATE("Displays help on command line parameters"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, /*{ wxCMD_LINE_OPTION, wxT_2("e"), wxT_2("edit"), wxTRANSLATE("Edit a vCard 4.0 formatted contact"), - wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },*/ { wxCMD_LINE_SWITCH, wxT_2("s"), wxT_2("search"), wxTRANSLATE("Display the search window instead of starting normally"), - wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },*/ + wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_SWITCH, wxT_2("v"), wxT_2("version"), wxTRANSLATE("Displays version number"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE } @@ -69,14 +70,26 @@ bool XestiaABApp::OnInit() if (XABArgs.Found(wxT("v"))){ + wxPuts(XSDAB_VERSION); exit(0); } wxInitAllImageHandlers(); - /*if (XABArgs.Found(wxT("e"), &wxSContactFilename)){ + if (XABArgs.Found(wxT("s"))){ + + // Open up the search window. + frmSearch *frmSearchPtr = new frmSearch( NULL ); + frmSearchPtr->Show(true); + frmSearchPtr->SetSearchMode(true); + return true; + + } + + /*if (XABArgs.Found(wxT("e"), &wxSContactFilename)){ + Xestia Gelforn Project Repositories - xestiaab/.git/tree - source/vcard/ // Check if the filename exists. //wxImage::AddHandler(new wxPNGHandler);