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

Henry Castro hcastro at collabora.com
Fri Mar 2 18:55:30 UTC 2018


 sfx2/source/doc/objserv.cxx |   49 ++++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 20 deletions(-)

New commits:
commit 0950917b9514069e8dbf92b9c0fbd44b492a7cd1
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu Mar 1 16:11:44 2018 -0400

    lokdialog: convert the dialog File -> Properties... to async exec
    
    Change-Id: I677760e9b154256c00ea4e99fd40204744f3cd21
    Reviewed-on: https://gerrit.libreoffice.org/50600
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index c69cbe927643..aaf71fb25586 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -468,30 +468,39 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
                 // creating dialog is done via virtual method; application will
                 // add its own statistics page
-                ScopedVclPtr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(aSet));
-                if ( RET_OK == pDlg->Execute() )
+                VclAbstractDialog::AsyncContext aCtx;
+                std::shared_ptr<SfxRequest> pReq = std::make_shared<SfxRequest>(rReq);
+                VclPtr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(aSet));
+
+                aCtx.mxOwner = pDlg;
+                aCtx.maEndDialogFn = [this, pDlg, xCmisDoc, pReq](sal_Int32 nResult)
                 {
-                    const SfxDocumentInfoItem* pDocInfoItem = SfxItemSet::GetItem<SfxDocumentInfoItem>(pDlg->GetOutputItemSet(), SID_DOCINFO, false);
-                    if ( pDocInfoItem )
+                    if (RET_OK == nResult)
                     {
-                        // user has done some changes to DocumentInfo
-                        pDocInfoItem->UpdateDocumentInfo(getDocProperties());
-                        uno::Sequence< document::CmisProperty > aNewCmisProperties =
-                            pDocInfoItem->GetCmisProperties( );
-                        if ( aNewCmisProperties.getLength( ) > 0 )
-                            xCmisDoc->updateCmisProperties( aNewCmisProperties );
-                        SetUseUserData( pDocInfoItem->IsUseUserData() );
-                        SetUseThumbnailSave( pDocInfoItem-> IsUseThumbnailSave() );
-                        // add data from dialog for possible recording purpose
-                        rReq.AppendItem( SfxDocumentInfoItem( GetTitle(),
-                            getDocProperties(), aNewCmisProperties, IsUseUserData(), IsUseThumbnailSave() ) );
+                        const SfxDocumentInfoItem* pDocInfoItem = SfxItemSet::GetItem<SfxDocumentInfoItem>(pDlg->GetOutputItemSet(), SID_DOCINFO, false);
+                        if ( pDocInfoItem )
+                        {
+                            // user has done some changes to DocumentInfo
+                            pDocInfoItem->UpdateDocumentInfo(getDocProperties());
+                            uno::Sequence< document::CmisProperty > aNewCmisProperties =
+                                pDocInfoItem->GetCmisProperties( );
+                            if ( aNewCmisProperties.getLength( ) > 0 )
+                                xCmisDoc->updateCmisProperties( aNewCmisProperties );
+                            SetUseUserData( pDocInfoItem->IsUseUserData() );
+                            SetUseThumbnailSave( pDocInfoItem-> IsUseThumbnailSave() );
+                            // add data from dialog for possible recording purpose
+                            pReq->AppendItem( SfxDocumentInfoItem( GetTitle(),
+                                getDocProperties(), aNewCmisProperties, IsUseUserData(), IsUseThumbnailSave() ) );
+                        }
+                        pReq->Done();
                     }
+                    else
+                        // nothing done; no recording
+                        pReq->Ignore();
+                };
 
-                    rReq.Done();
-                }
-                else
-                    // nothing done; no recording
-                    rReq.Ignore();
+                pDlg->StartExecuteAsync(aCtx);
+                rReq.Ignore();
             }
 
             return;


More information about the Libreoffice-commits mailing list