1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
26 AdminDialogInvokationPage::AdminDialogInvokationPage(weld::Container
* pPage
, OAddressBookSourcePilot
* pController
)
27 : AddressBookSourcePage(pPage
, pController
, "modules/sabpilot/ui/invokeadminpage.ui", "InvokeAdminPage")
28 , m_xInvokeAdminDialog(m_xBuilder
->weld_button("settings"))
29 , m_xErrorMessage(m_xBuilder
->weld_label("warning"))
31 m_xInvokeAdminDialog
->connect_clicked(LINK(this, AdminDialogInvokationPage
, OnInvokeAdminDialog
));
34 AdminDialogInvokationPage::~AdminDialogInvokationPage()
38 void AdminDialogInvokationPage::Activate()
40 AddressBookSourcePage::Activate();
41 m_xInvokeAdminDialog
->grab_focus();
44 void AdminDialogInvokationPage::implUpdateErrorMessage()
46 const bool bIsConnected
= getDialog()->getDataSource().isConnected();
47 m_xErrorMessage
->set_visible( !bIsConnected
);
50 void AdminDialogInvokationPage::initializePage()
52 AddressBookSourcePage::initializePage();
53 m_xErrorMessage
->hide();
54 // if we're entering this page, we assume we had no connection trial with this data source
57 void AdminDialogInvokationPage::implTryConnect()
59 getDialog()->connectToDataSource( true );
61 // show our error message if and only if we could not connect
62 implUpdateErrorMessage();
64 // the status of the next button may have changed
65 updateDialogTravelUI();
67 // automatically go to the next page (if successfully connected)
69 getDialog()->travelNext();
72 bool AdminDialogInvokationPage::canAdvance() const
74 return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected();
77 // davido: Do we need it?
78 IMPL_LINK_NOARG(AdminDialogInvokationPage
, OnInvokeAdminDialog
, weld::Button
&, void)
80 OAdminDialogInvokation
aInvokation(getORB(), getDialog()->getDataSource().getDataSource(), getDialog()->getDialog());
81 if ( aInvokation
.invokeAdministration() )
83 // try to connect to this data source
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */