[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - cui/source cui/uiconfig

2018-03-08 Thread Katarina Behrens
 cui/source/options/optgenrl.cxx |   14 +-
 cui/source/options/treeopt.cxx  |7 +++
 cui/uiconfig/ui/optuserpage.ui  |7 +--
 3 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit 1bf5ced5335e110f5e402d292e6c31bac617a655
Author: Katarina Behrens 
Date:   Tue Feb 20 10:08:55 2018 +0100

tdf#115015: make crypto settings better fit allocated space

Oh dear how much do I dislike fixed size dialogs. Everytime they
are enlarged to fit new content (esp. gtk3 is rather space-greedy
there) someone starts to whine the dialog is now too large

Doing what e6d7d7375221 does is not really an option, since there
are some 30+ tabpages to try and test for optimal size here.

And two more squashed commits:

tdf#1155015: Make sure checkbox text really wraps

for :wrap property to be effective, a reasonable height request is
needed so the text is not forced into single line again

tdf#115994: Extensions' option pages need fixed pref. size

as they are fixed size .xdl-based dialogs mostly
But because of tdf#115015 calculate this preferred size as approx.
14 text edits + some padding to make sure crypto settings will fit
the allocated space

Change-Id: I3ffb2d794f76781eb62186093b928289593585cf
Reviewed-on: https://gerrit.libreoffice.org/50596
Tested-by: Jenkins 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 0816a8c49821..eca06bb66f6a 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -302,7 +302,7 @@ void SvxGeneralTabPage::InitCryptography()
 {
 #if HAVE_FEATURE_GPGME
 m_pCryptoFrame->Show();
-// unused yet, I just wanted to see if this delivers the desired results
+
 uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
 try
 {
@@ -321,6 +321,18 @@ void SvxGeneralTabPage::InitCryptography()
 m_pEncryptionKeyLB->InsertEntry( xCert->getIssuerName());
 }
 }
+
+ //tdf#115015: wrap checkbox text and listboxes if necessary
+ Size aPrefSize(m_pEncryptToSelfCB->get_preferred_size());
+ Size 
aSize(m_pEncryptToSelfCB->CalcMinimumSize(40*approximate_char_width()));
+ if (aPrefSize.Width() > aSize.Width())
+ {
+ m_pSigningKeyLB->set_width_request(aSize.Width());
+ m_pEncryptionKeyLB->set_width_request(aSize.Width());
+ m_pEncryptToSelfCB->set_width_request(aSize.Width());
+ m_pEncryptToSelfCB->set_height_request(aSize.Height());
+ }
+
 }
 }
 catch ( uno::Exception const & )
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 076a000d86b2..fccf0c14df59 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -490,9 +491,15 @@ void OfaTreeOptionsDialog::InitWidgets()
 get(pTabBox, "box");
 Size aSize(pTabBox->LogicToPixel(Size(278, 259), 
MapMode(MapUnit::MapAppFont)));
 pTabBox->set_width_request(aSize.Width());
+#if HAVE_FEATURE_GPGME
+// tdf#115015: make enough space for crypto settings (approx. 14 text 
edits + padding)
+pTabBox->set_height_request((Edit::GetMinimumEditSize().Height() + 6) * 
14);
+#else
 pTabBox->set_height_request(aSize.Height() - 
get_action_area()->get_preferred_size().Height());
+#endif
 pTreeLB->set_width_request(pTreeLB->approximate_char_width() * 25);
 pTreeLB->set_height_request(pTabBox->get_height_request());
+
 }
 
 // Ctor() with Frame -
diff --git a/cui/uiconfig/ui/optuserpage.ui b/cui/uiconfig/ui/optuserpage.ui
index 96c0a77cfad0..ac080f43b32c 100644
--- a/cui/uiconfig/ui/optuserpage.ui
+++ b/cui/uiconfig/ui/optuserpage.ui
@@ -883,8 +883,9 @@
 
 
   
-False
 True
+False
+True
 liststore1
   
   
@@ -896,6 +897,7 @@
   
 True
 False
+True
 liststore1
   
   
@@ -904,10 +906,11 @@
   
 
 
-  
+  
 When encrypting documents, always encrypt 
to self
 True
 True
+0
 False
 True
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - cui/source cui/uiconfig

2017-12-18 Thread Katarina Behrens
 cui/source/inc/cuioptgenrl.hxx  |6 
 cui/source/options/optgenrl.cxx |   56 ++--
 cui/uiconfig/ui/optuserpage.ui  |   27 +--
 3 files changed, 73 insertions(+), 16 deletions(-)

New commits:
commit 5aa5843d4dc668899776192d8200b06a6156
Author: Katarina Behrens 
Date:   Tue Dec 12 14:03:05 2017 +0100

List private GPG keys in crypto config dialog

