"Fossies" - the Fresh Open Source Software Archive

Member "ldapexplorertool-2.0.1/src/searchdlg.cc" (28 Nov 2006, 2110 Bytes) of package /linux/privat/old/ldapexplorertool-2.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "searchdlg.cc" see the Fossies "Dox" file reference documentation.

    1 #include "wx/wxprec.h"
    2 
    3 #ifdef __BORLANDC__
    4     #pragma hdrstop
    5 #endif
    6 
    7 #ifndef WX_PRECOMP
    8     #include "wx/wx.h"
    9 #endif
   10 
   11 #include <wx/xrc/xmlres.h>
   12 
   13 #include "searchdlg.h"
   14 
   15 
   16 BEGIN_EVENT_TABLE( SearchDlg, wxDialog )
   17 EVT_BUTTON(XRCID( "button_search" ), SearchDlg::OnSearch) 
   18 EVT_BUTTON(XRCID( "button_close" ), SearchDlg::OnClose) 
   19 EVT_BUTTON(XRCID( "button_open" ), SearchDlg::OnOpen) 
   20 END_EVENT_TABLE()
   21 
   22 SearchDlg::SearchDlg( wxWindow *p_parent, SchemaUtil *p_ldap, const wxString& p_base )
   23 {
   24     m_ldap = p_ldap;
   25     m_base = p_base;
   26     wxXmlResource::Get()->LoadDialog( this, p_parent, wxT( "search_dlg" ) );
   27     InitControls();
   28     searchbase_lbl->SetLabel( m_base );
   29 }
   30 SearchDlg::~SearchDlg()
   31 {
   32 }
   33 void SearchDlg::InitControls( void )
   34 {
   35         searchbase_lbl=(wxStaticText*)FindWindowById( XRCID("searchbase_lbl"),this );
   36         searchlevel_radio=(wxRadioBox*)FindWindowById( XRCID("searchlevel_radio"),this );
   37         searchfilter_textctrl=(wxTextCtrl*)FindWindowById( XRCID("searchfilter_textctrl"),this );
   38         searchresult_listbox=(wxListBox*)FindWindowById( XRCID("searchresult_listbox"),this );
   39 }
   40 
   41 void SearchDlg::OnSearch( wxCommandEvent& p_evt )
   42 {
   43     int Ret;
   44     int scope ;
   45     
   46     wxString search_level = searchlevel_radio->GetStringSelection();
   47 
   48     searchresult_listbox->Clear();  
   49     if( search_level == wxT("One Sub Level") )
   50     {
   51         scope = LDAP_SCOPE_ONELEVEL;
   52     }
   53     else
   54     {
   55         scope = LDAP_SCOPE_SUBTREE;
   56     }   
   57     Ret = m_ldap->Search( Id, m_base, scope, searchfilter_textctrl->GetValue(), 
   58     NULL, false, LF_NONE );
   59     if( Ret != LDAP_SUCCESS )
   60     {
   61         return ;
   62     }
   63     
   64 
   65     int NbEntries = m_ldap->GetEntryCount( Id ) ;
   66     for( int i = 0; i < NbEntries; i++ )
   67     {
   68         LdapEntry Entry ;
   69         if( !m_ldap->GetEntry( Id, i, Entry ) )
   70         {
   71             ::wxMessageBox( m_ldap->GetErrorStr(), _("Error"), wxOK|wxICON_ERROR );
   72         }
   73         searchresult_listbox->Append( Entry.GetDn() );
   74     }
   75 //  m_ldap->CloseSearch( Id );
   76 }
   77 void SearchDlg::OnClose( wxCommandEvent& p_evt )
   78 {
   79     m_ldap->CloseSearch( Id );
   80     EndModal( wxID_CANCEL );
   81 }
   82 void SearchDlg::OnOpen( wxCommandEvent& p_evt )
   83 {
   84     EndModal( wxID_OK );
   85 }