qt: Add "Sign with default certificate" to QtFilePicker

Extend `QtFilePicker` to implement the new feature
added and implemented for other file picker implementations
in

    commit 426c641976
    Author: Sarper Akdemir <sarper.akdemir@allotropia.de>
    Date:   Wed Jul 17 12:47:22 2024 +0200

        tdf#159040: add sign with default certificate to save dialog

This makes the checkbox show up when opening the
"Save As" dialog in Writer using Ctrl+Shift+S and
behaves as expected when a GPG key has previously been
set in "Tools" -> "Options" -> "User Data"
-> "Signing Key".

When no signing key is set there, the checkbox currently
isn't disabled as expected, but that's a separate issue,
also seen with the "Edit filter settings" checkbox that
is disabled with gtk3, but not with qt6 independent of this
commit.

Change-Id: I9edf65a31f8268feb13fd6abf627744d68fd79e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173453
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2024-09-16 14:06:39 +02:00
parent 25058a2785
commit 8429fcf97c

View File

@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <config_gpgme.h>
#include <fpicker/fpsofficeResMgr.hxx>
#include <QtFilePicker.hxx>
#include <QtFilePicker.moc>
@@ -658,6 +660,9 @@ void QtFilePicker::addCustomControl(sal_Int16 controlId)
case CHECKBOX_GPGENCRYPTION:
resId = STR_SVT_FILEPICKER_GPGENCRYPT;
break;
case CHECKBOX_GPGSIGN:
resId = STR_SVT_FILEPICKER_GPGSIGN;
break;
case PUSHBUTTON_PLAY:
resId = STR_SVT_FILEPICKER_PLAY;
break;
@@ -702,6 +707,7 @@ void QtFilePicker::addCustomControl(sal_Int16 controlId)
case CHECKBOX_PREVIEW:
case CHECKBOX_SELECTION:
case CHECKBOX_GPGENCRYPTION:
case CHECKBOX_GPGSIGN:
widget = new QCheckBox(getResString(resId), m_pExtraControls);
break;
case PUSHBUTTON_PLAY:
@@ -786,6 +792,9 @@ void SAL_CALL QtFilePicker::initialize(const uno::Sequence<uno::Any>& args)
addCustomControl(CHECKBOX_AUTOEXTENSION);
addCustomControl(CHECKBOX_PASSWORD);
addCustomControl(CHECKBOX_GPGENCRYPTION);
#if HAVE_FEATURE_GPGME
addCustomControl(CHECKBOX_GPGSIGN);
#endif
break;
case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
@@ -793,6 +802,9 @@ void SAL_CALL QtFilePicker::initialize(const uno::Sequence<uno::Any>& args)
addCustomControl(CHECKBOX_AUTOEXTENSION);
addCustomControl(CHECKBOX_PASSWORD);
addCustomControl(CHECKBOX_GPGENCRYPTION);
#if HAVE_FEATURE_GPGME
addCustomControl(CHECKBOX_GPGSIGN);
#endif
addCustomControl(CHECKBOX_FILTEROPTIONS);
break;