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 :
10 : #include "sdattr.hxx"
11 : #include "sdresid.hxx"
12 : #include "cusshow.hxx"
13 :
14 : #include "RemoteDialog.hxx"
15 : #include "RemoteServer.hxx"
16 :
17 : using namespace ::sd;
18 : using namespace ::std;
19 :
20 0 : RemoteDialog::RemoteDialog( vcl::Window *pWindow )
21 : : ModalDialog(pWindow, "RemoteDialog",
22 0 : "modules/simpress/ui/remotedialog.ui")
23 : {
24 0 : get(m_pButtonConnect, "connect");
25 0 : get(m_pButtonClose, "close");
26 0 : get(m_pClientBox, "tree");
27 :
28 0 : m_pButtonConnect->SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) );
29 0 : SetCloseHdl( LINK( this, RemoteDialog, CloseHdl ) );
30 0 : m_pButtonClose->SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) );
31 0 : }
32 :
33 0 : RemoteDialog::~RemoteDialog()
34 : {
35 0 : disposeOnce();
36 0 : }
37 :
38 0 : void RemoteDialog::dispose()
39 : {
40 0 : m_pButtonConnect.clear();
41 0 : m_pButtonClose.clear();
42 0 : m_pClientBox.clear();
43 0 : ModalDialog::dispose();
44 0 : }
45 :
46 0 : IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
47 : {
48 : // setBusy( true );
49 : // Fixme: Try and connect
50 : #if defined(ENABLE_SDREMOTE) && defined(ENABLE_SDREMOTE_BLUETOOTH)
51 0 : long aSelected = m_pClientBox->GetActiveEntryIndex();
52 0 : if ( aSelected < 0 )
53 0 : return 1;
54 0 : TClientBoxEntry aEntry = m_pClientBox->GetEntryData(aSelected);
55 0 : OUString aPin ( m_pClientBox->getPin() );
56 0 : if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) )
57 : {
58 0 : return CloseHdl( 0 );
59 : }
60 : else
61 : {
62 0 : return 1;
63 0 : }
64 : #else
65 : return 0;
66 : #endif
67 : }
68 :
69 0 : IMPL_LINK_NOARG( RemoteDialog, CloseHdl )
70 : {
71 : #ifdef ENABLE_SDREMOTE
72 0 : RemoteServer::restoreDiscoverable();
73 : #endif
74 0 : Close();
75 0 : return 0;
76 0 : }
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|