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