merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / abpilot / admininvokationpage.cxx
blob2e9d11430be2008f219ae1c79e5dc7d6d361a6d0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
30 #include "admininvokationpage.hxx"
31 #include "abspilot.hxx"
32 #include "admininvokationimpl.hxx"
34 //.........................................................................
35 namespace abp
37 //.........................................................................
39 //=====================================================================
40 //= AdminDialogInvokationPage
41 //=====================================================================
42 AdminDialogInvokationPage::AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent )
43 :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_ADMININVOKATION))
44 ,m_aExplanation (this, ModuleRes(FT_ADMINEXPLANATION))
45 ,m_aInvokeAdminDialog (this, ModuleRes(PB_INVOKE_ADMIN_DIALOG))
46 ,m_aErrorMessage (this, ModuleRes(FT_ERROR))
47 ,m_bSuccessfullyExecutedDialog(sal_False)
49 FreeResource();
51 m_aInvokeAdminDialog.SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) );
54 //---------------------------------------------------------------------
55 void AdminDialogInvokationPage::ActivatePage()
57 AddressBookSourcePage::ActivatePage();
58 m_aInvokeAdminDialog.GrabFocus();
61 //---------------------------------------------------------------------
62 void AdminDialogInvokationPage::implUpdateErrorMessage()
64 const sal_Bool bIsConnected = getDialog()->getDataSource().isConnected();
65 m_aErrorMessage.Show( !bIsConnected );
68 //---------------------------------------------------------------------
69 void AdminDialogInvokationPage::initializePage()
71 AddressBookSourcePage::initializePage();
72 m_aErrorMessage.Hide();
73 // if we're entering this page, we assume we had no connection trial with this data source
76 //---------------------------------------------------------------------
77 void AdminDialogInvokationPage::implTryConnect()
79 getDialog()->connectToDataSource( sal_True );
81 // show our error message if and only if we could not connect
82 implUpdateErrorMessage();
84 // the status of the next button may have changed
85 updateDialogTravelUI();
87 // automatically go to the next page (if successfully connected)
88 if ( canAdvance() )
89 getDialog()->travelNext();
92 //---------------------------------------------------------------------
93 bool AdminDialogInvokationPage::canAdvance() const
95 return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected();
98 //---------------------------------------------------------------------
99 IMPL_LINK( AdminDialogInvokationPage, OnInvokeAdminDialog, void*, /*NOTINTERESTEDIN*/ )
101 OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() );
102 if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) )
104 // try to connect to this data source
105 implTryConnect();
108 return 0L;
111 //.........................................................................
112 } // namespace abp
113 //.........................................................................