xmlsecurity/source/dialogs/certificatechooser.cxx  |   17 +++++++--
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |   36 ++++++++++++++++++++-
 2 files changed, 48 insertions(+), 5 deletions(-)

New commits:
commit a19aa4754651e685ca07131bfa454c3360191269
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Mon Jul 15 09:19:45 2024 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Mon Jul 15 13:00:41 2024 +0200

    tdf#161871 Revert "Removed Type and Usage Columns from Certificate Chooser"
    
    The commit broke the display of all columns except the first one in all
    backends except gtk3.
    
    Also it's not clear why those columns are deemed superfluous;
    see discussion in tdf#161871
    
    This reverts commit 9f327102c435887bbae650b3a573f44500b6f534.
    
    Change-Id: Idc3496122137f98c23bb7df8e36b17281fc948d3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170491
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx 
b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 0575ae758cfe..5b3d80291297 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -56,6 +56,14 @@ CertificateChooser::CertificateChooser(weld::Window* 
_pParent,
     auto nControlWidth = m_xCertLB->get_approximate_digit_width() * 105;
     m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12));
 
+    std::vector<int> aWidths
+    {
+        o3tl::narrowing<int>(30*nControlWidth/100),
+        o3tl::narrowing<int>(30*nControlWidth/100),
+        o3tl::narrowing<int>(10*nControlWidth/100),
+        o3tl::narrowing<int>(20*nControlWidth/100)
+    };
+    m_xCertLB->set_column_fixed_widths(aWidths);
     m_xCertLB->connect_changed( LINK( this, CertificateChooser, 
CertificateHighlightHdl ) );
     m_xCertLB->connect_row_activated( LINK( this, CertificateChooser, 
CertificateSelectHdl ) );
     m_xViewBtn->connect_clicked( LINK( this, CertificateChooser, ViewButtonHdl 
) );
@@ -221,7 +229,6 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
             mvUserData.push_back(userData);
 
             OUString sIssuer = xmlsec::GetContentPart( xCert->getIssuerName(), 
xCert->getCertificateKind());
-            OUString sExpDate = utl::GetDateString(xCert->getNotValidAfter());
 
             // If we are searching and there is no match skip
             if (mbSearch
@@ -232,11 +239,13 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
 
             m_xCertLB->append();
             int nRow = m_xCertLB->n_children() - 1;
-            OUString sId(weld::toId(userData.get()));
-            m_xCertLB->set_id(nRow, sId);
             m_xCertLB->set_text(nRow, 
xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind()), 
0);
             m_xCertLB->set_text(nRow, sIssuer, 1);
-            m_xCertLB->set_text(nRow, sExpDate, 2);
+            m_xCertLB->set_text(nRow, 
xmlsec::GetCertificateKind(xCert->getCertificateKind()), 2);
+            m_xCertLB->set_text(nRow, 
utl::GetDateString(xCert->getNotValidAfter()), 3);
+            m_xCertLB->set_text(nRow, 
UsageInClearText(xCert->getCertificateUsage()), 4);
+            OUString sId(weld::toId(userData.get()));
+            m_xCertLB->set_id(nRow, sId);
 
 #if HAVE_FEATURE_GPGME
             // only GPG has preferred keys
diff --git a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui 
b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
index aae6bd44024f..c06ce07952d1 100644
--- a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
+++ b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
@@ -8,8 +8,12 @@
       <column type="gchararray"/>
       <!-- column-name text2 -->
       <column type="gchararray"/>
+      <!-- column-name text3 -->
+      <column type="gchararray"/>
       <!-- column-name text4 -->
       <column type="gchararray"/>
+      <!-- column-name text5 -->
+      <column type="gchararray"/>
       <!-- column-name id -->
       <column type="gchararray"/>
     </columns>
@@ -168,7 +172,7 @@
                       <object class="GtkTreeViewColumn" id="treeviewcolumn5">
                         <property name="resizable">True</property>
                         <property name="spacing">6</property>
-                        <property name="title" translatable="yes" 
context="selectcertificatedialog|type">Expiration date</property>
+                        <property name="title" translatable="yes" 
context="selectcertificatedialog|type">Type</property>
                         <property name="sort-indicator">True</property>
                         <property name="sort-column-id">2</property>
                         <child>
@@ -179,6 +183,36 @@
                         </child>
                       </object>
                     </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn6">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <property name="title" translatable="yes" 
context="selectcertificatedialog|expiration">Expiration date</property>
+                        <property name="sort-indicator">True</property>
+                        <property name="sort-column-id">3</property>
+                        <child>
+                          <object class="GtkCellRendererText" 
id="cellrenderer4"/>
+                          <attributes>
+                            <attribute name="text">3</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn7">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <property name="title" translatable="yes" 
context="selectcertificatedialog|usage">Certificate usage</property>
+                        <property name="sort-indicator">True</property>
+                        <property name="sort-column-id">4</property>
+                        <child>
+                          <object class="GtkCellRendererText" 
id="cellrenderer5"/>
+                          <attributes>
+                            <attribute name="text">4</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
                     <child internal-child="accessible">
                       <object class="AtkObject" id="signatures-atkobject">
                         <property name="AtkObject::accessible-description" 
translatable="yes" 
context="selectcertificatedialog|extended_tip|signatures">Select the 
certificate that you want to digitally sign the current document 
with.</property>

Reply via email to