Branch data 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 : :
24 : : //.........................................................................
25 : : namespace abp
26 : : {
27 : : //.........................................................................
28 : :
29 : : //=====================================================================
30 : : //= AdminDialogInvokationPage
31 : : //=====================================================================
32 : 0 : AdminDialogInvokationPage::AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent )
33 : : :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_ADMININVOKATION))
34 : : ,m_aExplanation (this, ModuleRes(FT_ADMINEXPLANATION))
35 : : ,m_aInvokeAdminDialog (this, ModuleRes(PB_INVOKE_ADMIN_DIALOG))
36 : : ,m_aErrorMessage (this, ModuleRes(FT_ERROR))
37 : 0 : ,m_bSuccessfullyExecutedDialog(sal_False)
38 : : {
39 : 0 : FreeResource();
40 : :
41 : 0 : m_aInvokeAdminDialog.SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) );
42 : 0 : }
43 : :
44 : : //---------------------------------------------------------------------
45 : 0 : void AdminDialogInvokationPage::ActivatePage()
46 : : {
47 : 0 : AddressBookSourcePage::ActivatePage();
48 : 0 : m_aInvokeAdminDialog.GrabFocus();
49 : 0 : }
50 : :
51 : : //---------------------------------------------------------------------
52 : 0 : void AdminDialogInvokationPage::implUpdateErrorMessage()
53 : : {
54 : 0 : const sal_Bool bIsConnected = getDialog()->getDataSource().isConnected();
55 : 0 : m_aErrorMessage.Show( !bIsConnected );
56 : 0 : }
57 : :
58 : : //---------------------------------------------------------------------
59 : 0 : void AdminDialogInvokationPage::initializePage()
60 : : {
61 : 0 : AddressBookSourcePage::initializePage();
62 : 0 : m_aErrorMessage.Hide();
63 : : // if we're entering this page, we assume we had no connection trial with this data source
64 : 0 : }
65 : :
66 : : //---------------------------------------------------------------------
67 : 0 : void AdminDialogInvokationPage::implTryConnect()
68 : : {
69 : 0 : getDialog()->connectToDataSource( sal_True );
70 : :
71 : : // show our error message if and only if we could not connect
72 : 0 : implUpdateErrorMessage();
73 : :
74 : : // the status of the next button may have changed
75 : 0 : updateDialogTravelUI();
76 : :
77 : : // automatically go to the next page (if successfully connected)
78 : 0 : if ( canAdvance() )
79 : 0 : getDialog()->travelNext();
80 : 0 : }
81 : :
82 : : //---------------------------------------------------------------------
83 : 0 : bool AdminDialogInvokationPage::canAdvance() const
84 : : {
85 : 0 : return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected();
86 : : }
87 : :
88 : : //---------------------------------------------------------------------
89 : 0 : IMPL_LINK( AdminDialogInvokationPage, OnInvokeAdminDialog, void*, /*NOTINTERESTEDIN*/ )
90 : : {
91 : 0 : OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() );
92 : 0 : if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) )
93 : : {
94 : : // try to connect to this data source
95 : 0 : implTryConnect();
96 : : }
97 : :
98 : 0 : return 0L;
99 : : }
100 : :
101 : : //.........................................................................
102 : : } // namespace abp
103 : : //.........................................................................
104 : :
105 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|