[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - include/svtools sfx2/source svtools/source
Szymon Kłos
eszkadev at gmail.com
Fri Jun 5 09:16:38 PDT 2015
include/svtools/RemoteFilesDialog.hxx | 7 ++++
sfx2/source/appl/appopen.cxx | 6 +++
svtools/source/dialogs/RemoteFilesDialog.cxx | 44 +++++++++++++++++++++++----
3 files changed, 52 insertions(+), 5 deletions(-)
New commits:
commit 4c43d84b8e65bcb633e258ba6d3f1408c1878ffc
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Fri Jun 5 17:40:40 2015 +0200
filter select handler
Change-Id: Iec362f7cf6540a5f312a9fdb4898c94433f68a9d
diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index aac99ba..e831a32 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -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
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 44f9b97..f1a4677 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -1124,6 +1124,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();
}
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 5976ea6..1c32612 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -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: */
More information about the Libreoffice-commits
mailing list