Revert "tdf#158280 Replace usage of InputDialog with SvxNameDialog"
[LibreOffice.git] / sd / source / ui / dlg / RemoteDialog.cxx
blob948d2a0e77f8085cfa12ce23c8266b7626dce764
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/.
8 */
10 #include "RemoteDialog.hxx"
11 #include <RemoteServer.hxx>
13 using namespace ::sd;
15 RemoteDialog::RemoteDialog(weld::Window* pWindow)
16 : GenericDialogController(pWindow, u"modules/simpress/ui/remotedialog.ui"_ustr,
17 u"RemoteDialog"_ustr)
18 , m_xButtonConnect(m_xBuilder->weld_button(u"ok"_ustr))
19 , m_xClientBox(new sd::ClientBox(m_xBuilder->weld_scrolled_window(u"scroll"_ustr),
20 m_xBuilder->weld_container(u"tree"_ustr)))
22 m_xButtonConnect->connect_clicked(LINK(this, RemoteDialog, HandleConnectButton));
25 RemoteDialog::~RemoteDialog() {}
27 IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton, weld::Button&, void)
29 weld::WaitObject(m_xDialog.get());
30 #if defined(ENABLE_SDREMOTE)
31 auto xEntry = m_xClientBox->GetActiveEntry();
32 if (!xEntry)
33 return;
34 OUString aPin = xEntry->m_xPinBox->get_text();
35 if (IPRemoteServer::connectClient(xEntry->m_xClientInfo, aPin))
36 m_xDialog->response(RET_OK);
37 #endif
40 short RemoteDialog::run()
42 short nRet = weld::GenericDialogController::run();
43 #ifdef ENABLE_SDREMOTE
44 RemoteServer::restoreDiscoverable();
45 #endif
46 return nRet;
49 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */