[Libreoffice-commits] core.git: 2 commits - sfx2/source sfx2/uiconfig

Caolán McNamara caolanm at redhat.com
Fri Jun 21 08:09:49 PDT 2013


 sfx2/source/doc/docfile.cxx          |   29 ++++++++++++++++++++++++++---
 sfx2/uiconfig/ui/documentinfopage.ui |    3 +++
 2 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit ecdd9d1a47587aa7557c1b151010c78efa90fef2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 21 16:05:04 2013 +0100

    Resolves: fdo#65501 ensure configured backup dir exists before using it
    
    the ucb stuff is the most god awful painful api ever
    
    Change-Id: I491d2cb9b7d5d37723b32f0a26a22a09c16bc02e

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 543e8e8..711718f 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2123,6 +2123,25 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont
         aTransactTemp.EnableKillingFile( true );
 }
 
+bool ensureFolder(
+    uno::Reference< uno::XComponentContext > xCtx,
+    uno::Reference< ucb::XCommandEnvironment > xEnv,
+    const OUString& rFolder, ucbhelper::Content & result)
+{
+    INetURLObject aURL( rFolder );
+    OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
+    aURL.removeSegment();
+    ::ucbhelper::Content aParent;
+
+    if ( ::ucbhelper::Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ),
+                              xEnv, xCtx, aParent ) )
+    {
+        return ::utl::UCBContentHelper::MakeFolder(aParent, aTitle, result);
+    }
+
+    return false;
+}
+
 //------------------------------------------------------------------
 void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent )
 {
@@ -2136,9 +2155,13 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont
     sal_Int32 nPrefixLen = aFileName.lastIndexOf( '.' );
     String aPrefix = ( nPrefixLen == -1 ) ? aFileName : aFileName.copy( 0, nPrefixLen );
     String aExtension = ( nPrefixLen == -1 ) ? String() : String(aFileName.copy( nPrefixLen ));
-       String aBakDir = SvtPathOptions().GetBackupPath();
+    String aBakDir = SvtPathOptions().GetBackupPath();
 
-    DoInternalBackup_Impl( aOriginalContent, aPrefix, aExtension, aBakDir );
+    // create content for the parent folder ( = backup folder )
+    ::ucbhelper::Content  aContent;
+    Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
+    if( ensureFolder(comphelper::getProcessComponentContext(), xEnv, aBakDir, aContent) )
+        DoInternalBackup_Impl( aOriginalContent, aPrefix, aExtension, aBakDir );
 
     if ( pImp->m_aBackupURL.isEmpty() )
     {
@@ -2177,7 +2200,7 @@ void SfxMedium::DoBackup_Impl()
         // create content for the parent folder ( = backup folder )
         ::ucbhelper::Content  aContent;
         Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
-        if( ::ucbhelper::Content::create( aBakDir, xEnv, comphelper::getProcessComponentContext(), aContent ) )
+        if( ensureFolder(comphelper::getProcessComponentContext(), xEnv, aBakDir, aContent) )
         {
             // save as ".bak" file
             INetURLObject aDest( aBakDir );
commit ee5c49c9d1eeef842ca4fc181f962236b32a20ce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 21 16:06:02 2013 +0100

    center buttons vertically
    
    Change-Id: Ibe2aea7608a85b169ffc26a83912b58b06a3473d

diff --git a/sfx2/uiconfig/ui/documentinfopage.ui b/sfx2/uiconfig/ui/documentinfopage.ui
index eeccbd0..2809979 100644
--- a/sfx2/uiconfig/ui/documentinfopage.ui
+++ b/sfx2/uiconfig/ui/documentinfopage.ui
@@ -230,6 +230,7 @@
         <property name="can_focus">True</property>
         <property name="receives_default">True</property>
         <property name="no_show_all">True</property>
+        <property name="valign">center</property>
       </object>
       <packing>
         <property name="left_attach">2</property>
@@ -244,6 +245,7 @@
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="receives_default">True</property>
+        <property name="valign">center</property>
         <property name="use_underline">True</property>
       </object>
       <packing>
@@ -381,6 +383,7 @@
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="receives_default">True</property>
+        <property name="valign">center</property>
         <property name="use_underline">True</property>
       </object>
       <packing>


More information about the Libreoffice-commits mailing list