[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - sfx2/source

Szymon Kłos eszkadev at gmail.com
Thu Jun 25 03:39:54 PDT 2015


 sfx2/source/appl/appopen.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit c1f4ed516a3d415b26920792210f7ea27fa04218
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jun 25 12:38:25 2015 +0200

    open only if RET_OK
    
    Change-Id: Ib9a62d2540ed2d6fad6efedd1fba59bfa4eb635b

diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 9ae4b91..6b607d1 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -1123,23 +1123,26 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
 
 void SfxApplication::OpenRemoteExec_Impl( SfxRequest& rReq )
 {
-    ScopedVclPtrInstance< RemoteFilesDialog > aDlg((vcl::Window*)NULL, WB_OPEN);
+    ScopedVclPtrInstance< RemoteFilesDialog > aDlg( ( vcl::Window* )NULL, WB_OPEN );
 
     // Filters for test purposes
     aDlg->AddFilter("All files", FILTER_ALL);
     aDlg->AddFilter("ODT files", "*.odt");
     aDlg->AddFilter("ODS files", "*.ods");
 
-    aDlg->Execute();
+    short nResult = aDlg->Execute();
 
-    OUString sFileName = aDlg->GetPath();
+    if( nResult == RET_OK )
+    {
+        OUString sFileName = aDlg->GetPath();
 
-    rReq.AppendItem( SfxStringItem( SID_TARGETNAME, OUString("_default") ) );
-    rReq.AppendItem( SfxStringItem( SID_REFERER, "private:user" ) );
-    rReq.RemoveItem( SID_FILE_NAME );
-    rReq.AppendItem( SfxStringItem( SID_FILE_NAME, sFileName ) );
+        rReq.AppendItem( SfxStringItem( SID_TARGETNAME, OUString( "_default" ) ) );
+        rReq.AppendItem( SfxStringItem( SID_REFERER, "private:user" ) );
+        rReq.RemoveItem( SID_FILE_NAME );
+        rReq.AppendItem( SfxStringItem( SID_FILE_NAME, sFileName ) );
 
-    GetDispatcher_Impl()->Execute( SID_OPENDOC, SfxCallMode::SYNCHRON, *rReq.GetArgs() );
+        GetDispatcher_Impl()->Execute( SID_OPENDOC, SfxCallMode::SYNCHRON, *rReq.GetArgs() );
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list