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

Szymon Kłos eszkadev at gmail.com
Tue Jun 30 14:20:24 PDT 2015


 include/sfx2/filedlghelper.hxx       |    1 +
 include/sfx2/sfxsids.hrc             |    1 +
 sfx2/source/appl/appopen.cxx         |   26 ++++++--------------------
 sfx2/source/dialog/filedlghelper.cxx |    2 ++
 4 files changed, 10 insertions(+), 20 deletions(-)

New commits:
commit 998f6f60e1bcd6d83c64a1c4799badf2d8bf4ba4
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Tue Jun 30 23:18:55 2015 +0200

    added RemoteFilesDialog support in FileDialogHelper_Impl
    
    Change-Id: Ic4854841deeebeccd31cd1b78680755cd97fdfbb

diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx
index 53a4fc3..2e55cd9 100644
--- a/include/sfx2/filedlghelper.hxx
+++ b/include/sfx2/filedlghelper.hxx
@@ -236,6 +236,7 @@ public:
 #define SFX2_IMPL_DIALOG_CONFIG 0
 #define SFX2_IMPL_DIALOG_SYSTEM 1
 #define SFX2_IMPL_DIALOG_OOO 2
+#define SFX2_IMPL_DIALOG_REMOTE 3
 
 ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
                              sal_Int64 nFlags,
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 47a4b83..0f4344e 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -138,6 +138,7 @@
 
 #define SID_FORCERELOAD                     (SID_SFX_START + 1502)
 #define SID_FILE_DIALOG                     (SID_SFX_START + 304)
+#define SID_REMOTE_DIALOG                   (SID_SFX_START + 305)
 #define SID_PATH                            (SID_SFX_START + 308)
 #define SID_SAVEDOCS                        (SID_SFX_START + 309)
 #define SID_STANDARD_DIR                    (SID_SFX_START + 450)
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 6b607d1..a334c97 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -625,6 +625,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
         if ( pSystemDialogItem )
             nDialog = pSystemDialogItem->GetValue() ? SFX2_IMPL_DIALOG_SYSTEM : SFX2_IMPL_DIALOG_OOO;
 
+        SFX_REQUEST_ARG( rReq, pRemoteDialogItem, SfxBoolItem, SID_REMOTE_DIALOG, false );
+        if ( pRemoteDialogItem && pRemoteDialogItem->GetValue())
+            nDialog = SFX2_IMPL_DIALOG_REMOTE;
+
         OUString sStandardDir;
 
         SFX_REQUEST_ARG( rReq, pStandardDirItem, SfxStringItem, SID_STANDARD_DIR, false );
@@ -1123,26 +1127,8 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
 
 void SfxApplication::OpenRemoteExec_Impl( SfxRequest& rReq )
 {
-    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");
-
-    short nResult = aDlg->Execute();
-
-    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 ) );
-
-        GetDispatcher_Impl()->Execute( SID_OPENDOC, SfxCallMode::SYNCHRON, *rReq.GetArgs() );
-    }
+    rReq.AppendItem( SfxBoolItem( SID_REMOTE_DIALOG, true ) );
+    GetDispatcher_Impl()->Execute( SID_OPENDOC, SfxCallMode::SYNCHRON, *rReq.GetArgs() );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 4ca8364..9578c67 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -863,6 +863,8 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
         pServiceName = FILE_OPEN_SERVICE_NAME_OOO;
     else if ( nDialog == SFX2_IMPL_DIALOG_OOO )
         pServiceName = FILE_OPEN_SERVICE_NAME_OOO;
+    else if ( nDialog == SFX2_IMPL_DIALOG_REMOTE )
+        pServiceName = "com.sun.star.ui.dialogs.RemoteFilePicker";
     else
         pServiceName = "com.sun.star.ui.dialogs.FilePicker";
     OUString aService = OUString::createFromAscii( pServiceName );


More information about the Libreoffice-commits mailing list