1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_extensions.hxx" 26 #include "admininvokationpage.hxx" 27 #include "abspilot.hxx" 28 #include "admininvokationimpl.hxx" 29 30 //......................................................................... 31 namespace abp 32 { 33 //......................................................................... 34 35 //===================================================================== 36 //= AdminDialogInvokationPage 37 //===================================================================== AdminDialogInvokationPage(OAddessBookSourcePilot * _pParent)38 AdminDialogInvokationPage::AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent ) 39 :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_ADMININVOKATION)) 40 ,m_aExplanation (this, ModuleRes(FT_ADMINEXPLANATION)) 41 ,m_aInvokeAdminDialog (this, ModuleRes(PB_INVOKE_ADMIN_DIALOG)) 42 ,m_aErrorMessage (this, ModuleRes(FT_ERROR)) 43 ,m_bSuccessfullyExecutedDialog(sal_False) 44 { 45 FreeResource(); 46 47 m_aInvokeAdminDialog.SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) ); 48 } 49 50 //--------------------------------------------------------------------- ActivatePage()51 void AdminDialogInvokationPage::ActivatePage() 52 { 53 AddressBookSourcePage::ActivatePage(); 54 m_aInvokeAdminDialog.GrabFocus(); 55 } 56 57 //--------------------------------------------------------------------- implUpdateErrorMessage()58 void AdminDialogInvokationPage::implUpdateErrorMessage() 59 { 60 const sal_Bool bIsConnected = getDialog()->getDataSource().isConnected(); 61 m_aErrorMessage.Show( !bIsConnected ); 62 } 63 64 //--------------------------------------------------------------------- initializePage()65 void AdminDialogInvokationPage::initializePage() 66 { 67 AddressBookSourcePage::initializePage(); 68 m_aErrorMessage.Hide(); 69 // if we're entering this page, we assume we had no connection trial with this data source 70 } 71 72 //--------------------------------------------------------------------- implTryConnect()73 void AdminDialogInvokationPage::implTryConnect() 74 { 75 getDialog()->connectToDataSource( sal_True ); 76 77 // show our error message if and only if we could not connect 78 implUpdateErrorMessage(); 79 80 // the status of the next button may have changed 81 updateDialogTravelUI(); 82 83 // automatically go to the next page (if successfully connected) 84 if ( canAdvance() ) 85 getDialog()->travelNext(); 86 } 87 88 //--------------------------------------------------------------------- canAdvance() const89 bool AdminDialogInvokationPage::canAdvance() const 90 { 91 return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected(); 92 } 93 94 //--------------------------------------------------------------------- 95 IMPL_LINK( AdminDialogInvokationPage, OnInvokeAdminDialog, void*, /*NOTINTERESTEDIN*/ ) 96 { 97 OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() ); 98 if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) ) 99 { 100 // try to connect to this data source 101 implTryConnect(); 102 } 103 104 return 0L; 105 } 106 107 //......................................................................... 108 } // namespace abp 109 //......................................................................... 110 111