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( 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 : #ifdef ENABLE_SDREMOTE
29 0 : RemoteServer::ensureDiscoverable();
30 :
31 0 : vector<ClientInfo*> aClients( RemoteServer::getClients() );
32 :
33 0 : const vector<ClientInfo*>::const_iterator aEnd( aClients.end() );
34 :
35 0 : for ( vector<ClientInfo*>::const_iterator aIt( aClients.begin() );
36 : aIt != aEnd; ++aIt )
37 : {
38 0 : m_pClientBox->addEntry( *aIt );
39 : }
40 : #endif
41 :
42 0 : m_pButtonConnect->SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) );
43 0 : SetCloseHdl( LINK( this, RemoteDialog, CloseHdl ) );
44 0 : m_pButtonClose->SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) );
45 0 : }
46 :
47 0 : IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
48 : {
49 : // setBusy( true );
50 : // Fixme: Try and connect
51 : #if defined(ENABLE_SDREMOTE) && defined(ENABLE_SDREMOTE_BLUETOOTH)
52 0 : long aSelected = m_pClientBox->GetActiveEntryIndex();
53 0 : if ( aSelected < 0 )
54 0 : return 1;
55 0 : TClientBoxEntry aEntry = m_pClientBox->GetEntryData(aSelected);
56 0 : OUString aPin ( m_pClientBox->getPin() );
57 0 : if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) )
58 : {
59 0 : return CloseHdl( 0 );
60 : }
61 : else
62 : {
63 0 : return 1;
64 0 : }
65 : #else
66 : return 0;
67 : #endif
68 : }
69 :
70 0 : IMPL_LINK_NOARG( RemoteDialog, CloseHdl )
71 : {
72 : #ifdef ENABLE_SDREMOTE
73 0 : RemoteServer::restoreDiscoverable();
74 : #endif
75 0 : Close();
76 0 : return 0;
77 : }
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|