From 2c6ffb2c758f70e7259f8285703c22d32f47f7ab Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Fri, 24 Jul 2015 09:39:09 +0200 Subject: don't show edit/delete menu when there is no service Change-Id: Ia53c9e3f6a4bcaab5e68fbbff6d2ec8cfe5cd702 --- fpicker/source/office/RemoteFilesDialog.cxx | 7 +++++++ fpicker/source/office/RemoteFilesDialog.hxx | 1 + 2 files changed, 8 insertions(+) diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index ab11f2f85119..a810ff8312cc 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -176,6 +176,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) , m_pSplitter( NULL ) , m_pFileView( NULL ) , m_pContainer( NULL ) + , m_pAddMenu( NULL ) { get( m_pCancel_btn, "cancel" ); get( m_pAddService_btn, "add_service_btn" ); @@ -252,6 +253,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) m_pName_ed->SetModifyHdl( LINK( this, RemoteFilesDialog, FileNameModifyHdl ) ); m_pAddService_btn->SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); + m_pAddMenu = m_pAddService_btn->GetPopupMenu(); m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) ); m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) ); @@ -413,7 +415,10 @@ void RemoteFilesDialog::FillServicesListbox() if( m_pServices_lb->GetEntryCount() > 0 ) { m_pServices_lb->SelectEntryPos( nPos ); + m_pAddService_btn->SetPopupMenu( m_pAddMenu ); } + else + m_pAddService_btn->SetPopupMenu( NULL ); EnableControls(); } @@ -588,6 +593,7 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) m_pServices_lb->InsertEntry( sPrefix + newService->GetName() ); m_pServices_lb->SelectEntryPos( m_pServices_lb->GetEntryCount() - 1 ); + m_pAddService_btn->SetPopupMenu( m_pAddMenu ); SelectServiceHdl( NULL ); m_bIsUpdated = true; @@ -682,6 +688,7 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, else { m_pServices_lb->SetNoSelection(); + m_pAddService_btn->SetPopupMenu( NULL ); } m_bIsUpdated = true; diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index a62b4cf447f5..63fbd94ba090 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -144,6 +144,7 @@ private: VclPtr< FileViewContainer > m_pContainer; VclPtr< ListBox > m_pFilter_lb; VclPtr< Edit > m_pName_ed; + PopupMenu* m_pAddMenu; std::vector< ServicePtr > m_aServices; std::vector< std::pair< OUString, OUString > > m_aFilters; -- cgit