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 @@
#define WB_MULTISELECTION 0x20000000L
#define FILTER_ALL "*.*"
enum SvtRemoteDlgMode
{
REMOTEDLG_MODE_OPEN = 0,
......@@ -58,6 +60,8 @@ public:
virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
void AddFilter( OUString sName, OUString sType );
private:
::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_context;
......@@ -80,6 +84,7 @@ private:
VclPtr<Edit> m_pName_ed;
std::vector<ServicePtr> m_aServices;
std::vector<OUString> m_aFilters;
void FillServicesListbox();
......@@ -98,6 +103,8 @@ private:
DECL_LINK( SelectHdl, void * );
DECL_LINK( SplitHdl, void * );
DECL_LINK( SelectFilterHdl, void * );
};
#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
......
......@@ -1128,6 +1128,12 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
void SfxApplication::OpenRemoteExec_Impl( SfxRequest& )
{
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();
}
......
......@@ -11,8 +11,6 @@
using namespace ::com::sun::star::uno;
#define FILTER_ALL "*.*"
class FileViewContainer : public vcl::Window
{
private:
......@@ -99,6 +97,11 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_bMultiselection = (nBits & WB_MULTISELECTION) ? true : 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)
{
m_pSave_btn->Hide();
......@@ -143,6 +146,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_pContainer->init(m_pFileView, m_pSplitter, m_pTreeView);
m_pContainer->Show();
m_pContainer->Enable( false );
m_pAddService_btn->SetMenuMode(MENUBUTTON_MENUMODE_TIMED);
m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
......@@ -152,8 +156,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );
m_pFilter_lb->InsertEntry(FILTER_ALL);
m_pFilter_lb->SelectEntryPos(0);
m_pFilter_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectFilterHdl ) );
}
RemoteFilesDialog::~RemoteFilesDialog()
......@@ -261,11 +264,25 @@ int RemoteFilesDialog::GetSelectedServicePos()
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 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;
}
......@@ -281,6 +298,13 @@ void RemoteFilesDialog::OpenURL( OUString sURL )
m_pFileView->EndInplaceEditing( false );
m_pPath_ed->SetText( sURL );
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 )
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: */
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