2012-08-07 18:03:23 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sdattr.hxx"
|
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include "cusshow.hxx"
|
|
|
|
|
|
|
|
#include "RemoteDialog.hxx"
|
2012-08-10 13:27:40 +02:00
|
|
|
#include "RemoteServer.hxx"
|
2012-08-07 18:03:23 +02:00
|
|
|
|
2012-08-10 13:27:40 +02:00
|
|
|
using namespace ::sd;
|
|
|
|
using namespace ::std;
|
2012-08-08 11:42:58 +02:00
|
|
|
|
2013-11-15 10:26:19 +00:00
|
|
|
RemoteDialog::RemoteDialog( Window *pWindow )
|
|
|
|
: ModalDialog(pWindow, "RemoteDialog",
|
|
|
|
"modules/simpress/ui/remotedialog.ui")
|
2012-08-07 18:03:23 +02:00
|
|
|
{
|
2013-11-15 10:26:19 +00:00
|
|
|
get(m_pButtonConnect, "connect");
|
|
|
|
get(m_pButtonClose, "close");
|
|
|
|
get(m_pClientBox, "tree");
|
2012-08-10 13:27:40 +02:00
|
|
|
|
2013-11-15 10:26:19 +00:00
|
|
|
m_pButtonConnect->SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) );
|
2012-09-18 18:22:12 +02:00
|
|
|
SetCloseHdl( LINK( this, RemoteDialog, CloseHdl ) );
|
2013-11-15 10:26:19 +00:00
|
|
|
m_pButtonClose->SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) );
|
2012-08-07 18:03:23 +02:00
|
|
|
}
|
|
|
|
|
2012-08-10 13:27:40 +02:00
|
|
|
IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
|
|
|
|
{
|
|
|
|
// setBusy( true );
|
|
|
|
// Fixme: Try and connect
|
2012-11-16 00:00:58 +01:00
|
|
|
#if defined(ENABLE_SDREMOTE) && defined(ENABLE_SDREMOTE_BLUETOOTH)
|
2013-11-15 10:26:19 +00:00
|
|
|
long aSelected = m_pClientBox->GetActiveEntryIndex();
|
2012-08-13 16:09:46 +02:00
|
|
|
if ( aSelected < 0 )
|
|
|
|
return 1;
|
2013-11-15 10:26:19 +00:00
|
|
|
TClientBoxEntry aEntry = m_pClientBox->GetEntryData(aSelected);
|
|
|
|
OUString aPin ( m_pClientBox->getPin() );
|
2012-08-13 16:09:46 +02:00
|
|
|
if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) )
|
2012-08-13 21:39:12 +02:00
|
|
|
{
|
2012-09-18 18:22:12 +02:00
|
|
|
return CloseHdl( 0 );
|
2012-08-13 21:39:12 +02:00
|
|
|
}
|
2012-08-13 16:09:46 +02:00
|
|
|
else
|
2012-12-05 15:46:28 +01:00
|
|
|
{
|
2012-08-13 16:09:46 +02:00
|
|
|
return 1;
|
2012-12-05 15:46:28 +01:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
return 0;
|
2012-09-18 20:24:02 +02:00
|
|
|
#endif
|
2012-08-10 13:27:40 +02:00
|
|
|
}
|
|
|
|
|
2012-09-18 18:22:12 +02:00
|
|
|
IMPL_LINK_NOARG( RemoteDialog, CloseHdl )
|
|
|
|
{
|
2013-03-01 15:54:52 -05:00
|
|
|
#ifdef ENABLE_SDREMOTE
|
2013-02-18 09:24:23 +00:00
|
|
|
RemoteServer::restoreDiscoverable();
|
2013-03-01 15:54:52 -05:00
|
|
|
#endif
|
2013-02-06 17:21:41 +00:00
|
|
|
Close();
|
2012-09-18 20:36:30 +02:00
|
|
|
return 0;
|
2012-09-18 18:22:12 +02:00
|
|
|
}
|
|
|
|
|
2012-09-19 09:18:06 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|