summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-07-09 13:03:35 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-07-16 09:53:38 +0200
commit1fbe4809e07d9ef3b38116368012451ca773e16c (patch)
treea64bcf7e860d54368ae25c08eb7951c96dcfdfe1 /svtools
parent37928c2a5e7dce68f2027b1a6a47d85f2dc0d533 (diff)
RemoteFilesDialog: enable controls in one place
Change-Id: I21aab300a71c96308bc335ea4ac641f02ec2a4fc
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/dialogs/RemoteFilesDialog.cxx56
1 files changed, 39 insertions, 17 deletions
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 069973b642f2..129dcee1dd6c 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -250,6 +250,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
m_eType = ( nBits & WB_PATH ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
m_bMultiselection = ( nBits & SFXWB_MULTISELECTION ) ? true : false;
m_bIsUpdated = false;
+ m_bIsConnected = false;
m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND;
m_pFilter_lb->Enable( false );
@@ -442,8 +443,8 @@ void RemoteFilesDialog::FillServicesListbox()
if( m_pServices_lb->GetEntryCount() > 0 )
m_pServices_lb->SelectEntryPos( 0 );
- else
- m_pServices_lb->Enable( false );
+
+ EnableControls();
}
int RemoteFilesDialog::GetSelectedServicePos()
@@ -502,18 +503,42 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
{
m_pPath->SetURL( sURL );
m_pTreeView->SetTreePath( sURL );
- m_pFilter_lb->Enable( true );
- m_pName_ed->Enable( true );
- m_pContainer->Enable( true );
- if( !m_pName_ed->GetText().isEmpty() )
- m_pOk_btn->Enable( true );
+ m_bIsConnected = true;
+ EnableControls();
}
}
return eResult;
}
+void RemoteFilesDialog::EnableControls()
+{
+ if( m_pServices_lb->GetEntryCount() > 0 )
+ m_pServices_lb->Enable( true );
+ else
+ m_pServices_lb->Enable( false );
+
+ if( m_bIsConnected )
+ {
+ m_pFilter_lb->Enable( true );
+ m_pName_ed->Enable( true );
+ m_pContainer->Enable( true );
+
+ if( !m_pName_ed->GetText().isEmpty() )
+ m_pOk_btn->Enable( true );
+ else
+ m_pOk_btn->Enable( false );
+ }
+ else
+ {
+ m_pFilter_lb->Enable( false );
+ m_pName_ed->Enable( false );
+ m_pContainer->Enable( false );
+ m_pOk_btn->Enable( false );
+ }
+}
+
IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
{
ScopedVclPtrInstance< PlaceEditDialog > aDlg( this );
@@ -525,7 +550,6 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
{
ServicePtr newService = aDlg->GetPlace();
m_aServices.push_back( newService );
- m_pServices_lb->Enable( true );
OUString sPrefix = lcl_GetServiceType( newService );
@@ -536,6 +560,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
m_pServices_lb->SelectEntryPos( m_pServices_lb->GetEntryCount() - 1 );
m_bIsUpdated = true;
+
+ EnableControls();
break;
}
case RET_CANCEL :
@@ -625,12 +651,13 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
else
{
m_pServices_lb->SetNoSelection();
- m_pServices_lb->Enable( false );
}
m_bIsUpdated = true;
}
}
+
+ EnableControls();
}
IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl )
@@ -664,16 +691,15 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
m_sPath = pData->maURL;
m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) );
-
- m_pOk_btn->Enable( true );
}
else
{
- m_pOk_btn->Enable( false );
m_sPath = "";
m_pName_ed->SetText( "" );
}
+ EnableControls();
+
return 1;
}
@@ -686,11 +712,7 @@ IMPL_LINK_NOARG( RemoteFilesDialog, FileNameGetFocusHdl )
IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl )
{
m_pFileView->SetNoSelection();
-
- if( !m_pName_ed->GetText().isEmpty() )
- m_pOk_btn->Enable( true );
- else
- m_pOk_btn->Enable( false );
+ EnableControls();
return 1;
}