Kaydet (Commit) 9464775a authored tarafından Szymon Kłos's avatar Szymon Kłos

filter select handler

Change-Id: Iec362f7cf6540a5f312a9fdb4898c94433f68a9d
üst e8815046
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#define WB_MULTISELECTION 0x20000000L #define WB_MULTISELECTION 0x20000000L
#define FILTER_ALL "*.*"
enum SvtRemoteDlgMode enum SvtRemoteDlgMode
{ {
REMOTEDLG_MODE_OPEN = 0, REMOTEDLG_MODE_OPEN = 0,
...@@ -58,6 +60,8 @@ public: ...@@ -58,6 +60,8 @@ public:
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
void AddFilter( OUString sName, OUString sType );
private: private:
::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_context; ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_context;
...@@ -80,6 +84,7 @@ private: ...@@ -80,6 +84,7 @@ private:
VclPtr<Edit> m_pName_ed; VclPtr<Edit> m_pName_ed;
std::vector<ServicePtr> m_aServices; std::vector<ServicePtr> m_aServices;
std::vector<OUString> m_aFilters;
void FillServicesListbox(); void FillServicesListbox();
...@@ -98,6 +103,8 @@ private: ...@@ -98,6 +103,8 @@ private:
DECL_LINK( SelectHdl, void * ); DECL_LINK( SelectHdl, void * );
DECL_LINK( SplitHdl, void * ); DECL_LINK( SplitHdl, void * );
DECL_LINK( SelectFilterHdl, void * );
}; };
#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX #endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
......
...@@ -1128,6 +1128,12 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ...@@ -1128,6 +1128,12 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
void SfxApplication::OpenRemoteExec_Impl( SfxRequest& ) void SfxApplication::OpenRemoteExec_Impl( SfxRequest& )
{ {
ScopedVclPtrInstance< RemoteFilesDialog > aDlg((vcl::Window*)NULL, WB_OPEN); ScopedVclPtrInstance< RemoteFilesDialog > aDlg((vcl::Window*)NULL, WB_OPEN);
// Filters for test purposes
aDlg->AddFilter("All files", FILTER_ALL);
aDlg->AddFilter("ODT files", "*.odt");
aDlg->AddFilter("ODS files", "*.ods");
aDlg->Execute(); aDlg->Execute();
} }
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
#define FILTER_ALL "*.*"
class FileViewContainer : public vcl::Window class FileViewContainer : public vcl::Window
{ {
private: private:
...@@ -99,6 +97,11 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits) ...@@ -99,6 +97,11 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_bMultiselection = (nBits & WB_MULTISELECTION) ? true : false; m_bMultiselection = (nBits & WB_MULTISELECTION) ? true : false;
m_bIsUpdated = false; m_bIsUpdated = false;
m_pOpen_btn->Enable( false );
m_pSave_btn->Enable( false );
m_pFilter_lb->Enable( false );
m_pName_ed->Enable( false );
if(m_eMode == REMOTEDLG_MODE_OPEN) if(m_eMode == REMOTEDLG_MODE_OPEN)
{ {
m_pSave_btn->Hide(); m_pSave_btn->Hide();
...@@ -143,6 +146,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits) ...@@ -143,6 +146,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_pContainer->init(m_pFileView, m_pSplitter, m_pTreeView); m_pContainer->init(m_pFileView, m_pSplitter, m_pTreeView);
m_pContainer->Show(); m_pContainer->Show();
m_pContainer->Enable( false );
m_pAddService_btn->SetMenuMode(MENUBUTTON_MENUMODE_TIMED); m_pAddService_btn->SetMenuMode(MENUBUTTON_MENUMODE_TIMED);
m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) ); m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
...@@ -152,8 +156,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits) ...@@ -152,8 +156,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) ); m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );
m_pFilter_lb->InsertEntry(FILTER_ALL); m_pFilter_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectFilterHdl ) );
m_pFilter_lb->SelectEntryPos(0);
} }
RemoteFilesDialog::~RemoteFilesDialog() RemoteFilesDialog::~RemoteFilesDialog()
...@@ -261,11 +264,25 @@ int RemoteFilesDialog::GetSelectedServicePos() ...@@ -261,11 +264,25 @@ int RemoteFilesDialog::GetSelectedServicePos()
return nPos; return nPos;
} }
void RemoteFilesDialog::AddFilter( OUString sName, OUString sType )
{
m_aFilters.push_back( sType );
m_pFilter_lb->InsertEntry( sName );
if(m_pFilter_lb->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
m_pFilter_lb->SelectEntryPos( 0 );
}
OUString RemoteFilesDialog::getCurrentFilter() OUString RemoteFilesDialog::getCurrentFilter()
{ {
OUString sFilter; OUString sFilter;
sFilter = m_pFilter_lb->GetSelectEntry(); int nPos = m_pFilter_lb->GetSelectEntryPos();
if(nPos != LISTBOX_ENTRY_NOTFOUND)
sFilter = m_aFilters[nPos];
else
sFilter = FILTER_ALL;
return sFilter; return sFilter;
} }
...@@ -281,6 +298,13 @@ void RemoteFilesDialog::OpenURL( OUString sURL ) ...@@ -281,6 +298,13 @@ void RemoteFilesDialog::OpenURL( OUString sURL )
m_pFileView->EndInplaceEditing( false ); m_pFileView->EndInplaceEditing( false );
m_pPath_ed->SetText( sURL ); m_pPath_ed->SetText( sURL );
eResult = m_pFileView->Initialize( sURL, sFilter, NULL, BlackList ); eResult = m_pFileView->Initialize( sURL, sFilter, NULL, BlackList );
if( eResult == eSuccess )
{
m_pFilter_lb->Enable( true );
m_pName_ed->Enable( true );
m_pContainer->Enable( true );
}
} }
} }
...@@ -430,4 +454,14 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SplitHdl ) ...@@ -430,4 +454,14 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SplitHdl )
return 1; return 1;
} }
IMPL_LINK_NOARG ( RemoteFilesDialog, SelectFilterHdl )
{
OUString sCurrentURL = m_pFileView->GetViewURL();
if( !sCurrentURL.isEmpty() )
OpenURL( sCurrentURL );
return 1;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment