diff options
author | Henry Castro <hcastro@collabora.com> | 2018-03-01 16:11:44 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2018-03-02 19:55:01 +0100 |
commit | 0950917b9514069e8dbf92b9c0fbd44b492a7cd1 (patch) | |
tree | fa450d498c714295791e2f0a29d1bce87a52dd4e | |
parent | e802e960f8f7343eec1a14eba70b7affc6298968 (diff) |
lokdialog: convert the dialog File -> Properties... to async exec
Change-Id: I677760e9b154256c00ea4e99fd40204744f3cd21
Reviewed-on: https://gerrit.libreoffice.org/50600
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 49 |
1 files changed, 29 insertions, 20 deletions
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; |