From f1abe3035cc237609dc4d20f3dd9c6e2484ef7a8 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 4 Nov 2011 21:04:18 +0000 Subject: gtk: cleanup to make the vcl file-picker interface work. --- cui/source/options/optgdlg.cxx | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index e08dcc797afb..72355b768ea0 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -124,20 +124,11 @@ int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ ) namespace { - ::rtl::OUString impl_SystemFileOpenServiceName() + static ::rtl::OUString impl_SystemFileOpenServiceName() { - const ::rtl::OUString &rDesktopEnvironment = - Application::GetDesktopEnvironment(); + const ::rtl::OUString &rDesktopEnvironment = Application::GetDesktopEnvironment(); - if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) ) - { - #ifdef ENABLE_GTK - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.GtkFilePicker") ); - #else - return rtl::OUString(); - #endif - } - else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) + if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) { #ifdef ENABLE_KDE4 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDE4FilePicker") ); @@ -162,10 +153,14 @@ namespace #endif } - sal_Bool lcl_HasSystemFilePicker() + static bool lcl_HasSystemFilePicker() { + if( Application::hasNativeFileSelection() ) + return true; + + // Otherwise fall-back on querying services + bool bRet = false; Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - sal_Bool bRet = sal_False; Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY ); Reference< XSet > xSet( xFactory, UNO_QUERY ); @@ -178,7 +173,7 @@ namespace ::rtl::OUString aFileService = impl_SystemFileOpenServiceName(); Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService ); if ( xEnum.is() && xEnum->hasMoreElements() ) - bRet = sal_True; + bRet = true; } catch (const IllegalArgumentException&) { -- cgit