summaryrefslogtreecommitdiff
path: root/padmin
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-11 15:43:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-23 10:26:40 +0200
commitc988da288ec473a28f61ebb53aa3ff82bab11ef4 (patch)
tree284f184384dba369c40e0caff533a2d683e9d478 /padmin
parenteb016138e817d686795e1902a7a295d93639da27 (diff)
fdo#46808, Adapt ui::dialogs::FolderPicker UNO service to new style
Create a merged XFolderPicker2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: I4a2c2a8d491a8d5633c19ddcea547f0efe75b91d
Diffstat (limited to 'padmin')
-rw-r--r--padmin/source/helper.cxx56
1 files changed, 25 insertions, 31 deletions
diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx
index 3b1892c664fd..2be65266d5a8 100644
--- a/padmin/source/helper.cxx
+++ b/padmin/source/helper.cxx
@@ -26,7 +26,7 @@
#include <vcl/msgbox.hxx>
#include <tools/config.hxx>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
#include <com/sun/star/ui/dialogs/XControlAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
@@ -275,42 +275,36 @@ void padmin::freePadminRC()
bool padmin::chooseDirectory( String& rInOutPath )
{
bool bRet = false;
- Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
- if( xFactory.is() )
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);;
+ Reference< XControlAccess > xCA( xFolderPicker, UNO_QUERY );
+ if( xCA.is() )
{
- Reference< XFolderPicker > xFolderPicker( xFactory->createInstance( OUString( "com.sun.star.ui.dialogs.FolderPicker" ) ), UNO_QUERY );
- if( xFolderPicker.is() )
+ try
{
- Reference< XControlAccess > xCA( xFolderPicker, UNO_QUERY );
- if( xCA.is() )
- {
- try
- {
- Any aState;
- aState <<= sal_False;
- xCA->setControlProperty( OUString( "HelpButton" ),
- OUString( "Visible" ),
- aState );
+ Any aState;
+ aState <<= sal_False;
+ xCA->setControlProperty( OUString( "HelpButton" ),
+ OUString( "Visible" ),
+ aState );
- }
- catch( ... )
- {
- }
- }
- INetURLObject aObj( rInOutPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
- xFolderPicker->setDisplayDirectory( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
- if( xFolderPicker->execute() == ExecutableDialogResults::OK )
- {
- aObj = INetURLObject( xFolderPicker->getDirectory() );
- rInOutPath = aObj.PathToFileName();
- bRet = true;
- }
}
+ catch( ... )
+ {
+ }
+ }
+ INetURLObject aObj( rInOutPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
+ xFolderPicker->setDisplayDirectory( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+ if( xFolderPicker->execute() == ExecutableDialogResults::OK )
+ {
+ aObj = INetURLObject( xFolderPicker->getDirectory() );
+ rInOutPath = aObj.PathToFileName();
+ bRet = true;
+ }
#if OSL_DEBUG_LEVEL > 1
- else
- fprintf( stderr, "could not get FolderPicker service\n" );
+ else
+ fprintf( stderr, "could not get FolderPicker service\n" );
#endif
- }
return bRet;
}