bump product version to 6.3.0.0.beta1
[LibreOffice.git] / extensions / source / abpilot / admininvokationpage.cxx
blob4cd97989a10891ccd108f1f6e2f1d2bba58e2ddc
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"
24 namespace abp
26 AdminDialogInvokationPage::AdminDialogInvokationPage( OAddressBookSourcePilot* _pParent )
27 : AddressBookSourcePage(_pParent, "InvokeAdminPage",
28 "modules/sabpilot/ui/invokeadminpage.ui")
30 get(m_pInvokeAdminDialog, "settings");
31 get(m_pErrorMessage, "warning");
32 m_pInvokeAdminDialog->SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) );
34 AdminDialogInvokationPage::~AdminDialogInvokationPage()
36 disposeOnce();
38 void AdminDialogInvokationPage::dispose()
40 m_pInvokeAdminDialog.clear();
41 m_pErrorMessage.clear();
42 AddressBookSourcePage::dispose();
44 void AdminDialogInvokationPage::ActivatePage()
46 AddressBookSourcePage::ActivatePage();
47 m_pInvokeAdminDialog->GrabFocus();
50 void AdminDialogInvokationPage::implUpdateErrorMessage()
52 const bool bIsConnected = getDialog()->getDataSource().isConnected();
53 m_pErrorMessage->Show( !bIsConnected );
56 void AdminDialogInvokationPage::initializePage()
58 AddressBookSourcePage::initializePage();
59 m_pErrorMessage->Hide();
60 // if we're entering this page, we assume we had no connection trial with this data source
63 void AdminDialogInvokationPage::implTryConnect()
65 getDialog()->connectToDataSource( true );
67 // show our error message if and only if we could not connect
68 implUpdateErrorMessage();
70 // the status of the next button may have changed
71 updateDialogTravelUI();
73 // automatically go to the next page (if successfully connected)
74 if ( canAdvance() )
75 getDialog()->travelNext();
78 bool AdminDialogInvokationPage::canAdvance() const
80 return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected();
83 // davido: Do we need it?
84 IMPL_LINK_NOARG( AdminDialogInvokationPage, OnInvokeAdminDialog, Button*, void )
86 OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() );
87 if ( aInvokation.invokeAdministration() )
89 // try to connect to this data source
90 implTryConnect();
94 } // namespace abp
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */