Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "admininvokationpage.hxx"
21 : #include "abspilot.hxx"
22 : #include "admininvokationimpl.hxx"
23 : #include "comphelper/processfactory.hxx"
24 :
25 : //.........................................................................
26 : namespace abp
27 : {
28 : //.........................................................................
29 :
30 : //=====================================================================
31 : //= AdminDialogInvokationPage
32 : //=====================================================================
33 0 : AdminDialogInvokationPage::AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent )
34 : :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_ADMININVOKATION))
35 : ,m_aExplanation (this, ModuleRes(FT_ADMINEXPLANATION))
36 : ,m_aInvokeAdminDialog (this, ModuleRes(PB_INVOKE_ADMIN_DIALOG))
37 : ,m_aErrorMessage (this, ModuleRes(FT_ERROR))
38 0 : ,m_bSuccessfullyExecutedDialog(sal_False)
39 : {
40 0 : FreeResource();
41 :
42 0 : m_aInvokeAdminDialog.SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) );
43 0 : }
44 :
45 : //---------------------------------------------------------------------
46 0 : void AdminDialogInvokationPage::ActivatePage()
47 : {
48 0 : AddressBookSourcePage::ActivatePage();
49 0 : m_aInvokeAdminDialog.GrabFocus();
50 0 : }
51 :
52 : //---------------------------------------------------------------------
53 0 : void AdminDialogInvokationPage::implUpdateErrorMessage()
54 : {
55 0 : const sal_Bool bIsConnected = getDialog()->getDataSource().isConnected();
56 0 : m_aErrorMessage.Show( !bIsConnected );
57 0 : }
58 :
59 : //---------------------------------------------------------------------
60 0 : void AdminDialogInvokationPage::initializePage()
61 : {
62 0 : AddressBookSourcePage::initializePage();
63 0 : m_aErrorMessage.Hide();
64 : // if we're entering this page, we assume we had no connection trial with this data source
65 0 : }
66 :
67 : //---------------------------------------------------------------------
68 0 : void AdminDialogInvokationPage::implTryConnect()
69 : {
70 0 : getDialog()->connectToDataSource( sal_True );
71 :
72 : // show our error message if and only if we could not connect
73 0 : implUpdateErrorMessage();
74 :
75 : // the status of the next button may have changed
76 0 : updateDialogTravelUI();
77 :
78 : // automatically go to the next page (if successfully connected)
79 0 : if ( canAdvance() )
80 0 : getDialog()->travelNext();
81 0 : }
82 :
83 : //---------------------------------------------------------------------
84 0 : bool AdminDialogInvokationPage::canAdvance() const
85 : {
86 0 : return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected();
87 : }
88 :
89 : //---------------------------------------------------------------------
90 0 : IMPL_LINK( AdminDialogInvokationPage, OnInvokeAdminDialog, void*, /*NOTINTERESTEDIN*/ )
91 : {
92 0 : OAdminDialogInvokation aInvokation( comphelper::getComponentContext(getORB()), getDialog()->getDataSource().getDataSource(), getDialog() );
93 0 : if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) )
94 : {
95 : // try to connect to this data source
96 0 : implTryConnect();
97 : }
98 :
99 0 : return 0L;
100 : }
101 :
102 : //.........................................................................
103 : } // namespace abp
104 : //.........................................................................
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|