Kaydet (Commit) 7660e4dc authored tarafından Tomofumi Yagi's avatar Tomofumi Yagi Kaydeden (comit) Stephan Bergmann

tdf#89694 Password dialog for opening OOXML shows url-encoded path

We need to convert a path string to decoded it for OOXML with a password as ODF
is so. This patch adds the converting process for OOXML.

In addition, this patch moves the decoded-point of URL into
css.task.Document[MS]PasswordRequest ctor from the outside. This decoded-point of
URL into ctor is common for OOXML and ODF.

(notes: Strange to say, css.task.Document[MS]PasswordRequest ctor needs "aDocURL",
    but methods in interaction-handler use "aDocumentName" as the parameter.
    Probably this will be fixed in near future.)

Change-Id: I0ecfddf0f70ea5810df52d9ca8637f483a26df2f
Reviewed-on: https://gerrit.libreoffice.org/14677Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
Tested-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 5378963b
...@@ -37,7 +37,7 @@ module com { module sun { module star { module task { ...@@ -37,7 +37,7 @@ module com { module sun { module star { module task {
*/ */
published exception DocumentMSPasswordRequest: PasswordRequest published exception DocumentMSPasswordRequest: PasswordRequest
{ {
/** the name of the document /** the name of the document (more properly, the URL of the document)
*/ */
string Name; string Name;
......
...@@ -37,7 +37,7 @@ module com { module sun { module star { module task { ...@@ -37,7 +37,7 @@ module com { module sun { module star { module task {
*/ */
published exception DocumentPasswordRequest: PasswordRequest published exception DocumentPasswordRequest: PasswordRequest
{ {
/** the name of the document /** the name of the document (more properly, the URL of the document)
*/ */
string Name; string Name;
......
...@@ -114,7 +114,7 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S ...@@ -114,7 +114,7 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S
if ( pPasswordItem ) if ( pPasswordItem )
aPassword = pPasswordItem->GetValue(); aPassword = pPasswordItem->GetValue();
OUString aDocName = INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ); OUString aDocName = rMedium.GetOrigURL();
bool bIsDefaultPassword = false; bool bIsDefaultPassword = false;
aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
......
...@@ -241,7 +241,7 @@ sal_uInt32 CheckPasswd_Impl ...@@ -241,7 +241,7 @@ sal_uInt32 CheckPasswd_Impl
if ( pEncryptionDataItem ) if ( pEncryptionDataItem )
pEncryptionDataItem->GetValue() >>= aEncryptionData; pEncryptionDataItem->GetValue() >>= aEncryptionData;
OUString aDocumentName = INetURLObject( pFile->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); OUString aDocumentName = pFile->GetOrigURL();
SfxDocPasswordVerifier aVerifier( xStorage ); SfxDocPasswordVerifier aVerifier( xStorage );
aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "passworddlg.hxx" #include "passworddlg.hxx"
#include "ids.hrc" #include "ids.hrc"
#include <tools/urlobj.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -71,8 +72,10 @@ PasswordDialog::PasswordDialog(vcl::Window* _pParent, ...@@ -71,8 +72,10 @@ PasswordDialog::PasswordDialog(vcl::Window* _pParent,
SetText( aTitle ); SetText( aTitle );
sal_uInt16 nStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN; sal_uInt16 nStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN;
m_pFTPassword->SetText(ResId(nStrId, *pResourceMgr).toString()); OUString aMessage(ResId(nStrId, *pResourceMgr).toString());
m_pFTPassword->SetText( m_pFTPassword->GetText() + aDocURL ); aMessage += INetURLObject(aDocURL).GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS);
m_pFTPassword->SetText(aMessage);
if (bIsSimplePasswordRequest) if (bIsSimplePasswordRequest)
{ {
DBG_ASSERT( aDocURL.isEmpty(), "A simple password request should not have a document URL! Use document password request instead." ); DBG_ASSERT( aDocURL.isEmpty(), "A simple password request should not have a document URL! Use document password request instead." );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment