sw lok: .uno:SetDocumentProperties: add file size parameter
problem: in LOK/online to support async save, files in jails may have different extensions (ie: .upload, .uploading) this caused problem to detect files as original file name may not exist. As result property like file size were always set to 0 Change-Id: I552aef203297470d01032659a266210970129e66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165769 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit aa4e10efc6e9ac92b0c652f238526aacbe2096c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166171 Tested-by: Jenkins
This commit is contained in:
committed by
Caolán McNamara
parent
fb94cc0d13
commit
11ae1cf4e4
@@ -82,6 +82,7 @@ private:
|
||||
OUString m_Type;
|
||||
OUString m_Subject;
|
||||
OUString m_Title;
|
||||
sal_Int64 m_nFileSize;
|
||||
bool m_bHasTemplate;
|
||||
bool m_bDeleteUserData;
|
||||
bool m_bUseUserData;
|
||||
@@ -95,7 +96,7 @@ public:
|
||||
SfxDocumentInfoItem( const OUString &rFileName,
|
||||
const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps,
|
||||
const css::uno::Sequence< css::document::CmisProperty> & i_cmisProps,
|
||||
bool bUseUserData, bool bUseThumbnailSave );
|
||||
bool bUseUserData, bool bUseThumbnailSave, sal_Int64 nFileSize );
|
||||
SfxDocumentInfoItem( const SfxDocumentInfoItem& );
|
||||
virtual ~SfxDocumentInfoItem() override;
|
||||
|
||||
@@ -148,6 +149,8 @@ public:
|
||||
void setSubject(const OUString& i_val) { m_Subject = i_val; }
|
||||
const OUString& getTitle() const { return m_Title; }
|
||||
void setTitle(const OUString& i_val) { m_Title = i_val; }
|
||||
sal_Int64 getFileSize() const { return m_nFileSize; }
|
||||
void setFileSize(sal_Int64 i_val) { m_nFileSize = i_val; }
|
||||
|
||||
/// reset user-specific data (author, modified-by, ...)
|
||||
void resetUserData(const OUString & i_rAuthor);
|
||||
|
||||
+1
-1
@@ -3398,7 +3398,7 @@ SfxBoolItem PrintPreview SID_PRINTPREVIEW
|
||||
|
||||
|
||||
SfxVoidItem SetDocumentProperties SID_DOCINFO
|
||||
(SfxDocumentInfoItem Properties SID_DOCINFO, SfxUnoAnyItem UpdatedProperties FN_PARAM_1)
|
||||
(SfxDocumentInfoItem Properties SID_DOCINFO, SfxUnoAnyItem UpdatedProperties FN_PARAM_1, SfxStringItem FileSize FN_PARAM_2)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
||||
@@ -180,6 +180,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem()
|
||||
, m_isAutoloadEnabled(false)
|
||||
, m_EditingCycles(0)
|
||||
, m_EditingDuration(0)
|
||||
, m_nFileSize(-1)
|
||||
, m_bHasTemplate( true )
|
||||
, m_bDeleteUserData( false )
|
||||
, m_bUseUserData( true )
|
||||
@@ -190,7 +191,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem()
|
||||
SfxDocumentInfoItem::SfxDocumentInfoItem( const OUString& rFile,
|
||||
const uno::Reference<document::XDocumentProperties>& i_xDocProps,
|
||||
const uno::Sequence<document::CmisProperty>& i_cmisProps,
|
||||
bool bIs, bool _bIs )
|
||||
bool bIs, bool _bIs, sal_Int64 _nFileSize )
|
||||
: SfxStringItem( SID_DOCINFO, rFile )
|
||||
, m_AutoloadDelay( i_xDocProps->getAutoloadSecs() )
|
||||
, m_AutoloadURL( i_xDocProps->getAutoloadURL() )
|
||||
@@ -210,6 +211,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const OUString& rFile,
|
||||
i_xDocProps->getKeywords()) )
|
||||
, m_Subject( i_xDocProps->getSubject() )
|
||||
, m_Title( i_xDocProps->getTitle() )
|
||||
, m_nFileSize( _nFileSize )
|
||||
, m_bHasTemplate( true )
|
||||
, m_bDeleteUserData( false )
|
||||
, m_bUseUserData( bIs )
|
||||
@@ -280,6 +282,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem )
|
||||
, m_Type(rItem.getType())
|
||||
, m_Subject( rItem.getSubject() )
|
||||
, m_Title( rItem.getTitle() )
|
||||
, m_nFileSize ( rItem.m_nFileSize )
|
||||
, m_bHasTemplate( rItem.m_bHasTemplate )
|
||||
, m_bDeleteUserData( rItem.m_bDeleteUserData )
|
||||
, m_bUseUserData( rItem.m_bUseUserData )
|
||||
@@ -1117,9 +1120,13 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
|
||||
|
||||
// determine size and type
|
||||
OUString aSizeText( m_aUnknownSize );
|
||||
if ( aURL.GetProtocol() == INetProtocol::File ||
|
||||
aURL.isAnyKnownWebDAVScheme() )
|
||||
aSizeText = CreateSizeText( SfxContentHelper::GetSize( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ) );
|
||||
// we might already know the size as an optional argument passed to .uno:SetDocumentProperties
|
||||
sal_Int64 nSize = rInfoItem.getFileSize();
|
||||
// otherwise, for some protocols we can reliably query for it
|
||||
if (nSize == -1 && (aURL.GetProtocol() == INetProtocol::File || aURL.isAnyKnownWebDAVScheme()))
|
||||
nSize = SfxContentHelper::GetSize( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
||||
if (nSize != -1)
|
||||
aSizeText = CreateSizeText( nSize );
|
||||
m_xShowSizeFT->set_label( aSizeText );
|
||||
|
||||
OUString aDescription = SvFileInformationManager::GetDescription( INetURLObject(rMainURL) );
|
||||
|
||||
@@ -658,13 +658,15 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
|
||||
bReadOnly = pROItem->GetValue();
|
||||
|
||||
// URL for dialog
|
||||
const SfxStringItem* pFileSize = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
|
||||
sal_Int64 nFileSize = pFileSize ? pFileSize->GetValue().toInt64() : -1;
|
||||
const OUString aURL( HasName() ? GetMedium()->GetName() : GetFactory().GetFactoryURL() );
|
||||
|
||||
Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
|
||||
uno::Sequence< document::CmisProperty> aCmisProperties = xCmisDoc->getCmisProperties();
|
||||
|
||||
SfxDocumentInfoItem aDocInfoItem( aURL, getDocProperties(), aCmisProperties,
|
||||
IsUseUserData(), IsUseThumbnailSave() );
|
||||
IsUseUserData(), IsUseThumbnailSave(), nFileSize );
|
||||
const SfxPoolItemHolder aSlotState(GetSlotState(SID_DOCTEMPLATE));
|
||||
if (!aSlotState)
|
||||
// templates not supported
|
||||
@@ -681,7 +683,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
|
||||
// creating dialog is done via virtual method; application will
|
||||
// add its own statistics page
|
||||
std::shared_ptr<SfxDocumentInfoDialog> xDlg(CreateDocumentInfoDialog(rReq.GetFrameWeld(), aSet));
|
||||
auto aFunc = [this, xDlg, xCmisDoc](sal_Int32 nResult, SfxRequest& rRequest)
|
||||
auto aFunc = [this, xDlg, xCmisDoc, nFileSize](sal_Int32 nResult, SfxRequest& rRequest)
|
||||
{
|
||||
if (RET_OK == nResult)
|
||||
{
|
||||
@@ -698,7 +700,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
|
||||
SetUseThumbnailSave( pDocInfoItem-> IsUseThumbnailSave() );
|
||||
// add data from dialog for possible recording purpose
|
||||
rRequest.AppendItem( SfxDocumentInfoItem( GetTitle(),
|
||||
getDocProperties(), aNewCmisProperties, IsUseUserData(), IsUseThumbnailSave() ) );
|
||||
getDocProperties(), aNewCmisProperties, IsUseUserData(), IsUseThumbnailSave(), nFileSize ) );
|
||||
}
|
||||
rRequest.Done();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user