bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / abpilot / admininvokationpage.cxx
blob39c0bde0f6e87b254c76f327e774a41656364446
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "admininvokationpage.hxx"
21 #include "abspilot.hxx"
22 #include "admininvokationimpl.hxx"
23 #include "comphelper/processfactory.hxx"
25 namespace abp
27 AdminDialogInvokationPage::AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent )
28 : AddressBookSourcePage(_pParent, "InvokeAdminPage",
29 "modules/sabpilot/ui/invokeadminpage.ui")
30 , m_bSuccessfullyExecutedDialog(false)
32 get(m_pInvokeAdminDialog, "settings");
33 get(m_pErrorMessage, "warning");
34 m_pInvokeAdminDialog->SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) );
36 AdminDialogInvokationPage::~AdminDialogInvokationPage()
38 disposeOnce();
40 void AdminDialogInvokationPage::dispose()
42 m_pInvokeAdminDialog.clear();
43 m_pErrorMessage.clear();
44 AddressBookSourcePage::dispose();
46 void AdminDialogInvokationPage::ActivatePage()
48 AddressBookSourcePage::ActivatePage();
49 m_pInvokeAdminDialog->GrabFocus();
52 void AdminDialogInvokationPage::implUpdateErrorMessage()
54 const bool bIsConnected = getDialog()->getDataSource().isConnected();
55 m_pErrorMessage->Show( !bIsConnected );
58 void AdminDialogInvokationPage::initializePage()
60 AddressBookSourcePage::initializePage();
61 m_pErrorMessage->Hide();
62 // if we're entering this page, we assume we had no connection trial with this data source
65 void AdminDialogInvokationPage::implTryConnect()
67 getDialog()->connectToDataSource( true );
69 // show our error message if and only if we could not connect
70 implUpdateErrorMessage();
72 // the status of the next button may have changed
73 updateDialogTravelUI();
75 // automatically go to the next page (if successfully connected)
76 if ( canAdvance() )
77 getDialog()->travelNext();
80 bool AdminDialogInvokationPage::canAdvance() const
82 return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected();
85 IMPL_LINK_NOARG( AdminDialogInvokationPage, OnInvokeAdminDialog )
87 OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() );
88 if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) )
90 // try to connect to this data source
91 implTryConnect();
94 return 0L;
97 } // namespace abp
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */