diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2015-05-19 21:32:05 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-10-18 23:48:59 +0200 |
commit | bf86643b3e71519ae20620fb816b04bba2d99bdb (patch) | |
tree | f37b8afc6cd27407bc8738f6599e0c2201c120bc /fpicker | |
parent | 6cc58b9fa7ed6b5781963427df47b03417f17973 (diff) |
RemoteFilesDialog
Change-Id: I296ce6233287dac5447462faa4b7404c25297f8b
(cherry picked from commit 87297284782adbf1fcb73663ad2d2a38b5ae1872)
Diffstat (limited to 'fpicker')
21 files changed, 2298 insertions, 148 deletions
diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk index c109dce3a978..6c484a0a4a31 100644 --- a/fpicker/Library_fps_office.mk +++ b/fpicker/Library_fps_office.mk @@ -49,6 +49,7 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\ fpicker/source/office/OfficeFilePicker \ fpicker/source/office/OfficeFolderPicker \ fpicker/source/office/PlacesListBox \ + fpicker/source/office/RemoteFilesDialog \ )) # vim: set noet sw=4 ts=4: diff --git a/fpicker/UIConfig_fps.mk b/fpicker/UIConfig_fps.mk index c5582587bda5..ee8fea50d663 100644 --- a/fpicker/UIConfig_fps.mk +++ b/fpicker/UIConfig_fps.mk @@ -12,6 +12,7 @@ $(eval $(call gb_UIConfig_UIConfig,fps)) $(eval $(call gb_UIConfig_add_uifiles,fps,\ fpicker/uiconfig/ui/explorerfiledialog \ fpicker/uiconfig/ui/foldernamedialog \ + fpicker/uiconfig/ui/remotefilesdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 6fd28edfd242..5fb8edc351ea 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -20,6 +20,7 @@ #include "OfficeFilePicker.hxx" #include "iodlg.hxx" +#include "RemoteFilesDialog.hxx" #include <list> #include <functional> @@ -463,7 +464,7 @@ sal_Int16 SvtFilePicker::implExecutePicker( ) } -VclPtr<SvtFileDialog> SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) { WinBits nExtraBits; WinBits nBits = getWinBits( nExtraBits ); @@ -491,6 +492,13 @@ IMPLEMENT_FORWARD_XINTERFACE2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) +IMPLEMENT_FORWARD_XINTERFACE3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) + + +// disambiguate XTypeProvider + +IMPLEMENT_FORWARD_XTYPEPROVIDER3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) + // XExecutableDialog functions @@ -1165,4 +1173,73 @@ Reference< XInterface > SAL_CALL SvtFilePicker::impl_createInstance( return Reference< XInterface >( *new SvtFilePicker( xServiceManager ) ); } +// SvtRemoteFilePicker + +SvtRemoteFilePicker::SvtRemoteFilePicker( const Reference < XMultiServiceFactory >& xFactory ) + :SvtFilePicker( xFactory ) +{ +} + +VclPtr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog( vcl::Window* _pParent ) +{ + WinBits nExtraBits; + WinBits nBits = getWinBits( nExtraBits ); + + VclPtrInstance<RemoteFilesDialog> dialog( _pParent, nBits); // TODO: extrabits + + // Set StandardDir if present + if ( !m_aStandardDir.isEmpty()) + { + OUString sStandardDir = m_aStandardDir; + dialog->SetStandardDir( sStandardDir ); + dialog->SetBlackList( m_aBlackList ); + } + + return dialog; +} + +// XServiceInfo + + +/* XServiceInfo */ +OUString SAL_CALL SvtRemoteFilePicker::getImplementationName() throw( RuntimeException, std::exception ) +{ + return impl_getStaticImplementationName(); +} + +/* XServiceInfo */ +sal_Bool SAL_CALL SvtRemoteFilePicker::supportsService( const OUString& sServiceName ) throw( RuntimeException, std::exception ) +{ + return cppu::supportsService(this, sServiceName); +} + +/* XServiceInfo */ +Sequence< OUString > SAL_CALL SvtRemoteFilePicker::getSupportedServiceNames() throw( RuntimeException, std::exception ) +{ + return impl_getStaticSupportedServiceNames(); +} + +/* Helper for XServiceInfo */ +Sequence< OUString > SvtRemoteFilePicker::impl_getStaticSupportedServiceNames() +{ + Sequence< OUString > seqServiceNames( 1 ); + OUString* pArray = seqServiceNames.getArray(); + pArray[0] = "com.sun.star.ui.dialogs.RemoteFilePicker"; + return seqServiceNames ; +} + +/* Helper for XServiceInfo */ +OUString SvtRemoteFilePicker::impl_getStaticImplementationName() +{ + return OUString( "com.sun.star.svtools.RemoteFilePicker" ); +} + +/* Helper for registry */ +Reference< XInterface > SAL_CALL SvtRemoteFilePicker::impl_createInstance( + const Reference< XComponentContext >& rxContext) throw( Exception ) +{ + Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW); + return Reference< XInterface >( *new SvtRemoteFilePicker( xServiceManager ) ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index fa8313e16a85..df6ad1c7b195 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -61,7 +61,7 @@ class SvtFilePicker :public SvtFilePicker_Base ,public ::svt::OCommonPicker ,public ::svt::IFilePickerListener { -private: +protected: FilterList* m_pFilterList; ElementList* m_pElemList; @@ -205,14 +205,14 @@ protected: // OCommonPicker overridables - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; virtual bool implHandleInitializationArgument( const OUString& _rName, const ::com::sun::star::uno::Any& _rValue ) SAL_OVERRIDE; -private: +protected: WinBits getWinBits( WinBits& rExtraBits ); virtual void notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) SAL_OVERRIDE; @@ -226,6 +226,39 @@ private: DECL_LINK( DialogClosedHdl, Dialog* ); }; +// SvtRemoteFilePicker + +class SvtRemoteFilePicker : public SvtFilePicker +{ +public: + SvtRemoteFilePicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); + + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + + // disambiguate XInterface + + DECLARE_XINTERFACE( ) + + // disambiguate XTypeProvider + + DECLARE_XTYPEPROVIDER( ) + + /* XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + + /* Helper for XServiceInfo */ + static com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); + static OUString impl_getStaticImplementationName(); + + /* Helper for registry */ + static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( + const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ) + throw( com::sun::star::uno::Exception ); +}; + #endif // INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index 8f524856884c..33a3e53d2245 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -69,7 +69,7 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) ); } -VclPtr<SvtFileDialog> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) { return VclPtr<SvtFileDialog>::Create( _pParent, SFXWB_PATHDIALOG ); } diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx index 266c99cbef8a..b2697aef43e5 100644 --- a/fpicker/source/office/OfficeFolderPicker.hxx +++ b/fpicker/source/office/OfficeFolderPicker.hxx @@ -99,7 +99,7 @@ protected: // OCommonPicker overridables - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; }; diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx new file mode 100644 index 000000000000..94f6f3fccb0e --- /dev/null +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -0,0 +1,1498 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#include "RemoteFilesDialog.hxx" + +class FileViewContainer : public vcl::Window +{ + enum FocusState + { + Prev = 0, + TreeView, + FileView, + Next, + FocusCount + }; + + private: + VclPtr< SvtFileView > m_pFileView; + VclPtr< FolderTree > m_pTreeView; + VclPtr< Splitter > m_pSplitter; + + int m_nCurrentFocus; + VclPtr<vcl::Window> m_pFocusWidgets[FocusState::FocusCount]; + + public: + FileViewContainer( vcl::Window *pParent ) + : Window( pParent, WB_TABSTOP ) + , m_pFileView( NULL ) + , m_pTreeView( NULL ) + , m_pSplitter( NULL ) + , m_nCurrentFocus( 0 ) + { + } + + virtual ~FileViewContainer() + { + disposeOnce(); + } + + virtual void dispose() SAL_OVERRIDE + { + m_pFileView.clear(); + m_pTreeView.clear(); + m_pSplitter.clear(); + vcl::Window::dispose(); + } + + void init( SvtFileView* pFileView, + Splitter* pSplitter, + FolderTree* pTreeView, + vcl::Window* pPrevSibling, + vcl::Window* pNextSibling ) + { + m_pFileView = pFileView; + m_pTreeView = pTreeView; + m_pSplitter = pSplitter; + m_pFocusWidgets[FocusState::Prev] = pPrevSibling; + m_pFocusWidgets[FocusState::TreeView] = pTreeView; + m_pFocusWidgets[FocusState::FileView] = pFileView; + m_pFocusWidgets[FocusState::Next] = pNextSibling; + } + + virtual void Resize() SAL_OVERRIDE + { + Window::Resize(); + + if( !m_pFileView || !m_pTreeView ) + return; + + Size aSize = GetSizePixel(); + Point aPos( m_pFileView->GetPosPixel() ); + Size aNewSize( aSize.Width() - aPos.X(), aSize.Height() ); + + m_pFileView->SetSizePixel( aNewSize ); + + // Resize the Splitter to fit the height + Size splitterNewSize = m_pSplitter->GetSizePixel(); + splitterNewSize.Height() = aSize.Height(); + m_pSplitter->SetSizePixel( splitterNewSize ); + sal_Int32 nMinX = m_pTreeView->GetPosPixel().X(); + sal_Int32 nMaxX = m_pFileView->GetPosPixel().X() + m_pFileView->GetSizePixel().Width() - nMinX; + m_pSplitter->SetDragRectPixel( Rectangle( Point( nMinX, 0 ), Size( nMaxX, aSize.Width() ) ) ); + + // Resize the tree list box to fit the height of the FileView + Size placesNewSize( m_pTreeView->GetSizePixel() ); + placesNewSize.Height() = aSize.Height(); + m_pTreeView->SetSizePixel( placesNewSize ); + } + + void changeFocus( bool bReverse ) + { + if( !m_pFileView || !m_pTreeView ) + return; + + if( bReverse && m_nCurrentFocus > FocusState::Prev && m_nCurrentFocus <= FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false); + m_pFocusWidgets[m_nCurrentFocus]->LoseFocus(); + + m_pFocusWidgets[--m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + else if( !bReverse && m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus < FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false); + m_pFocusWidgets[m_nCurrentFocus]->LoseFocus(); + + m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + } + + virtual void GetFocus() SAL_OVERRIDE + { + if( !m_pFileView || !m_pTreeView ) + return; + + sal_uInt16 aFlags = GetGetFocusFlags(); + + if( aFlags & GETFOCUS_FORWARD ) + m_nCurrentFocus = FocusState::TreeView; + else if( aFlags & GETFOCUS_BACKWARD ) + m_nCurrentFocus = FocusState::FileView; + + if( m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus <= FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + } + + virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE + { + if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) + { + // we must also update counter when user change focus using mouse + for(int i = FocusState::Prev; i <= FocusState::Next; i++) + { + if( rNEvt.GetWindow() == m_pFocusWidgets[i] ) + { + m_nCurrentFocus = i; + return true; + } + } + + // GETFOCUS for one of FileView's subcontrols + m_nCurrentFocus = FocusState::FileView; + return true; + } + if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode(); + bool bShift = rCode.IsShift(); + if( rCode.GetCode() == KEY_TAB ) + { + changeFocus( bShift ); + return true; + } + } + return Window::Notify( rNEvt ); + } +}; + +RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) + : SvtFileDialog_Base( pParent, "RemoteFilesDialog", "fps/ui/remotefilesdialog.ui" ) + , m_xContext( comphelper::getProcessComponentContext() ) + , m_xMasterPasswd( PasswordContainer::create( m_xContext ) ) + , m_nWidth( 0 ) + , m_nHeight( 0 ) + , m_pCurrentAsyncAction( NULL ) + , m_pFileNotifier( NULL ) + , m_pSplitter( NULL ) + , m_pFileView( NULL ) + , m_pContainer( NULL ) + , m_pAddMenu( NULL ) +{ + get( m_pCancel_btn, "cancel" ); + get( m_pAddService_btn, "add_service_btn" ); + get( m_pServices_lb, "services_lb" ); + get( m_pFilter_lb, "filter_lb" ); + get( m_pNewFolder, "new_folder" ); + + m_eMode = ( nBits & WB_SAVEAS ) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN; + m_eType = ( nBits & WB_PATH ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG; + m_bMultiselection = ( nBits & SFXWB_MULTISELECTION ) != 0; + m_bIsUpdated = false; + m_bIsConnected = false; + m_bServiceChanged = false; + m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND; + + m_pName_ed = VclPtr< AutocompleteEdit >::Create( get< vcl::Window >( "filename_container" ) ); + m_pName_ed->Show(); + + m_pFilter_lb->Enable( false ); + m_pName_ed->Enable( false ); + + if( m_eMode == REMOTEDLG_MODE_OPEN ) + { + get( m_pOk_btn, "open" ); + + m_pNewFolder->Hide(); + } + else + { + get( m_pOk_btn, "save" ); + + m_aImages = ImageList( fpicker::SvtResId( RID_FILEPICKER_IMAGES ) ); + m_pNewFolder->SetModeImage( m_aImages.GetImage( IMG_FILEDLG_CREATEFOLDER ) ); + m_pNewFolder->SetClickHdl( LINK( this, RemoteFilesDialog, NewFolderHdl ) ); + } + + m_pOk_btn->Show(); + m_pOk_btn->Enable( false ); + + m_pOk_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) ); + m_pCancel_btn->SetClickHdl( LINK( this, RemoteFilesDialog, CancelHdl ) ); + + m_sRootLabel = fpicker::SvtResId( STR_SVT_ROOTLABEL ); + m_pPath = VclPtr<Breadcrumb>::Create( get< vcl::Window >( "breadcrumb_container" ) ); + m_pPath->set_hexpand( true ); + m_pPath->SetClickHdl( LINK( this, RemoteFilesDialog, SelectBreadcrumbHdl ) ); + m_pPath->SetMode( SvtBreadcrumbMode::ALL_VISITED ); + m_pPath->Show(); + + m_pContainer = VclPtr< FileViewContainer >::Create( get< vcl::Window >("container") ); + + m_pContainer->set_hexpand( true ); + m_pContainer->set_vexpand( true ); + + m_pFileView = VclPtr< SvtFileView >::Create( m_pContainer, WB_BORDER | WB_TABSTOP, + REMOTEDLG_TYPE_PATHDLG == m_eType, + m_bMultiselection, false ); + + m_pFileView->Show(); + m_pFileView->EnableAutoResize(); + m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) ); + m_pFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) ); + m_pFileView->EnableDelete( true ); + + m_pSplitter = VclPtr< Splitter >::Create( m_pContainer, WB_HSCROLL ); + m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ) ); + m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) ); + m_pSplitter->Show(); + + m_pTreeView = VclPtr< FolderTree >::Create( m_pContainer, WB_BORDER ); + Size aSize( 150, 200 ); + m_pTreeView->set_height_request( aSize.Height() ); + m_pTreeView->set_width_request( aSize.Width() ); + m_pTreeView->SetSizePixel( aSize ); + m_pTreeView->Show(); + + m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) ); + + sal_Int32 nPosX = m_pTreeView->GetSizePixel().Width(); + m_pSplitter->SetPosPixel( Point( nPosX, 0 ) ); + nPosX += m_pSplitter->GetSizePixel().Width(); + m_pFileView->SetPosPixel( Point( nPosX, 0 ) ); + + m_pContainer->init( m_pFileView, m_pSplitter, m_pTreeView, m_pAddService_btn, m_pFilter_lb ); + m_pContainer->Show(); + m_pContainer->Enable( false ); + + m_sIniKey = "RemoteFilesDialog"; + InitSize(); + + m_pName_ed->SetGetFocusHdl( LINK( this, RemoteFilesDialog, FileNameGetFocusHdl ) ); + 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 ) ); + + FillServicesListbox(); + + m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) ); + + m_pFilter_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectFilterHdl ) ); +} + +RemoteFilesDialog::~RemoteFilesDialog() +{ + disposeOnce(); +} + +void RemoteFilesDialog::dispose() +{ + m_pFileView->SetSelectHdl( Link<>() ); + + // save window state + if( !m_sIniKey.isEmpty() ) + { + SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey ); + aDlgOpt.SetWindowState( OStringToOUString( GetWindowState(), osl_getThreadTextEncoding() ) ); + + Size aSize( GetSizePixel() ); + + OUString sSize = OUString::number( aSize.Width() ) + "|"; + sSize = sSize + OUString::number( aSize.Height() ) + "|"; + + OUString sUserData = m_pFileView->GetConfigString(); + aDlgOpt.SetUserItem( OUString( "UserData" ), + makeAny( sSize + sUserData ) ); + } + + // save services + std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_xContext ) ); + + officecfg::Office::Common::Misc::FilePickerLastService::set( m_sLastServiceUrl, batch ); + + if( m_bIsUpdated ) + { + Sequence< OUString > placesUrlsList( m_aServices.size() ); + Sequence< OUString > placesNamesList( m_aServices.size() ); + + int i = 0; + for( std::vector< ServicePtr >::const_iterator it = m_aServices.begin(); it != m_aServices.end(); ++it ) + { + placesUrlsList[i] = ( *it )->GetUrl(); + placesNamesList[i] = ( *it )->GetName(); + ++i; + } + + officecfg::Office::Common::Misc::FilePickerPlacesUrls::set( placesUrlsList, batch ); + officecfg::Office::Common::Misc::FilePickerPlacesNames::set( placesNamesList, batch ); + } + + batch->commit(); + + m_pTreeView.disposeAndClear(); + m_pFileView.disposeAndClear(); + m_pSplitter.disposeAndClear(); + m_pContainer.disposeAndClear(); + m_pPath.disposeAndClear(); + + m_pOk_btn.clear(); + m_pCancel_btn.clear(); + m_pAddService_btn.clear(); + m_pServices_lb.clear(); + m_pFilter_lb.clear(); + m_pName_ed.clear(); + m_pNewFolder.clear(); + + ModalDialog::dispose(); +} + +void RemoteFilesDialog::Resize() +{ + ModalDialog::Resize(); + + if( m_pFileView && m_pContainer ) + { + Size aSize = m_pContainer->GetSizePixel(); + m_pFileView->SetSizePixel( aSize ); + } + Invalidate(INVALIDATE_UPDATE); +} + +short RemoteFilesDialog::Execute() +{ + if( m_pServices_lb->GetEntryCount() == 0 ) + { + Show(); + AddServiceHdl( NULL ); + } + if( m_pServices_lb->GetEntryCount() > 0 ) + { + Show(); + SelectServiceHdl( NULL ); + } + if( !m_bIsConnected ) + { + m_pServices_lb->SetNoSelection(); + } + + short nRet = SvtFileDialog_Base::Execute(); + + return nRet; +} + +void RemoteFilesDialog::Show() +{ + SvtFileDialog_Base::Show(true, 0); + + if( m_nWidth > 0 && m_nHeight > 0 ) + { + Size aSize( m_nWidth, m_nHeight ); + SetSizePixel( aSize ); + } +} + +OUString lcl_GetServiceType( ServicePtr pService ) +{ + INetProtocol aProtocol = pService->GetUrlObject().GetProtocol(); + switch( aProtocol ) + { + case INetProtocol::Ftp: + return OUString( "FTP" ); + case INetProtocol::Cmis: + { + OUString sHost = pService->GetUrlObject().GetHost( INetURLObject::DECODE_WITH_CHARSET ); + + if( sHost.startsWith( GDRIVE_BASE_URL ) ) + return OUString( "Google Drive" ); + else if( sHost.startsWith( ALFRESCO_CLOUD_BASE_URL ) ) + return OUString( "Alfresco Cloud" ); + else if( sHost.startsWith( ONEDRIVE_BASE_URL ) ) + return OUString( "OneDrive" ); + + return OUString( "CMIS" ); + } + case INetProtocol::Smb: + return OUString( "Windows Share" ); + case INetProtocol::File: + return OUString( "SSH" ); + case INetProtocol::Http: + return OUString( "WebDAV" ); + case INetProtocol::Https: + return OUString( "WebDAV" ); + case INetProtocol::Generic: + return OUString( "SSH" ); + default: + return OUString( "" ); + } +} + +void RemoteFilesDialog::InitSize() +{ + if( m_sIniKey.isEmpty() ) + return; + + // initialize from config + SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey ); + + if( aDlgOpt.Exists() ) + { + SetWindowState( OUStringToOString( aDlgOpt.GetWindowState(), osl_getThreadTextEncoding() ) ); + + Any aUserData = aDlgOpt.GetUserItem( OUString( "UserData" ) ); + OUString sCfgStr; + if( aUserData >>= sCfgStr ) + { + int nPos = sCfgStr.indexOf( "|" ); + if( nPos != -1 ) + { + nPos = sCfgStr.indexOf( "|", nPos + 1 ); + if( nPos != -1 ) + { + sal_Int32 nIdx = 0; + m_nWidth = sCfgStr.getToken( 0, '|', nIdx ).toInt32(); + m_nHeight = sCfgStr.getToken( 0, '|', nIdx ).toInt32(); + + m_pFileView->SetConfigString( sCfgStr.copy( nPos + 1) ); + } + } + } + } +} + +void RemoteFilesDialog::FillServicesListbox() +{ + m_pServices_lb->Clear(); + m_aServices.clear(); + + // Load from user settings + Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get( m_xContext ) ); + Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get( m_xContext ) ); + + unsigned int nPos = 0; + unsigned int i = 0; + + m_sLastServiceUrl = officecfg::Office::Common::Misc::FilePickerLastService::get( m_xContext ); + + for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace ) + { + ServicePtr pService( new Place( placesNamesList[nPlace], placesUrlsList[nPlace], true ) ); + m_aServices.push_back( pService ); + + // Add to the listbox only remote services, not local bookmarks + if( !pService->IsLocal() ) + { + OUString sPrefix = lcl_GetServiceType( pService ); + + if( !sPrefix.isEmpty() ) + sPrefix += ": "; + + if( placesUrlsList[nPlace] == m_sLastServiceUrl ) + nPos = i; + + m_pServices_lb->InsertEntry( sPrefix + placesNamesList[nPlace] ); + + i++; + } + } + + if( m_pServices_lb->GetEntryCount() > 0 ) + { + m_pServices_lb->SelectEntryPos( nPos ); + m_pAddService_btn->SetPopupMenu( m_pAddMenu ); + } + else + m_pAddService_btn->SetPopupMenu( NULL ); + + EnableControls(); +} + +int RemoteFilesDialog::GetSelectedServicePos() +{ + int nSelected = m_pServices_lb->GetSelectEntryPos(); + int nPos = 0; + int i = -1; + + if( m_aServices.size() == 0 ) + return -1; + + while( nPos < ( int )m_aServices.size() ) + { + while( m_aServices[nPos]->IsLocal() ) + nPos++; + i++; + if( i == nSelected ) + break; + nPos++; + } + + return nPos; +} + +void RemoteFilesDialog::AddFilter( const OUString& rFilter, const OUString& rType ) +{ + 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 ); +} + +OUString RemoteFilesDialog::GetPath() const +{ + return m_sPath; +} + +FileViewResult RemoteFilesDialog::OpenURL( OUString const & sURL ) +{ + FileViewResult eResult = eFailure; + + if( m_pFileView ) + { + m_pTreeView->EndSelection(); + DisableControls(); + + EnableChildPointerOverwrite( true ); + SetPointer( PointerStyle::Wait ); + Invalidate(INVALIDATE_UPDATE); + + if( !sURL.isEmpty() ) + { + OUString sFilter = FILEDIALOG_FILTER_ALL; + + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + sFilter = m_aFilters[m_nCurrentFilter].second; + } + + m_pFileView->EndInplaceEditing( false ); + + DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" ); + + m_pCurrentAsyncAction = new AsyncPickerAction( this, m_pFileView, AsyncPickerAction::Action::eOpenURL ); + + // -1 timeout - sync + m_pCurrentAsyncAction->execute( sURL, sFilter, -1, -1, GetBlackList() ); + + if( m_eMode != REMOTEDLG_MODE_SAVE ) + m_pName_ed->SetText( "" ); + + m_pFileView->GrabFocus(); + } + else + { + SetPointer( PointerStyle::Arrow ); + EnableChildPointerOverwrite( false ); + + // content doesn't exist + ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS ); + + EnableControls(); + return eFailure; + } + + SetPointer( PointerStyle::Arrow ); + EnableChildPointerOverwrite( false ); + } + + return eResult; +} + +void RemoteFilesDialog::AddFileExtension() +{ + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + OUString sExt = m_aFilters[m_nCurrentFilter].second; + OUString sFileName = m_pName_ed->GetText(); + + sal_Int32 nDotPos = sFileName.lastIndexOf( '.' ); + + if ( nDotPos == -1 ) + { + sFileName += sExt.copy( 1 ); // without '*' + m_pName_ed->SetText( sFileName ); + } + } +} + +void RemoteFilesDialog::EnableControls() +{ + if( m_pServices_lb->GetEntryCount() > 0 ) + { + m_pServices_lb->Enable( true ); + + if( m_pServices_lb->GetSelectEntryCount() ) + { + m_pAddMenu->EnableItem( "change_password", false ); + + try + { + if( m_xMasterPasswd->isPersistentStoringAllowed() ) + { + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sUrl( m_aServices[nPos]->GetUrl() ); + + UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, Reference< XInteractionHandler>() ); + + if( aURLEntries.UserList.getLength() ) + { + m_pAddMenu->EnableItem( "change_password" ); + } + } + } + } + catch( const Exception& ) + {} + } + } + else + m_pServices_lb->Enable( false ); + + if( m_bIsConnected ) + { + m_pFilter_lb->Enable( true ); + m_pName_ed->Enable( true ); + m_pContainer->Enable( true ); + + if( !m_pName_ed->GetText().isEmpty() ) + m_pOk_btn->Enable( true ); + else + m_pOk_btn->Enable( false ); + } + else + { + m_pFilter_lb->Enable( false ); + m_pName_ed->Enable( false ); + m_pContainer->Enable( false ); + m_pOk_btn->Enable( false ); + } + + m_pPath->EnableFields( true ); + m_pAddService_btn->Enable( true ); + + Invalidate(INVALIDATE_UPDATE); +} + +void RemoteFilesDialog::DisableControls() +{ + m_pServices_lb->Enable( false ); + m_pFilter_lb->Enable( false ); + m_pAddService_btn->Enable( false ); + m_pName_ed->Enable( false ); + m_pContainer->Enable( false ); + m_pOk_btn->Enable( false ); + m_pPath->EnableFields( false ); + + m_pCancel_btn->Enable( true ); +} + +void RemoteFilesDialog::SavePassword( const OUString& rURL, const OUString& rUser + , const OUString& rPassword, bool bPersistent ) +{ + if( rURL.isEmpty() || rUser.isEmpty() || rPassword.isEmpty() ) + return; + + try + { + if( !bPersistent || + ( m_xMasterPasswd->isPersistentStoringAllowed() + && m_xMasterPasswd->authorizateWithMasterPassword( Reference< XInteractionHandler>() ) ) + ) + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), + UNO_QUERY ); + + Sequence< OUString > aPasswd( 1 ); + aPasswd[0] = rPassword; + + if( bPersistent ) + m_xMasterPasswd->addPersistent( + rURL, rUser, aPasswd, xInteractionHandler ); + else + m_xMasterPasswd->add( rURL, rUser, aPasswd, xInteractionHandler ); + } + } + catch( const Exception& ) + {} +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) +{ + ScopedVclPtrInstance< PlaceEditDialog > aDlg( this ); + aDlg->ShowPasswordControl(); + short aRetCode = aDlg->Execute(); + + switch( aRetCode ) + { + case RET_OK : + { + ServicePtr newService = aDlg->GetPlace(); + m_aServices.push_back( newService ); + + OUString sPassword = aDlg->GetPassword(); + OUString sUser = aDlg->GetUser(); + if( !sUser.isEmpty() && !sPassword.isEmpty() ) + { + bool bPersistent = aDlg->IsRememberChecked(); + SavePassword( newService->GetUrl(), sUser, sPassword, bPersistent ); + } + + OUString sPrefix = lcl_GetServiceType( newService ); + + if(!sPrefix.isEmpty()) + sPrefix += ": "; + + 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; + + EnableControls(); + break; + } + case RET_CANCEL : + default : + // Do Nothing + break; + }; + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl ) +{ + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sURL = m_aServices[nPos]->GetUrl(); + m_pAddService_btn->SetPopupMenu( m_pAddMenu ); + + m_bServiceChanged = true; + OpenURL( sURL ); + } + + return 1; +} + +IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void ) +{ + OString sIdent( pButton->GetCurItemIdent() ); + if( sIdent == "edit_service" && m_pServices_lb->GetEntryCount() > 0 ) + { + unsigned int nSelected = m_pServices_lb->GetSelectEntryPos(); + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + ScopedVclPtrInstance< PlaceEditDialog > aDlg( this, m_aServices[nPos] ); + short aRetCode = aDlg->Execute(); + + switch( aRetCode ) + { + case RET_OK : + { + ServicePtr pEditedService = aDlg->GetPlace(); + + m_aServices[nPos] = pEditedService; + m_pServices_lb->RemoveEntry( nSelected ); + + OUString sPrefix = lcl_GetServiceType( pEditedService ); + + if(!sPrefix.isEmpty()) + sPrefix += ": "; + + m_pServices_lb->InsertEntry( sPrefix + pEditedService->GetName(), nSelected ); + m_pServices_lb->SelectEntryPos( nSelected ); + + m_bIsUpdated = true; + break; + } + case RET_NO: + sIdent = "delete_service"; + break; + case RET_CANCEL : + default : + // Do Nothing + break; + }; + } + } + if( sIdent == "delete_service" && m_pServices_lb->GetEntryCount() > 0 ) + { + unsigned int nSelected = m_pServices_lb->GetSelectEntryPos(); + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sMsg = fpicker::SvtResId( STR_SVT_DELETESERVICE ); + sMsg = sMsg.replaceFirst( "$servicename$", m_pServices_lb->GetSelectEntry() ); + ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO ); + + if( aBox->Execute() == RET_YES ) + { + // remove password + try + { + if( m_xMasterPasswd->isPersistentStoringAllowed() ) + { + OUString sUrl( m_aServices[nPos]->GetUrl() ); + + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), + UNO_QUERY ); + + UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, xInteractionHandler ); + + if( aURLEntries.Url == sUrl && aURLEntries.UserList.getLength() ) + { + OUString sUserName = aURLEntries.UserList[0].UserName; + + m_xMasterPasswd->removePersistent( sUrl, sUserName ); + } + } + } + catch( const Exception& ) + {} + + m_aServices.erase( m_aServices.begin() + nPos ); + m_pServices_lb->RemoveEntry( nSelected ); + + m_pServices_lb->SetNoSelection(); + m_pAddService_btn->SetPopupMenu( NULL ); + + m_bIsUpdated = true; + + m_bIsConnected = false; + EnableControls(); + } + } + } + else if( sIdent == "change_password" ) + { + try + { + if( m_xMasterPasswd->isPersistentStoringAllowed() && m_xMasterPasswd->authorizateWithMasterPassword( Reference< XInteractionHandler>() ) ) + { + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sUrl( m_aServices[nPos]->GetUrl() ); + + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), + UNO_QUERY ); + + UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, xInteractionHandler ); + + if( aURLEntries.Url == sUrl && aURLEntries.UserList.getLength() ) + { + OUString sUserName = aURLEntries.UserList[0].UserName; + + ::comphelper::SimplePasswordRequest* pPasswordRequest + = new ::comphelper::SimplePasswordRequest( PasswordRequestMode_PASSWORD_CREATE ); + Reference< XInteractionRequest > rRequest( pPasswordRequest ); + + xInteractionHandler->handle( rRequest ); + + if ( pPasswordRequest->isPassword() ) + { + OUString aNewPass = pPasswordRequest->getPassword(); + Sequence< OUString > aPasswd( 1 ); + aPasswd[0] = aNewPass; + + m_xMasterPasswd->addPersistent( + sUrl, sUserName, aPasswd, xInteractionHandler ); + } + } + } + } + } + catch( const Exception& ) + {} + } + + EnableControls(); +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl ) +{ + if( m_pFileView->GetSelectionCount() ) + { + SvTreeListEntry* pEntry = m_pFileView->FirstSelected(); + + if( pEntry ) + { + SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() ); + + if( pData ) + { + if( !pData->mbIsFolder ) + { + EndDialog( RET_OK ); + } + else + { + OpenURL( pData->maURL ); + } + } + } + } + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl ) +{ + SvTreeListEntry* pEntry = m_pFileView->FirstSelected(); + + if( pEntry ) + { + SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() ); + + if( pData ) + { + if( ( pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_PATHDLG ) ) + || ( !pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_FILEDLG ) ) ) + { + // url must contain user info, because we need this info in recent files entry + // (to fill user field in login box by default) + INetURLObject aURL( pData->maURL ); + INetURLObject aCurrentURL( m_sLastServiceUrl ); + aURL.SetUser( aCurrentURL.GetUser() ); + + m_sPath = aURL.GetMainURL( INetURLObject::NO_DECODE ); + + m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) ); + } + else + { + if( m_eMode == REMOTEDLG_MODE_OPEN ) + { + m_sPath.clear(); + m_pName_ed->SetText( "" ); + } + } + + EnableControls(); + } + } + + return 1; +} + +IMPL_LINK_NOARG( RemoteFilesDialog, FileNameGetFocusHdl ) +{ + m_pFileView->SetNoSelection(); + return 1; +} + +IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl ) +{ + m_pFileView->SetNoSelection(); + if( !m_pOk_btn->IsEnabled() ) + EnableControls(); + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SplitHdl ) +{ + sal_Int32 nSplitPos = m_pSplitter->GetSplitPosPixel(); + + // Resize the tree list box + sal_Int32 nPlaceX = m_pTreeView->GetPosPixel().X(); + Size placeSize = m_pTreeView->GetSizePixel(); + placeSize.Width() = nSplitPos - nPlaceX; + m_pTreeView->SetSizePixel( placeSize ); + + // Change Pos and size of the fileview + Point fileViewPos = m_pFileView->GetPosPixel(); + sal_Int32 nOldX = fileViewPos.X(); + sal_Int32 nNewX = nSplitPos + m_pSplitter->GetSizePixel().Width(); + fileViewPos.X() = nNewX; + Size fileViewSize = m_pFileView->GetSizePixel(); + fileViewSize.Width() -= ( nNewX - nOldX ); + m_pFileView->SetPosSizePixel( fileViewPos, fileViewSize ); + + m_pSplitter->SetPosPixel( Point( placeSize.Width(), m_pSplitter->GetPosPixel().Y() ) ); + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SelectFilterHdl ) +{ + unsigned int nPos = m_pFilter_lb->GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND && !m_aFilters[nPos].second.isEmpty() ) + { + m_nCurrentFilter = nPos; + + OUString sCurrentURL = m_pFileView->GetViewURL(); + + if( !sCurrentURL.isEmpty() && m_bIsConnected ) + OpenURL( sCurrentURL ); + } + + return 1; +} + +IMPL_LINK ( RemoteFilesDialog, TreeSelectHdl, FolderTree *, pBox ) +{ + OUString* sURL = static_cast< OUString* >( pBox->GetHdlEntry()->GetUserData() ); + + if( sURL ) + { + OpenURL( *sURL ); + m_pFileView->GrabFocus(); + } + + return 1; +} + +IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr ) +{ + if( pPtr ) + { + OpenURL( pPtr->GetHdlURL() ); + } + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl ) +{ + m_pFileView->EndInplaceEditing( false ); + + SmartContent aContent( m_pFileView->GetViewURL() ); + OUString aTitle; + aContent.getTitle( aTitle ); + ScopedVclPtrInstance< QueryFolderNameDialog > aDlg( this, aTitle, fpicker::SVT_RESSTR( STR_SVT_NEW_FOLDER ) ); + bool bHandled = false; + + while( !bHandled ) + { + if( aDlg->Execute() == RET_OK ) + { + OUString aUrl = aContent.createFolder( aDlg->GetName() ); + if( !aUrl.isEmpty() ) + { + m_pFileView->CreatedFolder( aUrl, aDlg->GetName() ); + bHandled = true; + } + } + else + bHandled = true; + } + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) +{ + OUString sNameNoExt = m_pName_ed->GetText(); + OUString sPathNoExt; + + // auto extension + if( m_eMode == REMOTEDLG_MODE_SAVE ) + AddFileExtension(); + + // check if file/path exists + + OUString sCurrentPath = m_pFileView->GetViewURL(); + OUString sSelectedItem = m_pFileView->GetCurrentURL(); + OUString sName = m_pName_ed->GetText(); + + bool bFileDlg = ( m_eType == REMOTEDLG_TYPE_FILEDLG ); + bool bSelected = ( m_pFileView->GetSelectionCount() > 0 ); + + if( !sCurrentPath.endsWith("/") ) + sCurrentPath += "/"; + + if( !bSelected ) + { + m_sPath = sCurrentPath + INetURLObject::encode( sName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); + sPathNoExt = sCurrentPath + INetURLObject::encode( sNameNoExt, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); + } + else + { + if( m_eType == REMOTEDLG_TYPE_PATHDLG ) + m_sPath = sCurrentPath; + else + m_sPath = sSelectedItem; + + // url must contain user info, because we need this info in recent files entry + // (to fill user field in login box by default) + INetURLObject aURL( m_sPath ); + INetURLObject aCurrentURL( m_sLastServiceUrl ); + aURL.SetUser( aCurrentURL.GetUser() ); + + m_sPath = aURL.GetMainURL( INetURLObject::NO_DECODE ); + } + + bool bExists = false; + + if( bFileDlg ) + bExists = ContentIsDocument( m_sPath ); + else + bExists = ContentIsFolder( m_sPath ); + + if( bExists ) + { + if( m_eMode == REMOTEDLG_MODE_SAVE ) + { + OUString sMsg = fpicker::SvtResId( STR_SVT_ALREADYEXISTOVERWRITE ); + sMsg = sMsg.replaceFirst( "$filename$", sName ); + ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO ); + if( aBox->Execute() != RET_YES ) + return 0; + } + } + else + { + if( ContentIsFolder( sPathNoExt ) ) + { + OpenURL( sPathNoExt ); + m_pName_ed->SetText( "" ); + + if( !bSelected ) + m_pName_ed->GrabFocus(); + + return 0; + } + + if( m_eMode == REMOTEDLG_MODE_OPEN ) + return 0; + } + + EndDialog( RET_OK ); + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, CancelHdl ) +{ + if( m_pCurrentAsyncAction.is() ) + { + m_pCurrentAsyncAction->cancel(); + onAsyncOperationFinished(); + } + else + { + EndDialog( RET_CANCEL ); + } + return 1; +} + +// SvtFileDialog_Base + +SvtFileView* RemoteFilesDialog::GetView() +{ + return m_pFileView; +} + +void RemoteFilesDialog::SetHasFilename( bool ) +{ +} + +void RemoteFilesDialog::SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) +{ + m_aBlackList = rBlackList; + m_pTreeView->SetBlackList( rBlackList ); +} + +const ::com::sun::star::uno::Sequence< OUString >& RemoteFilesDialog::GetBlackList() const +{ + return m_aBlackList; +} + +void RemoteFilesDialog::SetStandardDir( const OUString& rStdDir ) +{ + m_sStdDir = rStdDir; +} + +const OUString& RemoteFilesDialog::GetStandardDir() const +{ + return m_sStdDir; +} + +void RemoteFilesDialog::SetPath( const OUString& rNewURL ) +{ + m_sPath = rNewURL; + + if( m_eMode == REMOTEDLG_MODE_SAVE ) + { + INetURLObject aUrl( m_sPath ); + OUString sFileName = aUrl.GetLastName( INetURLObject::DECODE_WITH_CHARSET ); + + m_pName_ed->SetText( sFileName ); + } +} + +OUString RemoteFilesDialog::getCurrentFileText() const +{ + OUString sReturn; + if( m_pName_ed ) + sReturn = m_pName_ed->GetText(); + return sReturn; +} + +void RemoteFilesDialog::setCurrentFileText( const OUString& rText, bool bSelectAll ) +{ + if( m_pName_ed ) + { + m_pName_ed->SetText( rText ); + if( bSelectAll ) + m_pName_ed->SetSelection( Selection( 0, rText.getLength() ) ); + } +} + +void RemoteFilesDialog::AddFilterGroup( + const OUString& rFilter, + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) +{ + AddFilter( rFilter, OUString() ); + const StringPair* pSubFilters = rFilters.getConstArray(); + const StringPair* pSubFiltersEnd = pSubFilters + rFilters.getLength(); + for ( ; pSubFilters != pSubFiltersEnd; ++pSubFilters ) + AddFilter( pSubFilters->First, pSubFilters->Second ); +} + +OUString RemoteFilesDialog::GetCurFilter() const +{ + OUString sFilter; + + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + sFilter = m_aFilters[m_nCurrentFilter].first; + } + + return sFilter; +} + +OUString RemoteFilesDialog::getCurFilter( ) const +{ + return GetCurFilter(); +} + +void RemoteFilesDialog::SetCurFilter( const OUString& rFilter ) +{ + 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::FilterSelect() +{ +} + +void RemoteFilesDialog::SetFileCallback( ::svt::IFilePickerListener *pNotifier ) +{ + m_pFileNotifier = pNotifier; +} + +void RemoteFilesDialog::onAsyncOperationStarted() +{ + DisableControls(); +} + +void RemoteFilesDialog::onAsyncOperationFinished() +{ + m_pCurrentAsyncAction = NULL; + EnableControls(); +} + +void RemoteFilesDialog::UpdateControls( const OUString& rURL ) +{ + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 && m_bServiceChanged && rURL == m_aServices[nPos]->GetUrl() ) + { + OUString sURL = m_aServices[nPos]->GetUrl(); + + m_pPath->SetRootName( m_sRootLabel ); + m_pTreeView->Clear(); + + SvTreeListEntry* pRoot = m_pTreeView->InsertEntry( m_sRootLabel, NULL, true ); + OUString* sData = new OUString( rURL ); + pRoot->SetUserData( static_cast< void* >( sData ) ); + + m_pName_ed->GrabFocus(); + + m_sLastServiceUrl = sURL; + + m_bServiceChanged = false; + } + + m_pPath->SetURL( rURL ); + + m_pTreeView->SetSelectHdl( Link<>() ); + + // read cached data for this url and fill the tree + const ::std::vector< SvtContentEntry >& rFolders = m_pFileView->GetContent(); + ::std::vector< std::pair< OUString, OUString > > aFolders; + + m_pName_ed->ClearEntries(); + + for( ::std::vector< SvtContentEntry >::size_type i = 0; i < rFolders.size(); i++ ) + { + int nTitleStart = rFolders[i].maURL.lastIndexOf( '/' ); + if( nTitleStart != -1 ) + { + OUString sTitle( INetURLObject::decode( + rFolders[i].maURL.copy( nTitleStart + 1 ), + INetURLObject::DECODE_WITH_CHARSET ) ); + + if( rFolders[i].mbIsFolder ) + { + aFolders.push_back( std::pair< OUString, OUString > ( sTitle, rFolders[i].maURL ) ); + } + + // add entries to the autocompletion mechanism + m_pName_ed->AddEntry( sTitle ); + } + } + + m_pTreeView->FillTreeEntry( rURL, aFolders ); + + m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) ); + + m_bIsConnected = true; + EnableControls(); +} + +void RemoteFilesDialog::EnableAutocompletion( bool ) +{ + // This dialog contains Breadcrumb, not Edit +} + +const OUString& RemoteFilesDialog::GetPath() +{ + return m_sPath; +} + +std::vector<OUString> RemoteFilesDialog::GetPathList() const +{ + std::vector<OUString> aList; + sal_uLong nCount = m_pFileView->GetSelectionCount(); + SvTreeListEntry* pEntry = nCount ? m_pFileView->FirstSelected() : NULL; + + while( pEntry ) + { + // url must contain user info, because we need this info in recent files entry + // (to fill user field in login box by default) + INetURLObject aURL( SvtFileView::GetURL( pEntry ) ); + INetURLObject aCurrentURL( m_sLastServiceUrl ); + aURL.SetUser( aCurrentURL.GetUser() ); + + aList.push_back( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + pEntry = m_pFileView->NextSelected( pEntry ); + } + + if( aList.size() == 0 && !m_sPath.isEmpty() ) + aList.push_back( m_sPath ); + + return aList; +} + +bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL ) +{ + try + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), UNO_QUERY_THROW ); + Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); + ::ucbhelper::Content aContent( rURL, xEnv, m_xContext ); + + return aContent.isFolder(); + } + catch( const Exception& ) + { + // a content doesn't exist + } + + return false; +} + +bool RemoteFilesDialog::ContentIsDocument( const OUString& rURL ) +{ + try + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), UNO_QUERY_THROW ); + Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); + ::ucbhelper::Content aContent( rURL, xEnv, m_xContext ); + + return aContent.isDocument(); + } + catch( const Exception& ) + { + // a content doesn't exist + } + + return false; +} + +sal_Int32 RemoteFilesDialog::getTargetColorDepth() +{ + // This dialog doesn't contain preview + return 0; +} + +sal_Int32 RemoteFilesDialog::getAvailableWidth() +{ + // This dialog doesn't contain preview + return 0; +} + +sal_Int32 RemoteFilesDialog::getAvailableHeight() +{ + // This dialog doesn't contain preview + return 0; +} + +void RemoteFilesDialog::setImage( sal_Int16, const ::com::sun::star::uno::Any& ) +{ + // This dialog doesn't contain preview +} + +bool RemoteFilesDialog::getShowState() +{ + // This dialog doesn't contain preview + return false; +} + +Control* RemoteFilesDialog::getControl( sal_Int16, bool) const +{ + return NULL; +} +void RemoteFilesDialog::enableControl( sal_Int16, bool ) +{ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx new file mode 100644 index 000000000000..10dc3ba6d1cb --- /dev/null +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -0,0 +1,215 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX +#define INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX + +#include <comphelper/docpasswordrequest.hxx> + +#include <svtools/autocmpledit.hxx> +#include <svtools/foldertree.hxx> +#include <svtools/place.hxx> +#include <svtools/PlaceEditDialog.hxx> +#include <svtools/breadcrumb.hxx> +#include <svtools/fileview.hxx> + +#include <tools/errinf.hxx> +#include <tools/resid.hxx> + +#include <unotools/viewoptions.hxx> + +#include <vcl/button.hxx> +#include <vcl/fpicker.hrc> +#include <vcl/menubtn.hxx> +#include <vcl/dialog.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/split.hxx> +#include <vcl/svapp.hxx> + +#include <officecfg/Office/Common.hxx> +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/task/PasswordContainer.hpp> +#include <com/sun/star/task/XPasswordContainer2.hpp> + +#include <vector> + +#include "fpdialogbase.hxx" +#include "fpsofficeResMgr.hxx" +#include "OfficeFilePicker.hrc" +#include "QueryFolderName.hxx" +#include "iodlg.hrc" + +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ui::dialogs; + +enum SvtRemoteDlgMode +{ + REMOTEDLG_MODE_OPEN = 0, + REMOTEDLG_MODE_SAVE = 1 +}; + +enum SvtRemoteDlgType +{ + REMOTEDLG_TYPE_FILEDLG = 0, + REMOTEDLG_TYPE_PATHDLG = 1 +}; + +typedef std::shared_ptr< Place > ServicePtr; +typedef ::com::sun::star::uno::Sequence< OUString > OUStringList; + +class FileViewContainer; + +class RemoteFilesDialog : public SvtFileDialog_Base +{ +public: + RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ); + virtual ~RemoteFilesDialog(); + + virtual void dispose() SAL_OVERRIDE; + virtual void Resize() SAL_OVERRIDE; + virtual short Execute() SAL_OVERRIDE; + virtual void Show(); + + OUString GetPath() const; + + // SvtFileDialog_Base + + virtual SvtFileView* GetView() SAL_OVERRIDE; + + virtual void SetHasFilename( bool ) SAL_OVERRIDE; + virtual void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) SAL_OVERRIDE; + virtual const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const SAL_OVERRIDE; + virtual void SetStandardDir( const OUString& rStdDir ) SAL_OVERRIDE; + virtual const OUString& GetStandardDir() const SAL_OVERRIDE; + virtual void SetPath( const OUString& rNewURL ) SAL_OVERRIDE; + virtual const OUString& GetPath() SAL_OVERRIDE; + virtual std::vector<OUString> GetPathList() const SAL_OVERRIDE; + virtual bool ContentIsFolder( const OUString& rURL ) SAL_OVERRIDE; + virtual bool ContentIsDocument( const OUString& rURL ); + + virtual OUString getCurrentFileText() const SAL_OVERRIDE; + virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) SAL_OVERRIDE; + + virtual void AddFilter( const OUString& rFilter, const OUString& rType ) SAL_OVERRIDE; + virtual void AddFilterGroup( const OUString& _rFilter, + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) SAL_OVERRIDE; + virtual OUString GetCurFilter() const SAL_OVERRIDE; + virtual void SetCurFilter( const OUString& rFilter ) SAL_OVERRIDE; + virtual void FilterSelect() SAL_OVERRIDE; + + virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) SAL_OVERRIDE; + virtual void onAsyncOperationStarted() SAL_OVERRIDE; + virtual void onAsyncOperationFinished() SAL_OVERRIDE; + virtual void UpdateControls( const OUString& rURL ) SAL_OVERRIDE; + + virtual void EnableAutocompletion( bool ) SAL_OVERRIDE; + + virtual sal_Int32 getTargetColorDepth() SAL_OVERRIDE; + virtual sal_Int32 getAvailableWidth() SAL_OVERRIDE; + virtual sal_Int32 getAvailableHeight() SAL_OVERRIDE; + + virtual void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ) SAL_OVERRIDE; + + virtual bool getShowState() SAL_OVERRIDE; + + virtual Control* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const SAL_OVERRIDE; + virtual void enableControl( sal_Int16 nControlId, bool bEnable ) SAL_OVERRIDE; + virtual OUString getCurFilter( ) const SAL_OVERRIDE; + +private: + Reference< XComponentContext > m_xContext; + Reference< XPasswordContainer2 > m_xMasterPasswd; + + SvtRemoteDlgMode m_eMode; + SvtRemoteDlgType m_eType; + bool m_bMultiselection; + bool m_bIsUpdated; + bool m_bIsConnected; + bool m_bServiceChanged; + + OUString m_sIniKey; + int m_nWidth; + int m_nHeight; + + OUString m_sPath; + OUString m_sStdDir; + OUString m_sRootLabel; + OUString m_sLastServiceUrl; + unsigned int m_nCurrentFilter; + + ::rtl::Reference< ::svt::AsyncPickerAction > m_pCurrentAsyncAction; + + ::com::sun::star::uno::Sequence< OUString > m_aBlackList; + ::svt::IFilePickerListener* m_pFileNotifier; + + VclPtr< PushButton > m_pOk_btn; + VclPtr< CancelButton > m_pCancel_btn; + VclPtr< MenuButton > m_pAddService_btn; + VclPtr< ListBox > m_pServices_lb; + VclPtr< Breadcrumb > m_pPath; + VclPtr<PushButton> m_pNewFolder; + VclPtr< Splitter > m_pSplitter; + VclPtr< FolderTree > m_pTreeView; + VclPtr< SvtFileView > m_pFileView; + VclPtr< FileViewContainer > m_pContainer; + VclPtr< ListBox > m_pFilter_lb; + VclPtr< AutocompleteEdit > m_pName_ed; + PopupMenu* m_pAddMenu; + + ImageList m_aImages; + + std::vector< ServicePtr > m_aServices; + std::vector< std::pair< OUString, OUString > > m_aFilters; + + void InitSize(); + + void FillServicesListbox(); + + /* If failure returns < 0 */ + int GetSelectedServicePos(); + + FileViewResult OpenURL( OUString const & sURL ); + + void AddFileExtension(); + + void EnableControls(); + void DisableControls(); + + void SavePassword( const OUString& rURL, const OUString& rUser + , const OUString& rPassword, bool bPersistent ); + + DECL_LINK ( AddServiceHdl, void * ); + DECL_LINK ( SelectServiceHdl, void * ); + DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void ); + + DECL_LINK( DoubleClickHdl, void * ); + DECL_LINK( SelectHdl, void * ); + + DECL_LINK( FileNameGetFocusHdl, void * ); + DECL_LINK( FileNameModifyHdl, void * ); + + DECL_LINK( SplitHdl, void * ); + + DECL_LINK( SelectFilterHdl, void * ); + + DECL_LINK( TreeSelectHdl, FolderTree * ); + + DECL_LINK( SelectBreadcrumbHdl, Breadcrumb * ); + + DECL_LINK( NewFolderHdl, void * ); + + DECL_LINK( OkHdl, void * ); + DECL_LINK( CancelHdl, void * ); +}; + +#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/asyncfilepicker.cxx b/fpicker/source/office/asyncfilepicker.cxx index cf6b17b07c8f..8e4c9e3d2ff6 100644 --- a/fpicker/source/office/asyncfilepicker.cxx +++ b/fpicker/source/office/asyncfilepicker.cxx @@ -28,7 +28,7 @@ namespace svt { - AsyncPickerAction::AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction ) + AsyncPickerAction::AsyncPickerAction( SvtFileDialog_Base* _pDialog, SvtFileView* _pView, const Action _eAction ) :m_eAction ( _eAction ) ,m_pView ( _pView ) ,m_pDialog ( _pDialog ) diff --git a/fpicker/source/office/asyncfilepicker.hxx b/fpicker/source/office/asyncfilepicker.hxx index 2174eb50e6ca..bd40153ea8a8 100644 --- a/fpicker/source/office/asyncfilepicker.hxx +++ b/fpicker/source/office/asyncfilepicker.hxx @@ -28,7 +28,7 @@ #include <vcl/vclptr.hxx> class SvtFileView; -class SvtFileDialog; +class SvtFileDialog_Base; typedef ::com::sun::star::uno::Sequence< OUString > OUStringList; @@ -54,13 +54,13 @@ namespace svt private: Action m_eAction; VclPtr<SvtFileView> m_pView; - VclPtr<SvtFileDialog> m_pDialog; + VclPtr<SvtFileDialog_Base> m_pDialog; OUString m_sURL; OUString m_sFileName; bool m_bRunning; public: - AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction ); + AsyncPickerAction( SvtFileDialog_Base* _pDialog, SvtFileView* _pView, const Action _eAction ); /** executes the action diff --git a/fpicker/source/office/commonpicker.hxx b/fpicker/source/office/commonpicker.hxx index a08c31ee2ba0..b74f1a906b7c 100644 --- a/fpicker/source/office/commonpicker.hxx +++ b/fpicker/source/office/commonpicker.hxx @@ -35,7 +35,7 @@ #include <tools/link.hxx> #include <vcl/vclptr.hxx> -class SvtFileDialog; +class SvtFileDialog_Base; namespace vcl { class Window; } struct ImplSVEvent; @@ -65,7 +65,7 @@ namespace svt ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; // </properties> - VclPtr<SvtFileDialog> m_pDlg; + VclPtr<SvtFileDialog_Base> m_pDlg; ImplSVEvent * m_nCancelEvent; bool m_bExecuting; @@ -79,7 +79,7 @@ namespace svt OUString m_aDisplayDirectory; protected: - inline SvtFileDialog* getDialog() { return m_pDlg; } + inline SvtFileDialog_Base* getDialog() { return m_pDlg; } inline const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return OCommonPicker_Base::rBHelper; } inline ::cppu::OBroadcastHelper& GetBroadcastHelper() { return OCommonPicker_Base::rBHelper; } @@ -93,7 +93,7 @@ namespace svt // overridables // will be called with locked SolarMutex - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) = 0; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) = 0; virtual sal_Int16 implExecutePicker( ) = 0; // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ... diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx new file mode 100644 index 000000000000..19a26a41890d --- /dev/null +++ b/fpicker/source/office/fpdialogbase.hxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX +#define INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX + +#include <vcl/dialog.hxx> +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include "svl/inettype.hxx" +#include "asyncfilepicker.hxx" +#include "OfficeControlAccess.hxx" +#include "fpsmartcontent.hxx" + +#include <set> + +// @@@ using namespace com::sun::star::ucb; + + + +class SvTabListBox; +class SvtFileView; +class SvtFileDialogFilter_Impl; + + +#define SFXWB_INSERT ( 0x04000000L | WB_OPEN ) +#define SFXWB_PASSWORD WB_PASSWORD +#define SFXWB_READONLY WB_READONLY +#define SFXWB_PATHDIALOG WB_PATH +#define SFXWB_CLASSPATH ( 0x08000000L | SFXWB_PATHDIALOG ) +#define SFXWB_MULTISELECTION 0x20000000L // activate Multiselection +#define SFXWB_NOREMOTE 0x40000000L + +#define SFX_EXTRA_AUTOEXTENSION 0x00000001L +#define SFX_EXTRA_FILTEROPTIONS 0x00000002L +#define SFX_EXTRA_SHOWVERSIONS 0x00000004L +#define SFX_EXTRA_INSERTASLINK 0x00000008L +#define SFX_EXTRA_SHOWPREVIEW 0x00000010L +#define SFX_EXTRA_TEMPLATES 0x00000020L +#define SFX_EXTRA_PLAYBUTTON 0x00000040L +#define SFX_EXTRA_SELECTION 0x00000080L +#define SFX_EXTRA_IMAGE_TEMPLATE 0x00000100L + +#define FILEDIALOG_FILTER_ALL "*.*" + +// SvtFileDialog_Base + +class SvtFileDialog_Base : public ModalDialog, public ::svt::IFilePickerController +{ +public: + SvtFileDialog_Base( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ) + : ModalDialog( pParent, rID, rUIXMLDescription ) + { + } + + virtual SvtFileView* GetView() = 0; + + virtual void SetHasFilename( bool bHasFilename ) = 0; + virtual void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) = 0; + virtual const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const = 0; + virtual void SetStandardDir( const OUString& rStdDir ) = 0; + virtual const OUString& GetStandardDir() const = 0; + virtual void SetPath( const OUString& rNewURL ) = 0; + virtual const OUString& GetPath() = 0; + virtual std::vector<OUString> GetPathList() const = 0; + virtual bool ContentIsFolder( const OUString& rURL ) = 0; + + virtual OUString getCurrentFileText() const = 0; + virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) = 0; + + virtual void AddFilter( const OUString& rFilter, const OUString& rType ) = 0; + virtual void AddFilterGroup( const OUString& _rFilter, + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) = 0; + virtual OUString GetCurFilter() const = 0; + virtual void SetCurFilter( const OUString& rFilter ) = 0; + virtual void FilterSelect() = 0; + + virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) = 0; + virtual void onAsyncOperationStarted() = 0; + virtual void onAsyncOperationFinished() = 0; + virtual void UpdateControls( const OUString& rURL ) = 0; + + virtual void EnableAutocompletion( bool _bEnable = true ) = 0; + + virtual sal_Int32 getTargetColorDepth() = 0; + virtual sal_Int32 getAvailableWidth() = 0; + virtual sal_Int32 getAvailableHeight() = 0; + + virtual void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ) = 0; + + virtual bool getShowState() = 0; +}; + +#define FILE_SELECTION_CHANGED 1 +#define DIRECTORY_CHANGED 2 +#define HELP_REQUESTED 3 +#define CTRL_STATE_CHANGED 4 +#define DIALOG_SIZE_CHANGED 5 + + +#endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fps_office.component b/fpicker/source/office/fps_office.component index 8804be2a91e9..b76edc61b401 100644 --- a/fpicker/source/office/fps_office.component +++ b/fpicker/source/office/fps_office.component @@ -22,6 +22,9 @@ <implementation name="com.sun.star.svtools.OfficeFilePicker"> <service name="com.sun.star.ui.dialogs.OfficeFilePicker"/> </implementation> + <implementation name="com.sun.star.svtools.RemoteFilePicker"> + <service name="com.sun.star.ui.dialogs.RemoteFilePicker"/> + </implementation> <implementation name="com.sun.star.svtools.OfficeFolderPicker"> <service name="com.sun.star.ui.dialogs.OfficeFolderPicker"/> </implementation> diff --git a/fpicker/source/office/fps_office.cxx b/fpicker/source/office/fps_office.cxx index c98b21f3c095..5e33e83fe2a4 100644 --- a/fpicker/source/office/fps_office.cxx +++ b/fpicker/source/office/fps_office.cxx @@ -28,6 +28,12 @@ static const cppu::ImplementationEntry g_entries[] = { { + SvtRemoteFilePicker::impl_createInstance, + SvtRemoteFilePicker::impl_getStaticImplementationName, + SvtRemoteFilePicker::impl_getStaticSupportedServiceNames, + cppu::createSingleComponentFactory, 0, 0 + }, + { SvtFilePicker::impl_createInstance, SvtFilePicker::impl_getStaticImplementationName, SvtFilePicker::impl_getStaticSupportedServiceNames, diff --git a/fpicker/source/office/fpsmartcontent.hxx b/fpicker/source/office/fpsmartcontent.hxx index cce20ec5061e..b6ffd7281848 100644 --- a/fpicker/source/office/fpsmartcontent.hxx +++ b/fpicker/source/office/fpsmartcontent.hxx @@ -198,8 +198,6 @@ namespace svt } inline bool isFolder( ) { return isFolder( getURL() ); } - inline bool isDocument( ) { return isDocument( getURL() ); } - inline bool is( ) { return is( getURL() ); } }; diff --git a/fpicker/source/office/fpsofficeResMgr.hxx b/fpicker/source/office/fpsofficeResMgr.hxx index 76b45385a5ec..359fc8867f04 100644 --- a/fpicker/source/office/fpsofficeResMgr.hxx +++ b/fpicker/source/office/fpsofficeResMgr.hxx @@ -13,7 +13,7 @@ #include <osl/getglobalmutex.hxx> #include <tools/resmgr.hxx> -namespace +namespace fpicker { struct ResMgrHolder { diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 4e0d5f721cbb..a1ac408313d0 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -100,6 +100,7 @@ using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::container; using namespace ::com::sun::star::task; using namespace ::com::sun::star::sdbc; +using namespace ::fpicker; using namespace ::utl; using namespace ::svt; @@ -303,7 +304,7 @@ SvtFileDialog::SvtFileDialog WinBits nBits, WinBits nExtraBits ) : - ModalDialog( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) + SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) ,_pCbReadOnly( NULL ) ,_pCbLinkBox( NULL) @@ -327,7 +328,7 @@ SvtFileDialog::SvtFileDialog SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits ) - :ModalDialog( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) + :SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) ,_pCbReadOnly( NULL ) ,_pCbLinkBox( NULL) ,_pCbPreviewBox( NULL ) diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index bf01b492d9a9..385613926d26 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -39,6 +39,7 @@ #include "fpsmartcontent.hxx" #include <comphelper/configuration.hxx> #include <comphelper/processfactory.hxx> +#include "fpdialogbase.hxx" #include <set> @@ -50,36 +51,13 @@ class SvTabListBox; class SvtFileView; class SvtFileDialogFilter_Impl; - - -#define SFXWB_INSERT ( 0x04000000L | WB_OPEN ) -#define SFXWB_PASSWORD WB_PASSWORD -#define SFXWB_READONLY WB_READONLY -#define SFXWB_PATHDIALOG WB_PATH -#define SFXWB_CLASSPATH ( 0x08000000L | SFXWB_PATHDIALOG ) -#define SFXWB_MULTISELECTION 0x20000000L // activate Multiselection -#define SFXWB_NOREMOTE 0x40000000L - -#define SFX_EXTRA_AUTOEXTENSION 0x00000001L -#define SFX_EXTRA_FILTEROPTIONS 0x00000002L -#define SFX_EXTRA_SHOWVERSIONS 0x00000004L -#define SFX_EXTRA_INSERTASLINK 0x00000008L -#define SFX_EXTRA_SHOWPREVIEW 0x00000010L -#define SFX_EXTRA_TEMPLATES 0x00000020L -#define SFX_EXTRA_PLAYBUTTON 0x00000040L -#define SFX_EXTRA_SELECTION 0x00000080L -#define SFX_EXTRA_IMAGE_TEMPLATE 0x00000100L - -#define FILEDIALOG_FILTER_ALL "*.*" - - // SvtFileDialog class SvtExpFileDlg_Impl; class CustomContainer; -class SvtFileDialog : public ModalDialog, public ::svt::IFilePickerController +class SvtFileDialog : public SvtFileDialog_Base { private: VclPtr<CheckBox> _pCbReadOnly; @@ -162,7 +140,6 @@ private: protected: virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; - void EnableInternet( bool bInternet ); // originally from VclFileDialog Link<> _aOKHdl; @@ -201,23 +178,23 @@ public: virtual void StartExecuteModal( const Link<>& rEndDialogHdl ) SAL_OVERRIDE; void FileSelect(); - void FilterSelect(); + void FilterSelect() SAL_OVERRIDE; - void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ); - const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const; - void SetStandardDir( const OUString& rStdDir ); - const OUString& GetStandardDir() const; - std::vector<OUString> GetPathList() const; // for MultiSelection + void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) SAL_OVERRIDE; + const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const SAL_OVERRIDE; + void SetStandardDir( const OUString& rStdDir ) SAL_OVERRIDE; + const OUString& GetStandardDir() const SAL_OVERRIDE; + std::vector<OUString> GetPathList() const SAL_OVERRIDE; // for MultiSelection void AddFilter( const OUString& rFilter, - const OUString& rType ); + const OUString& rType ) SAL_OVERRIDE; void AddFilterGroup( const OUString& _rFilter, - const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ); + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) SAL_OVERRIDE; - void SetCurFilter( const OUString& rFilter ); - OUString GetCurFilter() const; + void SetCurFilter( const OUString& rFilter ) SAL_OVERRIDE; + OUString GetCurFilter() const SAL_OVERRIDE; sal_uInt16 GetFilterCount() const; const OUString& GetFilterName( sal_uInt16 nPos ) const; @@ -227,49 +204,42 @@ public: void PrevLevel_Impl(); void OpenURL_Impl( const OUString& rURL ); - inline SvtFileView* GetView() const; + SvtFileView* GetView() SAL_OVERRIDE; - void DisableSaveLastDirectory(); void InitSize(); - void UpdateControls( const OUString& rURL ); - void EnableAutocompletion( bool _bEnable = true ); + void UpdateControls( const OUString& rURL ) SAL_OVERRIDE; + void EnableAutocompletion( bool _bEnable = true ) SAL_OVERRIDE; - void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) { _pFileNotifier = pNotifier; } + void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) SAL_OVERRIDE { _pFileNotifier = pNotifier; } - sal_Int32 getTargetColorDepth(); - sal_Int32 getAvailableWidth(); - sal_Int32 getAvailableHeight(); - void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ); - bool getShowState(); + sal_Int32 getTargetColorDepth() SAL_OVERRIDE; + sal_Int32 getAvailableWidth() SAL_OVERRIDE; + sal_Int32 getAvailableHeight() SAL_OVERRIDE; + void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ) SAL_OVERRIDE; + bool getShowState() SAL_OVERRIDE; bool isAutoExtensionEnabled(); - OUString getCurrentFileText( ) const; - void setCurrentFileText( const OUString& _rText, bool _bSelectAll = false ); + OUString getCurrentFileText( ) const SAL_OVERRIDE; + void setCurrentFileText( const OUString& _rText, bool _bSelectAll = false ) SAL_OVERRIDE; - void onAsyncOperationStarted(); - void onAsyncOperationFinished(); + void onAsyncOperationStarted() SAL_OVERRIDE; + void onAsyncOperationFinished() SAL_OVERRIDE; void RemovablePlaceSelected(bool enable = true); static void displayIOException( const OUString& _rURL, ::com::sun::star::ucb::IOErrorCode _eCode ); // inline - inline void SetPath( const OUString& rNewURL ); - inline void SetHasFilename( bool bHasFilename ); - inline const OUString& GetPath() const; + inline void SetPath( const OUString& rNewURL ) SAL_OVERRIDE; + inline void SetHasFilename( bool bHasFilename ) SAL_OVERRIDE; + inline const OUString& GetPath() SAL_OVERRIDE; inline void SetDefaultExt( const OUString& rExt ); inline void EraseDefaultExt( sal_Int32 _nIndex = 0 ); inline const OUString& GetDefaultExt() const; - inline void SetOKHdl( const Link<>& rLink ); - inline const Link<>& GetOKHdl() const; - inline void SetFileSelectHdl( const Link<>& rLink ); - inline const Link<>& GetFileSelectHdl() const; - inline void SetFilterSelectHdl( const Link<>& rLink ); - inline const Link<>& GetFilterSelectHdl() const; inline Image GetButtonImage( sal_uInt16 _nButtonId ) const { return m_aImages.GetImage( _nButtonId ); } - bool ContentIsFolder( const OUString& rURL ) { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); } + bool ContentIsFolder( const OUString& rURL ) SAL_OVERRIDE { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); } bool ContentHasParentFolder( const OUString& rURL ); bool ContentCanMakeFolder( const OUString& rURL ); bool ContentGetTitle( const OUString& rURL, OUString& rTitle ); @@ -345,7 +315,7 @@ inline void SvtFileDialog::SetHasFilename( bool bHasFilename ) -inline const OUString& SvtFileDialog::GetPath() const +inline const OUString& SvtFileDialog::GetPath() { return _aPath; } @@ -368,74 +338,12 @@ inline const OUString& SvtFileDialog::GetDefaultExt() const } - -inline void SvtFileDialog::SetOKHdl -( - const Link<>& rLink -) -{ - _aOKHdl = rLink; -} - - - -inline const Link<>& SvtFileDialog::GetOKHdl() const -{ - return _aOKHdl; -} - - - -inline void SvtFileDialog::SetFileSelectHdl -( - const Link<>& rLink -) -{ - _aFileSelectHdl = rLink; -} - - - -inline const Link<>& SvtFileDialog::GetFileSelectHdl() const -{ - return _aFileSelectHdl; -} - - - -inline void SvtFileDialog::SetFilterSelectHdl -( - const Link<>& rLink -) -{ - _aFilterSelectHdl = rLink; -} - - - -inline const Link<>& SvtFileDialog::GetFilterSelectHdl() const -{ - return _aFilterSelectHdl; -} - - - -inline SvtFileView* SvtFileDialog::GetView() const +inline SvtFileView* SvtFileDialog::GetView() { return _pFileView; } - - - -#define FILE_SELECTION_CHANGED 1 -#define DIRECTORY_CHANGED 2 -#define HELP_REQUESTED 3 -#define CTRL_STATE_CHANGED 4 -#define DIALOG_SIZE_CHANGED 5 - - #endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.src b/fpicker/source/office/iodlg.src index e09fe0b14165..775b6eef4c69 100644 --- a/fpicker/source/office/iodlg.src +++ b/fpicker/source/office/iodlg.src @@ -105,6 +105,16 @@ String STR_SVT_ALREADYEXISTOVERWRITE Text [ en-US ] = "A file named \"$filename$\" already exists.\n\nDo you want to replace it?" ; }; +String STR_SVT_DELETESERVICE +{ + Text [ en-US ] = "Are you sure you want to delete the service?\n\"$servicename$\"" ; +}; + +String STR_SVT_ROOTLABEL +{ + Text [ en-US ] = "Root" ; +}; + String STR_SVT_NEW_FOLDER { Text [ en-US ] = "Folder" ; diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index dd6244b4fe21..243f6afa620e 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -217,7 +217,6 @@ public: inline const SvtFileDialogFilter_Impl* GetCurFilter( ) const; inline const OUString& GetCurFilterDisplayName() const; void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter, const OUString& _rDisplayName ); - inline void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter ); }; inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link<>& _rHandler ) @@ -261,11 +260,6 @@ inline const OUString& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const return m_sCurrentFilterDisplayName; } -inline void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter ) -{ - SetCurFilter( pFilter, pFilter->GetName() ); -} - #endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui new file mode 100644 index 000000000000..5a439a778554 --- /dev/null +++ b/fpicker/uiconfig/ui/remotefilesdialog.ui @@ -0,0 +1,285 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.12"/> + <object class="GtkDialog" id="RemoteFilesDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Remote Files</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="open"> + <property name="label">gtk-open</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="save"> + <property name="label">gtk-save</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Service:</property> + <accessibility> + <relation type="label-for" target="services_lb"/> + </accessibility> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="services_lb"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <accessibility> + <relation type="labelled-by" target="label1"/> + </accessibility> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="add_service_btn:service_edit_menu"> + <property name="label" translatable="yes">Add service</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="breadcrumb_container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="new_folder"> + <property name="use_action_appearance">False</property> + <property name="width_request">25</property> + <property name="height_request">25</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Create New Folder</property> + <property name="tooltip_text" translatable="yes">Create New Folder</property> + <property name="margin_left">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="container"> + <property name="width_request">555</property> + <property name="height_request">200</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="filterLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Filter</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="nameLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">File name</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="filter_lb"> + <property name="width_request">200</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="filename_container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + </child> + </object> + <object class="GtkMenu" id="service_edit_menu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="edit_service"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Edit service</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="delete_service"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Delete service</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="change_password"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Change password</property> + <property name="use_underline">True</property> + </object> + </child> + </object> +</interface> |