Branch data 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 "RemoteDialog.hrc"
16 : : #include "RemoteServer.hxx"
17 : :
18 : : using namespace ::sd;
19 : : using namespace ::std;
20 : :
21 : 0 : RemoteDialog::RemoteDialog( Window *pWindow ) :
22 : : ModalDialog( pWindow, SdResId( DLG_PAIR_REMOTE ) ),
23 : : mButtonConnect( this, SdResId( BTN_CONNECT ) ),
24 : : mButtonCancel( this, SdResId( BTN_CANCEL ) ),
25 : 0 : mClientBox( this, NULL, SdResId( LB_SERVERS ) )
26 : : {
27 : 0 : FreeResource();
28 : :
29 : 0 : vector<ClientInfo*> aClients( RemoteServer::getClients() );
30 : :
31 : 0 : for ( vector<ClientInfo*>::const_iterator aIt( aClients.begin() );
32 : 0 : aIt < aClients.end(); aIt++ )
33 : : {
34 : 0 : mClientBox.addEntry( *aIt );
35 : : }
36 : :
37 : 0 : mButtonConnect.SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) );
38 : 0 : }
39 : :
40 : 0 : RemoteDialog::~RemoteDialog()
41 : : {
42 : 0 : }
43 : :
44 : : // -----------------------------------------------------------------------
45 : 0 : IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
46 : : {
47 : : // setBusy( true );
48 : : // Fixme: Try and connect
49 : 0 : long aSelected = mClientBox.GetActiveEntryIndex();
50 : 0 : if ( aSelected < 0 )
51 : 0 : return 1;
52 : 0 : TClientBoxEntry aEntry = mClientBox.GetEntryData(aSelected);
53 : 0 : OUString aPin ( mClientBox.getPin() );
54 : 0 : if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) )
55 : : {
56 : 0 : Close();
57 : 0 : return 0;
58 : : }
59 : : else
60 : 0 : return 1;
61 : : }
62 : :
63 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|