fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / dlg / RemoteDialog.cxx
blob8aec838a4f3f7e3da1ab09c1cfa3c487f78b2ed8
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 "sdattr.hxx"
11 #include "sdresid.hxx"
12 #include "cusshow.hxx"
14 #include "RemoteDialog.hxx"
15 #include "RemoteDialog.hrc"
16 #include "RemoteServer.hxx"
18 using namespace ::sd;
19 using namespace ::std;
21 RemoteDialog::RemoteDialog( Window *pWindow ) :
22 ModalDialog( pWindow, SdResId( DLG_PAIR_REMOTE ) ),
23 mButtonConnect( this, SdResId( BTN_CONNECT ) ),
24 mButtonCancel( this, SdResId( BTN_CANCEL ) ),
25 mClientBox( this, NULL, SdResId( LB_SERVERS ) )
27 FreeResource();
29 #ifdef ENABLE_SDREMOTE
30 RemoteServer::ensureDiscoverable();
32 vector<ClientInfo*> aClients( RemoteServer::getClients() );
34 const vector<ClientInfo*>::const_iterator aEnd( aClients.end() );
36 for ( vector<ClientInfo*>::const_iterator aIt( aClients.begin() );
37 aIt != aEnd; ++aIt )
39 mClientBox.addEntry( *aIt );
41 #endif
43 mButtonConnect.SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) );
44 SetCloseHdl( LINK( this, RemoteDialog, CloseHdl ) );
45 mButtonCancel.SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) );
48 RemoteDialog::~RemoteDialog()
52 // -----------------------------------------------------------------------
53 IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
55 // setBusy( true );
56 // Fixme: Try and connect
57 #if defined(ENABLE_SDREMOTE) && defined(ENABLE_SDREMOTE_BLUETOOTH)
58 long aSelected = mClientBox.GetActiveEntryIndex();
59 if ( aSelected < 0 )
60 return 1;
61 TClientBoxEntry aEntry = mClientBox.GetEntryData(aSelected);
62 OUString aPin ( mClientBox.getPin() );
63 if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) )
65 return CloseHdl( 0 );
67 else
69 return 1;
71 #else
72 return 0;
73 #endif
76 IMPL_LINK_NOARG( RemoteDialog, CloseHdl )
78 #ifdef ENABLE_SDREMOTE
79 RemoteServer::restoreDiscoverable();
80 #endif
81 Close();
82 return 0;
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */