summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/source/ui/dlg/RemoteDialog.cxx15
-rw-r--r--sd/source/ui/dlg/RemoteDialogClientBox.cxx38
-rw-r--r--sd/source/ui/dlg/RemoteDialogClientBox.hxx13
3 files changed, 45 insertions, 21 deletions
diff --git a/sd/source/ui/dlg/RemoteDialog.cxx b/sd/source/ui/dlg/RemoteDialog.cxx
index 465febc5fba9..0df0f7070547 100644
--- a/sd/source/ui/dlg/RemoteDialog.cxx
+++ b/sd/source/ui/dlg/RemoteDialog.cxx
@@ -24,14 +24,14 @@ RemoteDialog::RemoteDialog( Window *pWindow ) :
mButtonCancel( this, SdResId( BTN_CANCEL ) ),
mClientBox( this, NULL, SdResId( LB_SERVERS ) )
{
- FreeResource();
+ FreeResource();
vector<ClientInfo*> aClients( RemoteServer::getClients() );
for ( vector<ClientInfo*>::const_iterator aIt( aClients.begin() );
aIt < aClients.end(); aIt++ )
{
- mClientBox.addEntry( **aIt );
+ mClientBox.addEntry( *aIt );
}
mButtonConnect.SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) );
@@ -46,8 +46,15 @@ IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
{
// setBusy( true );
// Fixme: Try and connect
-
- return 1;
+ long aSelected = mClientBox.GetActiveEntryIndex();
+ if ( aSelected < 0 )
+ return 1;
+ TClientBoxEntry aEntry = mClientBox.GetEntryData(aSelected);
+ OUString aPin = mClientBox.getPin();
+ if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) )
+ return 0;
+ else
+ return 1;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
index e8c9edcec445..11128f364da8 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
@@ -47,9 +47,9 @@ namespace sd {
//------------------------------------------------------------------------------
// struct ClientBoxEntry
//------------------------------------------------------------------------------
-ClientBoxEntry::ClientBoxEntry( const ClientInfo& rClientInfo ) :
+ClientBoxEntry::ClientBoxEntry( ClientInfo* pClientInfo ) :
m_bActive( false ),
- m_clientInfo( rClientInfo )
+ m_pClientInfo( pClientInfo )
{
}
@@ -232,6 +232,14 @@ void ClientBox::DeleteRemoved()
m_bInDelete = false;
}
+long ClientBox::GetActiveEntryIndex()
+{
+ if ( m_bHasActive )
+ return m_nActive;
+ else
+ return -1;
+}
+
//------------------------------------------------------------------------------
//This function may be called with nPos < 0
void ClientBox::selectEntry( const long nPos )
@@ -329,20 +337,20 @@ void ClientBox::DrawRow( const Rectangle& rRect, const TClientBoxEntry pEntry )
long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
- long aTitleWidth = GetTextWidth( String( pEntry->m_clientInfo.mName ) ) + (aTextHeight / 3);
+ long aTitleWidth = GetTextWidth( String( pEntry->m_pClientInfo->mName ) ) + (aTextHeight / 3);
aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
if ( aTitleWidth > nMaxTitleWidth )
{
aTitleWidth = nMaxTitleWidth - (aTextHeight / 3);
- String aShortTitle = GetEllipsisString( pEntry->m_clientInfo.mName,
+ String aShortTitle = GetEllipsisString( pEntry->m_pClientInfo->mName,
aTitleWidth );
DrawText( aPos, aShortTitle );
aTitleWidth += (aTextHeight / 3);
}
else
- DrawText( aPos, pEntry->m_clientInfo.mName );
+ DrawText( aPos, pEntry->m_pClientInfo->mName );
SetFont( aStdFont );
@@ -572,6 +580,11 @@ long ClientBox::PointToPos( const Point& rPos )
return nPos;
}
+OUString ClientBox::getPin()
+{
+ return m_aPinBox.GetText();
+}
+
//------------------------------------------------------------------------------
void ClientBox::MouseButtonDown( const MouseEvent& rMEvt )
{
@@ -632,13 +645,13 @@ long ClientBox::Notify( NotifyEvent& rNEvt )
//------------------------------------------------------------------------------
-long ClientBox::addEntry( const ClientInfo& rClientInfo )
+long ClientBox::addEntry( ClientInfo* pClientInfo )
{
long nPos = 0;
// PackageState eState = m_pManager->getPackageState( xPackage );
// bool bLocked = m_pManager->isReadOnly( xPackage );
- TClientBoxEntry pEntry( new ClientBoxEntry( rClientInfo ) );
+ TClientBoxEntry pEntry( new ClientBoxEntry( pClientInfo ) );
bool bNewEntryInserted = false;
@@ -665,7 +678,8 @@ long ClientBox::addEntry( const ClientInfo& rClientInfo )
//keep in sync with removeEventListener logic
if (bNewEntryInserted)
{
-// pEntry->m_xPackage->addEventListener(uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+
+ // pEntry->m_xPackage->addEventListener(uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
}
@@ -693,9 +707,9 @@ long ClientBox::addEntry( const ClientInfo& rClientInfo )
}
//------------------------------------------------------------------------------
-void ClientBox::updateEntry( const ClientInfo& rClientInfo )
+void ClientBox::updateEntry( const ClientInfo* pClientInfo )
{
- (void) rClientInfo;
+ (void) pClientInfo;
// typedef std::vector< TClientBoxEntry >::iterator ITER;
// for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
// {
@@ -724,9 +738,9 @@ void ClientBox::updateEntry( const ClientInfo& rClientInfo )
}
//------------------------------------------------------------------------------
-void ClientBox::removeEntry( const ClientInfo& rClientInfo )
+void ClientBox::removeEntry( const ClientInfo* pClientInfo )
{
- (void) rClientInfo;
+ (void) pClientInfo;
// if ( ! m_bInDelete )
// {
// ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
index c22af8774112..fd2b49e55ca0 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
@@ -65,10 +65,10 @@ typedef ::boost::shared_ptr< ClientBoxEntry > TClientBoxEntry;
struct ClientBoxEntry
{
bool m_bActive :1;
- ClientInfo m_clientInfo;
+ ClientInfo* m_pClientInfo;
- ClientBoxEntry( const ClientInfo& rClientInfo );
+ ClientBoxEntry( ClientInfo* pClientInfo );
~ClientBoxEntry();
};
@@ -167,6 +167,7 @@ public:
const Size GetMinOutputSizePixel() const;
void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
TClientBoxEntry GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
+ long GetActiveEntryIndex();
long GetEntryCount() { return (long) m_vEntries.size(); }
Rectangle GetEntryRect( const long nPos ) const;
bool HasActive() { return m_bHasActive; }
@@ -179,13 +180,15 @@ public:
//-----------------
void selectEntry( const long nPos );
- long addEntry( const ClientInfo& rClientInfo );
- void updateEntry( const ClientInfo& rPackageInfo );
- void removeEntry( const ClientInfo& rPackageInfo );
+ long addEntry( ClientInfo* pClientInfo );
+ void updateEntry( const ClientInfo* rPackageInfo );
+ void removeEntry( const ClientInfo* rPackageInfo );
void prepareChecking();
void checkEntries();
+ OUString getPin();
+
RemoteServer* getServer() const { return m_pServer; }
};