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