Change-Id: I7cb6a14adcc5424b432589120c66deeddf86b652
Reviewed-on: https://gerrit.libreoffice.org/46691
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 
(cherry picked from commit e0c3e356fd9151819db13d844f87ec200e2dbee3)
Reviewed-on: https://gerrit.libreoffice.org/46758
Tested-by: Jenkins 

diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx
index 0c56b6cdcde6..b612ccf687ff 100644
--- a/cui/source/inc/cuioptgenrl.hxx
+++ b/cui/source/inc/cuioptgenrl.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -40,6 +41,10 @@ class SvxGeneralTabPage : public SfxTabPage
 private:
 // the "Use data for document properties" checkbox
 VclPtr m_pUseDataCB;
+VclPtr m_pCryptoFrame;
+VclPtr m_pSigningKeyLB;
+VclPtr m_pEncryptionKeyLB;
+VclPtr m_pEncryptToSelfCB;
 // rows
 struct Row;
 std::vector vRows;
@@ -56,6 +61,7 @@ private:
 voidSetData_Impl();
 
 void InitControls ();
+void InitCryptography();
 void SetLinks ();
 
 protected:
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 5750cc9ff7a0..b63fbf580b69 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -211,22 +212,20 @@ SvxGeneralTabPage::SvxGeneralTabPage(vcl::Window* 
pParent, const SfxItemSet& rCo
 : SfxTabPage(pParent, "OptUserPage", "cui/ui/optuserpage.ui", )
 {
 get(m_pUseDataCB, "usefordocprop");
+
+get(m_pCryptoFrame, "cryptography");
+get(m_pSigningKeyLB, "signingkey");
+get(m_pEncryptionKeyLB, "encryptionkey");
+get(m_pEncryptToSelfCB, "encrypttoself");
 InitControls();
-SetExchangeSupport(); // this page needs ExchangeSupport
-SetLinks();
 #if HAVE_FEATURE_GPGME
-// unused yet, I just wanted to see if this delivers the desired results
-uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
-try
-{
-xSEInitializer = xml::crypto::GPGSEInitializer::create( 
comphelper::getProcessComponentContext() );
-uno::Reference xSC = 
xSEInitializer->createSecurityContext( OUString() );
-// completely bogus, this is just to appease loplugins
-xSEInitializer->freeSecurityContext( xSC );
-}
-catch ( uno::Exception const & )
-{}
+InitCryptography();
+#else
+m_pCryptoFrame->Hide();
 #endif
+
+SetExchangeSupport(); // this page needs ExchangeSupport
+SetLinks();
 }
 
 SvxGeneralTabPage::~SvxGeneralTabPage()
@@ -237,6 +236,10 @@ SvxGeneralTabPage::~SvxGeneralTabPage()
 void SvxGeneralTabPage::dispose()
 {
 m_pUseDataCB.clear();
+m_pSigningKeyLB.clear();
+m_pEncryptionKeyLB.clear();
+m_pEncryptToSelfCB.clear();
+m_pCryptoFrame.clear();
 SfxTabPage::dispose();
 }
 
@@ -295,6 +298,33 @@ void SvxGeneralTabPage::InitControls ()
 }
 }
 
+void SvxGeneralTabPage::InitCryptography()
+{
+#if HAVE_FEATURE_GPGME
+m_pCryptoFrame->Show();
+// unused yet, I just wanted to see if this delivers the desired results
+uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
+try
+{
+xSEInitializer = xml::crypto::GPGSEInitializer::create( 
comphelper::getProcessComponentContext() );
+uno::Reference xSC = 
xSEInitializer->createSecurityContext( OUString() );
+uno::Reference xSE = 
xSC->getSecurityEnvironment();
+uno::Sequence xCertificates = 
xSE->getPersonalCertificates();
+
+if (xCertificates.hasElements())
+{
+for (auto& xCert : xCertificates)
+{
+m_pSigningKeyLB->InsertEntry( xCert->getIssuerName());
+m_pEncryptionKeyLB->InsertEntry( xCert->getIssuerName());
+}
+}
+}
+catch ( uno::Exception const & )
+{}
+#endif
+
+}
 
 void SvxGeneralTabPage::SetLinks ()
 {
diff --git a/cui/uiconfig/ui/optuserpage.ui b/cui/uiconfig/ui/optuserpage.ui
index ad893936cb0f..96c0a77cfad0 100644
--- a/cui/uiconfig/ui/optuserpage.ui
+++ b/cui/uiconfig/ui/optuserpage.ui
@@ -2,6 +2,17 @@
 
 
   
+  
+
+  
+  
+
+
+  
+No 
key
+  
+
+  
   
 True
 False
@@ -825,7 +836,8 @@
   
 
 
-  
+  
+True
 False
 0
 none
@@ -837,11 +849,13 @@
 12