sfx2/source/dialog/filedlghelper.cxx | 23 +++++++++++++++++++++++ sfx2/source/dialog/filedlgimpl.hxx | 2 ++ vcl/unx/gtk/gdi/salprn-gtk.cxx | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-)
New commits: commit d347e443e2c847d50f45ac810c5f78de3b892e3a Author: David Tardon <dtar...@redhat.com> Date: Wed Mar 28 13:25:25 2012 +0200 bypass GtkSalPrinter when it is not enabled Signed-off-by: Bjoern Michaelsen <bjoern.michael...@canonical.com> diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx index fb25aec..b8c182f 100644 --- a/vcl/unx/gtk/gdi/salprn-gtk.cxx +++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx @@ -236,7 +236,7 @@ GtkSalPrinter::StartJob( vcl::PrinterController& io_rController) { if (!lcl_useSystemPrintDialog()) - return impl_doJob(i_pFileName, i_rJobName, i_rAppName, io_pSetupData, 1, false, io_rController); + return PspSalPrinter::StartJob(i_pFileName, i_rJobName, i_rAppName, io_pSetupData, io_rController); assert(!m_pImpl); commit 2890ca399dd23abd9b8b507d80f7242fce735278 Author: Andrzej J. R. Hunt <andr...@hunt.org> Date: Tue Mar 27 10:32:52 2012 +0200 fdo#43895 lp#905355: Never let users save in /tmp by default (cherry picked from commit dd2fe95cce75f1157bd1c75d286a0047b2e4175e) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 141b389..79c1e4e 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -100,6 +100,9 @@ #include <helpid.hrc> #include <sfxlocal.hrc> #include <rtl/strbuf.hxx> +#ifdef UNX +#include <sys/stat.h> +#endif //----------------------------------------------------------------------------- @@ -1648,6 +1651,24 @@ void FileDialogHelper_Impl::getRealFilter( String& _rFilter ) const } } +void FileDialogHelper_Impl::verifyPath() +{ +#ifdef UNX + struct stat aFileStat; + const OString sFullPath = OUStringToOString( maPath.copy(RTL_CONSTASCII_LENGTH("file://")) + maFileName, osl_getThreadTextEncoding() ); + stat( sFullPath.getStr(), &aFileStat ); + // lp#905355, fdo#43895 + // Check that the file has read only permission and is in /tmp -- this is + // the case if we have opened the file from the web with firefox only. + if ( maPath.reverseCompareToAsciiL("file:///tmp",11) == 0 && + ( aFileStat.st_mode & (S_IRWXO + S_IRWXG + S_IRWXU) ) == S_IRUSR ) + { + maPath = SvtPathOptions().GetWorkPath(); + mxFileDlg->setDisplayDirectory( maPath ); + } +#endif +} + // ------------------------------------------------------------------------ void FileDialogHelper_Impl::displayFolder( const ::rtl::OUString& _rPath ) { @@ -1661,6 +1682,7 @@ void FileDialogHelper_Impl::displayFolder( const ::rtl::OUString& _rPath ) try { mxFileDlg->setDisplayDirectory( maPath ); + verifyPath(); } catch( const IllegalArgumentException& ) { @@ -1678,6 +1700,7 @@ void FileDialogHelper_Impl::setFileName( const ::rtl::OUString& _rFile ) try { mxFileDlg->setDefaultName( maFileName ); + verifyPath(); } catch( const IllegalArgumentException& ) { diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 6770bb7..3433883 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -155,6 +155,8 @@ namespace sfx2 void implInitializeFileName( ); + void verifyPath( ); + void implGetAndCacheFiles( const ::com::sun::star::uno::Reference< XInterface >& xPicker , SvStringsDtor*& rpURLList, const SfxFilter* pFilter ); _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits