diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-09-18 18:22:12 +0200 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-09-18 18:22:37 +0200 |
commit | 64d1fcb11f4915df960ec81bc9168a557199090f (patch) | |
tree | 432a75871ebd631a6c7ba76cef94912ff4819fc7 /sd/source/ui/dlg | |
parent | 6c1b61b0292359304863cd6e593b8f5d7a2cb94a (diff) |
Switch bluetooth discoverability on when remote dialog shown (Linux).
Change-Id: Ie0e4f7a353d77f5312deea06f0a316d8e1b1ed47
Diffstat (limited to 'sd/source/ui/dlg')
-rw-r--r-- | sd/source/ui/dlg/RemoteDialog.cxx | 22 | ||||
-rw-r--r-- | sd/source/ui/dlg/RemoteDialog.hxx | 3 |
2 files changed, 22 insertions, 3 deletions
diff --git a/sd/source/ui/dlg/RemoteDialog.cxx b/sd/source/ui/dlg/RemoteDialog.cxx index d920d91c0527..28b41589904b 100644 --- a/sd/source/ui/dlg/RemoteDialog.cxx +++ b/sd/source/ui/dlg/RemoteDialog.cxx @@ -22,10 +22,15 @@ RemoteDialog::RemoteDialog( Window *pWindow ) : ModalDialog( pWindow, SdResId( DLG_PAIR_REMOTE ) ), mButtonConnect( this, SdResId( BTN_CONNECT ) ), mButtonCancel( this, SdResId( BTN_CANCEL ) ), - mClientBox( this, NULL, SdResId( LB_SERVERS ) ) + mClientBox( this, NULL, SdResId( LB_SERVERS ) ), + mPreviouslyDiscoverable() { FreeResource(); + mPreviouslyDiscoverable = RemoteServer::isBluetoothDiscoverable(); + if ( !mPreviouslyDiscoverable ) + RemoteServer::setBluetoothDiscoverable( true ); + vector<ClientInfo*> aClients( RemoteServer::getClients() ); for ( vector<ClientInfo*>::const_iterator aIt( aClients.begin() ); @@ -35,6 +40,8 @@ RemoteDialog::RemoteDialog( Window *pWindow ) : } mButtonConnect.SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) ); + SetCloseHdl( LINK( this, RemoteDialog, CloseHdl ) ); + mButtonCancel.SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) ); } RemoteDialog::~RemoteDialog() @@ -53,11 +60,20 @@ IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton) OUString aPin ( mClientBox.getPin() ); if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) ) { - Close(); - return 0; + return CloseHdl( 0 ); } else return 1; } +IMPL_LINK_NOARG( RemoteDialog, CloseHdl ) +{ + if ( !mPreviouslyDiscoverable ) + { + RemoteServer::setBluetoothDiscoverable( false ); + } + Close(); + return 0; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/sd/source/ui/dlg/RemoteDialog.hxx b/sd/source/ui/dlg/RemoteDialog.hxx index 87782a68c269..ef1cf58b2222 100644 --- a/sd/source/ui/dlg/RemoteDialog.hxx +++ b/sd/source/ui/dlg/RemoteDialog.hxx @@ -27,8 +27,11 @@ private: OKButton mButtonConnect; CancelButton mButtonCancel; ClientBox mClientBox; + // Whether discoverability was enabled befor the dialog started. + bool mPreviouslyDiscoverable; DECL_DLLPRIVATE_LINK( HandleConnectButton, void * ); + DECL_LINK( CloseHdl, void * ); public: RemoteDialog( Window* pWindow ); ~RemoteDialog(); |