make pop-up on Encrypt With GPG Key modal

Not setting any parent window for XDocumentDigitalSignatures
causes the key selection window to be non-modal, letting the
user keep editing the document without completing the
encryption interaction.

Change-Id: Ic7e66cb43606355beaffc720b7c23cdf4f81d934
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170630
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
This commit is contained in:
Sarper Akdemir 2024-07-17 15:17:32 +02:00
parent f8c68d3499
commit 2648907f51
3 changed files with 13 additions and 3 deletions

View file

@ -431,7 +431,12 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData(
return aEncryptionData; return aEncryptionData;
} }
uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionData() uno::Sequence<beans::NamedValue>
OStorageHelper::CreateGpgPackageEncryptionData(const css::uno::Reference<css::awt::XWindow>&
#if HAVE_FEATURE_GPGME
xParentWindow
#endif
)
{ {
#if HAVE_FEATURE_GPGME #if HAVE_FEATURE_GPGME
// generate session key // generate session key
@ -451,6 +456,8 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat
security::DocumentDigitalSignatures::createDefault( security::DocumentDigitalSignatures::createDefault(
comphelper::getProcessComponentContext())); comphelper::getProcessComponentContext()));
xSigner->setParentWindow(xParentWindow);
// fire up certificate chooser dialog - user can multi-select! // fire up certificate chooser dialog - user can multi-select!
const uno::Sequence< uno::Reference< security::XCertificate > > xSignCertificates= const uno::Sequence< uno::Reference< security::XCertificate > > xSignCertificates=
xSigner->chooseEncryptionCertificate(); xSigner->chooseEncryptionCertificate();

View file

@ -45,6 +45,7 @@ namespace com::sun::star {
} }
namespace lang { class XSingleServiceFactory; } namespace lang { class XSingleServiceFactory; }
namespace uno { class XComponentContext; } namespace uno { class XComponentContext; }
namespace awt { class XWindow; }
} }
namespace comphelper { namespace comphelper {
@ -175,7 +176,7 @@ public:
std::u16string_view aPassword ); std::u16string_view aPassword );
static css::uno::Sequence< css::beans::NamedValue > static css::uno::Sequence< css::beans::NamedValue >
CreateGpgPackageEncryptionData(); CreateGpgPackageEncryptionData(const css::uno::Reference<css::awt::XWindow>& xParentWindow);
static bool IsValidZipEntryFileName( std::u16string_view aName, bool bSlashAllowed ); static bool IsValidZipEntryFileName( std::u16string_view aName, bool bSlashAllowed );

View file

@ -1584,7 +1584,9 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
try try
{ {
// ask for keys // ask for keys
aEncryptionData = ::comphelper::OStorageHelper::CreateGpgPackageEncryptionData(); aEncryptionData
= ::comphelper::OStorageHelper::CreateGpgPackageEncryptionData(
GetFrameInterface());
break; // user cancelled or we've some keys now break; // user cancelled or we've some keys now
} }
catch( const IllegalArgumentException& ) catch( const IllegalArgumentException& )