[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - include/svtools svtools/source
Szymon Kłos
eszkadev at gmail.com
Wed Jul 1 01:11:49 PDT 2015
include/svtools/RemoteFilesDialog.hxx | 10 +-
svtools/source/dialogs/RemoteFilesDialog.cxx | 111 +++++++++++++++------------
2 files changed, 71 insertions(+), 50 deletions(-)
New commits:
commit 21535813b51d648cd6213fa5a6643a0c4d0a55e9
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Wed Jul 1 10:08:07 2015 +0200
RemoteFilesDialog: some implementations of methods
Change-Id: Iafc9d0f56598bed8a3c1ed86a807dc035c1525b7
diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index c8f606b..20f8bde 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -103,7 +103,7 @@ public:
virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier );
- virtual void EnableAutocompletion( bool _bEnable = true );
+ virtual void EnableAutocompletion( bool );
virtual sal_Int32 getTargetColorDepth();
virtual sal_Int32 getAvailableWidth();
@@ -127,6 +127,10 @@ private:
Image m_aFolderImage;
OUString m_sPath;
+ unsigned int m_nCurrentFilter;
+
+ ::com::sun::star::uno::Sequence< OUString > m_aBlackList;
+ ::svt::IFilePickerListener* m_pFileNotifier;
VclPtr< PushButton > m_pOpen_btn;
VclPtr< PushButton > m_pSave_btn;
@@ -142,15 +146,13 @@ private:
VclPtr< Edit > m_pName_ed;
std::vector< ServicePtr > m_aServices;
- std::vector< OUString > m_aFilters;
+ std::vector< std::pair< OUString, OUString > > m_aFilters;
void FillServicesListbox();
/* If failure returns < 0 */
int GetSelectedServicePos();
- OUString GetCurrentFilter();
-
FileViewResult OpenURL( OUString sURL );
DECL_LINK ( AddServiceHdl, void * );
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index ef66da6..821b99c 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -247,6 +247,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
m_eType = ( nBits & WB_PATH ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
m_bMultiselection = ( nBits & WB_MULTISELECTION ) ? true : false;
m_bIsUpdated = false;
+ m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND;
m_pOpen_btn->Enable( false );
m_pSave_btn->Enable( false );
@@ -469,8 +470,13 @@ int RemoteFilesDialog::GetSelectedServicePos()
void RemoteFilesDialog::AddFilter( const OUString& rFilter, const OUString& rType )
{
- m_aFilters.push_back( rType );
- m_pFilter_lb->InsertEntry( rFilter );
+ OUString sName = rFilter;
+
+ if ( rType.isEmpty() )
+ sName = "------------------------------------------";
+
+ m_aFilters.push_back( std::pair< OUString, OUString >( rFilter, rType ) );
+ m_pFilter_lb->InsertEntry( sName );
if( m_pFilter_lb->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
m_pFilter_lb->SelectEntryPos( 0 );
@@ -481,20 +487,6 @@ OUString RemoteFilesDialog::GetPath() const
return m_sPath;
}
-OUString RemoteFilesDialog::GetCurrentFilter()
-{
- OUString sFilter;
-
- int nPos = m_pFilter_lb->GetSelectEntryPos();
-
- if( nPos != LISTBOX_ENTRY_NOTFOUND )
- sFilter = m_aFilters[nPos];
- else
- sFilter = FILTER_ALL;
-
- return sFilter;
-}
-
FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
{
FileViewResult eResult = eFailure;
@@ -502,7 +494,7 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
if( m_pFileView )
{
OUStringList BlackList;
- OUString sFilter = GetCurrentFilter();
+ OUString sFilter = GetCurFilter();
m_pFileView->EndInplaceEditing( false );
eResult = m_pFileView->Initialize( sURL, sFilter, NULL, BlackList );
@@ -709,10 +701,17 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SplitHdl )
IMPL_LINK_NOARG ( RemoteFilesDialog, SelectFilterHdl )
{
- OUString sCurrentURL = m_pFileView->GetViewURL();
+ unsigned int nPos = m_pFilter_lb->GetSelectEntryPos();
- if( !sCurrentURL.isEmpty() )
- OpenURL( sCurrentURL );
+ if( nPos != LISTBOX_ENTRY_NOTFOUND && !m_aFilters[nPos].second.isEmpty() )
+ {
+ m_nCurrentFilter = nPos;
+
+ OUString sCurrentURL = m_pFileView->GetViewURL();
+
+ if( !sCurrentURL.isEmpty() )
+ OpenURL( sCurrentURL );
+ }
return 1;
}
@@ -757,14 +756,12 @@ void RemoteFilesDialog::SetHasFilename( bool bHasFilename )
void RemoteFilesDialog::SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList )
{
- // TODO
+ m_aBlackList = rBlackList;
}
const ::com::sun::star::uno::Sequence< OUString >& RemoteFilesDialog::GetBlackList() const
{
- // TODO
- ::com::sun::star::uno::Sequence< OUString > aSequence( 0 );
- return aSequence;
+ return m_aBlackList;
}
void RemoteFilesDialog::SetStandardDir( const OUString& rStdDir )
@@ -794,19 +791,53 @@ void RemoteFilesDialog::AddFilterGroup(
AddFilter( pSubFilters->First, pSubFilters->Second );
}
+OUString RemoteFilesDialog::GetCurFilter() const
+{
+ OUString sFilter;
+
+ if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND )
+ {
+ sFilter = m_aFilters[m_nCurrentFilter].second;
+ }
+ else
+ {
+ sFilter = FILTER_ALL;
+ }
+
+ return sFilter;
+}
+
+OUString RemoteFilesDialog::getCurFilter( ) const
+{
+ return GetCurFilter();
+}
+
void RemoteFilesDialog::SetCurFilter( const OUString& rFilter )
{
- // TODO
+ DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" );
+
+ // look for corresponding filter
+ sal_uInt16 nPos = m_aFilters.size();
+
+ while ( nPos-- )
+ {
+ if ( m_aFilters[nPos].first == rFilter )
+ {
+ m_nCurrentFilter = nPos;
+ m_pFilter_lb->SelectEntryPos( m_nCurrentFilter );
+ break;
+ }
+ }
}
void RemoteFilesDialog::SetFileCallback( ::svt::IFilePickerListener *pNotifier )
{
- // TODO
+ m_pFileNotifier = pNotifier;
}
-void RemoteFilesDialog::EnableAutocompletion( bool _bEnable )
+void RemoteFilesDialog::EnableAutocompletion( bool )
{
- // TODO
+ // This dialog contains Breadcrumb, not Edit
}
const OUString& RemoteFilesDialog::GetPath()
@@ -829,39 +860,33 @@ bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL )
sal_Int32 RemoteFilesDialog::getTargetColorDepth()
{
- // TODO
+ // This dialog doesn't contain preview
return 0;
}
sal_Int32 RemoteFilesDialog::getAvailableWidth()
{
- // TODO
+ // This dialog doesn't contain preview
return 0;
}
sal_Int32 RemoteFilesDialog::getAvailableHeight()
{
- // TODO
+ // This dialog doesn't contain preview
return 0;
}
-void RemoteFilesDialog::setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage )
+void RemoteFilesDialog::setImage( sal_Int16, const ::com::sun::star::uno::Any& )
{
- // TODO
+ // This dialog doesn't contain preview
}
bool RemoteFilesDialog::getShowState()
{
- // TODO
+ // This dialog doesn't contain preview
return false;
}
-OUString RemoteFilesDialog::GetCurFilter() const
-{
- // TODO
- return OUString( "" );
-}
-
Control* RemoteFilesDialog::getControl( sal_Int16 _nControlId, bool _bLabelControl) const
{
// TODO
@@ -872,10 +897,4 @@ void RemoteFilesDialog::enableControl( sal_Int16 _nControlId, bool _bEnable )
// TODO
}
-OUString RemoteFilesDialog::getCurFilter( ) const
-{
- // TODO
- return OUString("");
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list