dbaccess/inc/strings.hrc                          |    3 
 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx |   32 ----
 dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx |   13 -
 dbaccess/uiconfig/ui/postgrespage.ui              |  168 +++++++++++++---------
 4 files changed, 104 insertions(+), 112 deletions(-)

New commits:
commit 90f40e996fe1aaa93606f7e1b1fb60882bcf058b
Author:     Olivier Hallot <[email protected]>
AuthorDate: Thu Jun 15 14:17:30 2023 -0300
Commit:     Olivier Hallot <[email protected]>
CommitDate: Tue Jun 20 16:21:27 2023 +0200

    tdf#43369 Refactor PosgresSQL connection setup
    
    + Moved static strings to ui file, handled by Glade
    + added extended tips to widgets
    + deleted references to strings in the controller.
    
    Change-Id: I0acb444eff37adbfc0225656669af9d5650b7bd0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153127
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <[email protected]>

diff --git a/dbaccess/inc/strings.hrc b/dbaccess/inc/strings.hrc
index 9683fb67d06a..2db9ce75c467 100644
--- a/dbaccess/inc/strings.hrc
+++ b/dbaccess/inc/strings.hrc
@@ -398,9 +398,6 @@
 #define STR_SPREADSHEET_HELPTEXT                    
NC_("STR_SPREADSHEET_HELPTEXT", "Click 'Browse...' to select a %PRODUCTNAME 
spreadsheet or Microsoft Excel workbook.\n%PRODUCTNAME will open this file in 
read-only mode." )
 #define STR_SPREADSHEETPATH                         NC_("STR_SPREADSHEETPATH", 
"~Location and file name" )
 
-#define STR_POSTGRES_HEADERTEXT                     
NC_("STR_POSTGRES_HEADERTEXT", "Set up a connection to a PostgreSQL database" )
-#define STR_POSTGRES_HELPTEXT                       
NC_("STR_POSTGRES_HELPTEXT", "Please enter the required information to connect 
to a PostgreSQL database, either by entering the host name, port number and 
server, or by entering the connection string.\nPlease contact your system 
administrator if you are unsure about the following settings.")
-#define STR_POSTGRES_DEFAULT                        
NC_("STR_POSTGRES_DEFAULT", "Default: 5432")
 #define STR_COMMAND_EXECUTED_SUCCESSFULLY           
NC_("STR_COMMAND_EXECUTED_SUCCESSFULLY", "Command successfully executed." )
 #define STR_DIRECTSQL_CONNECTIONLOST                
NC_("STR_DIRECTSQL_CONNECTIONLOST", "The connection to the database has been 
lost. This dialog will be closed.")
 
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx 
b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 2c1846495a7c..5f9e9fe16a45 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -503,29 +503,14 @@ using namespace ::com::sun::star;
     }
 
     // OPostgresConnectionPageSetup
-    OPostgresConnectionPageSetup::OPostgresConnectionPageSetup( 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
_rCoreAttrs ,sal_uInt16 _nPortId, TranslateId pDefaultPortResId, TranslateId 
pHelpTextResId, TranslateId pHeaderTextResId, TranslateId pConnectionTextResId)
+    OPostgresConnectionPageSetup::OPostgresConnectionPageSetup( 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
_rCoreAttrs , sal_uInt16 _nPortId )
         : OGenericAdministrationPage(pPage, pController, 
"dbaccess/ui/postgrespage.ui", "SpecialPostgresPage", _rCoreAttrs)
         , m_nPortId(_nPortId)
-        , m_xHeaderText(m_xBuilder->weld_label("header"))
-        , m_xFTHelpText(m_xBuilder->weld_label("helpLabel"))
-        , m_xFTDatabasename(m_xBuilder->weld_label("dbNameLabel"))
         , m_xETDatabasename(m_xBuilder->weld_entry("dbNameEntry"))
-        , m_xFTHostname(m_xBuilder->weld_label("hostNameLabel"))
         , m_xETHostname(m_xBuilder->weld_entry("hostNameEntry"))
-        , m_xFTPortNumber(m_xBuilder->weld_label("portNumLabel"))
-        , m_xFTDefaultPortNumber(m_xBuilder->weld_label("portNumDefLabel"))
         , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumEntry"))
-        , m_xFTConnection(m_xBuilder->weld_label("connectionStringLabel"))
         , m_xConnectionURL(new 
OConnectionURLEdit(m_xBuilder->weld_entry("browseurl"), 
m_xBuilder->weld_label("browselabel")))
-        // , m_pCollection(nullptr)
     {
-        m_xFTConnection->set_label(DBA_RES(pConnectionTextResId));
-        m_xFTDefaultPortNumber->set_label(DBA_RES(pDefaultPortResId));
-        OUString sHelpText = DBA_RES(pHelpTextResId);
-        m_xFTHelpText->set_label(sHelpText);
-        //TODO this code snippet is redundant
-        m_xHeaderText->set_label(DBA_RES(pHeaderTextResId));
-
         m_xETDatabasename->connect_changed(LINK(this, 
OGenericAdministrationPage, OnControlEntryModifyHdl));
         m_xETHostname->connect_changed(LINK(this, OGenericAdministrationPage, 
OnControlEntryModifyHdl));
         m_xNFPortNumber->connect_value_changed(LINK(this, 
OGenericAdministrationPage, OnControlSpinButtonModifyHdl));
@@ -546,11 +531,7 @@ using namespace ::com::sun::star;
     {
         return std::make_unique<OPostgresConnectionPageSetup>(pPage, 
pController,
                                                           _rAttrSet,
-                                                          
DSID_POSTGRES_PORTNUMBER,
-                                                          STR_POSTGRES_DEFAULT,
-                                                          
STR_POSTGRES_HELPTEXT,
-                                                          
STR_POSTGRES_HEADERTEXT,
-                                                          STR_COMMONURL);
+                                                          
DSID_POSTGRES_PORTNUMBER);
     }
 
     void OPostgresConnectionPageSetup::fillControls(std::vector< 
std::unique_ptr<ISaveValueWrapper> >& _rControlList)
@@ -571,14 +552,8 @@ using namespace ::com::sun::star;
         return bChangedSomething;
     }
 
-    void OPostgresConnectionPageSetup::fillWindows(std::vector< 
std::unique_ptr<ISaveValueWrapper> >& _rControlList)
+    void OPostgresConnectionPageSetup::fillWindows(std::vector< 
std::unique_ptr<ISaveValueWrapper> >& /*_rControlList*/)
     {
-        _rControlList.emplace_back(new 
ODisableWidgetWrapper<weld::Label>(m_xFTHelpText.get()));
-        _rControlList.emplace_back(new 
ODisableWidgetWrapper<weld::Label>(m_xFTDatabasename.get()));
-        _rControlList.emplace_back(new 
ODisableWidgetWrapper<weld::Label>(m_xFTHostname.get()));
-        _rControlList.emplace_back(new 
ODisableWidgetWrapper<weld::Label>(m_xFTPortNumber.get()));
-        _rControlList.emplace_back(new 
ODisableWidgetWrapper<weld::Label>(m_xFTDefaultPortNumber.get()));
-        _rControlList.emplace_back(new 
ODisableWidgetWrapper<weld::Label>(m_xFTConnection.get()));
     }
 
     void OPostgresConnectionPageSetup::implInitControls(const SfxItemSet& 
_rSet, bool _bSaveValue)
@@ -588,7 +563,6 @@ using namespace ::com::sun::star;
         bool bValid, bReadonly;
         getFlags(_rSet, bValid, bReadonly);
 
-        m_xFTConnection->show();
         m_xConnectionURL->show();
         m_xConnectionURL->ShowPrefix( false);
 
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx 
b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 9f47fff7d9c9..543bd3e80d09 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -222,11 +222,7 @@ namespace dbaui
     public:
         OPostgresConnectionPageSetup(weld::Container* pPage, 
weld::DialogController* pController
                                         , const SfxItemSet& _rCoreAttrs
-                                        , sal_uInt16 _nPortId
-                                        , TranslateId pDefaultPortResId
-                                        , TranslateId pHelpTextResId
-                                        , TranslateId pHeaderTextResId
-                                        , TranslateId pConnectionTextResId );
+                                        , sal_uInt16 _nPortId );
     virtual ~OPostgresConnectionPageSetup() override;
     static std::unique_ptr<OGenericAdministrationPage> CreatePostgresTabPage( 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
_rAttrSet );
     ::dbaccess::ODsnTypeCollection* m_pCollection;
@@ -241,16 +237,9 @@ namespace dbaui
         TypedWhichId<SfxInt32Item> m_nPortId;
 
         std::unique_ptr<weld::Label> m_xHeaderText;
-        std::unique_ptr<weld::Label> m_xFTHelpText;
-        std::unique_ptr<weld::Label> m_xFTDatabasename;
         std::unique_ptr<weld::Entry> m_xETDatabasename;
-        std::unique_ptr<weld::Label> m_xFTHostname;
         std::unique_ptr<weld::Entry> m_xETHostname;
-        std::unique_ptr<weld::Label> m_xFTPortNumber;
-        std::unique_ptr<weld::Label> m_xFTDefaultPortNumber;
         std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
-
-        std::unique_ptr<weld::Label> m_xFTConnection;
         std::unique_ptr<OConnectionURLEdit> m_xConnectionURL;
 
         /** used for the connection URL
diff --git a/dbaccess/uiconfig/ui/postgrespage.ui 
b/dbaccess/uiconfig/ui/postgrespage.ui
index ce814a40a310..e5867ec4122d 100644
--- a/dbaccess/uiconfig/ui/postgrespage.ui
+++ b/dbaccess/uiconfig/ui/postgrespage.ui
@@ -1,35 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="dba">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">1000000000000</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
+    <property name="step-increment">1</property>
+    <property name="page-increment">10</property>
   </object>
   <object class="GtkBox" id="SpecialPostgresPage">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
+    <property name="can-focus">False</property>
     <property name="hexpand">True</property>
     <property name="vexpand">True</property>
-    <property name="border_width">6</property>
+    <property name="border-width">6</property>
     <property name="orientation">vertical</property>
     <property name="spacing">12</property>
     <child>
       <object class="GtkLabel" id="header">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="halign">start</property>
-        <property name="margin_bottom">6</property>
+        <property name="margin-bottom">6</property>
+        <property name="label" translatable="yes" 
context="postgrespage|header">Set up a connection to a PostgreSQL 
database</property>
+        <attributes>
+          <attribute name="weight" value="bold"/>
+        </attributes>
         <child internal-child="accessible">
-          <object class="AtkObject">
+          <object class="AtkObject" id="header-atkobject">
             <property name="AtkObject::accessible-description" 
translatable="yes" context="specialpostgrespage|header">Set up connection to a 
PostgreSQL database</property>
             <property name="AtkObject::accessible-role">static</property>
           </object>
         </child>
-        <attributes>
-          <attribute name="weight" value="bold"/>
-        </attributes>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -40,17 +41,18 @@
     <child>
       <object class="GtkLabel" id="helpLabel">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
+        <property name="label" translatable="yes" 
context="postgrespage|helpLabel">Please enter the required information to 
connect to a PostgreSQL database, either by entering the host name, port number 
and server, or by entering the connection string.</property>
+        <property name="wrap">True</property>
+        <property name="width-chars">72</property>
+        <property name="max-width-chars">72</property>
+        <property name="xalign">0</property>
         <child internal-child="accessible">
-          <object class="AtkObject">
+          <object class="AtkObject" id="helpLabel-atkobject">
             <property name="AtkObject::accessible-description" 
translatable="yes" context="specialpostgrespage|helpLabel">Please enter the 
required information to connect to a PostgreSQL database. Please contact your 
system administrator if you are unsure about the following settings. </property>
             <property name="AtkObject::accessible-role">static</property>
           </object>
         </child>
-        <property name="wrap">True</property>
-        <property name="width_chars">72</property>
-        <property name="max_width_chars">72</property>
-        <property name="xalign">0</property>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -59,96 +61,124 @@
       </packing>
     </child>
     <child>
-      <!-- n-columns=1 n-rows=1 -->
+      <object class="GtkLabel" id="helpSupport">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="label" translatable="yes" 
context="postgrespage|helpSupport">Please contact your system administrator if 
you are unsure</property>
+        <property name="xalign">0</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <!-- n-columns=2 n-rows=3 -->
       <object class="GtkGrid" id="grid1">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">12</property>
+        <property name="row-spacing">6</property>
+        <property name="column-spacing">12</property>
         <child>
           <object class="GtkLabel" id="dbNameLabel">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="label" translatable="yes" 
context="specialpostgrespage|dbNameLabel">_Database name:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">dbNameEntry</property>
+            <property name="use-underline">True</property>
+            <property name="mnemonic-widget">dbNameEntry</property>
             <property name="xalign">1</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
+            <property name="left-attach">0</property>
+            <property name="top-attach">0</property>
           </packing>
         </child>
         <child>
           <object class="GtkLabel" id="hostNameLabel">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="label" translatable="yes" 
context="specialpostgrespage|hostNameLabel">_Server:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">hostNameEntry</property>
+            <property name="use-underline">True</property>
+            <property name="mnemonic-widget">hostNameEntry</property>
             <property name="xalign">1</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
+            <property name="left-attach">0</property>
+            <property name="top-attach">1</property>
           </packing>
         </child>
         <child>
           <object class="GtkLabel" id="portNumLabel">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="label" translatable="yes" 
context="specialpostgrespage|portNumLabel">_Port number:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">portNumEntry</property>
+            <property name="use-underline">True</property>
+            <property name="mnemonic-widget">portNumEntry</property>
             <property name="xalign">1</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
+            <property name="left-attach">0</property>
+            <property name="top-attach">2</property>
           </packing>
         </child>
         <child>
           <object class="GtkEntry" id="dbNameEntry">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
+            <property name="can-focus">True</property>
             <property name="hexpand">True</property>
+            <property name="activates-default">True</property>
             <property name="truncate-multiline">True</property>
-            <property name="activates_default">True</property>
+            <child internal-child="accessible">
+              <object class="AtkObject" id="dbNameEntry-atkobject">
+                <property name="AtkObject::accessible-description" 
translatable="yes" context="postgrespage|extended_tip|dbNameEntry">Enter the 
name of the database.</property>
+              </object>
+            </child>
           </object>
           <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">0</property>
+            <property name="left-attach">1</property>
+            <property name="top-attach">0</property>
           </packing>
         </child>
         <child>
           <object class="GtkEntry" id="hostNameEntry">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
+            <property name="can-focus">True</property>
             <property name="hexpand">True</property>
+            <property name="activates-default">True</property>
             <property name="truncate-multiline">True</property>
-            <property name="activates_default">True</property>
+            <child internal-child="accessible">
+              <object class="AtkObject" id="hostNameEntry-atkobject">
+                <property name="AtkObject::accessible-description" 
translatable="yes" context="postgrespage|extended_tip|hostNameEntry">Enter the 
server url of the database. </property>
+              </object>
+            </child>
           </object>
           <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
+            <property name="left-attach">1</property>
+            <property name="top-attach">1</property>
           </packing>
         </child>
         <child>
           <object class="GtkBox" id="box1">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="hexpand">True</property>
             <property name="spacing">12</property>
             <child>
               <object class="GtkSpinButton" id="portNumEntry">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
+                <property name="can-focus">True</property>
                 <property name="hexpand">True</property>
-                <property name="activates_default">True</property>
+                <property name="activates-default">True</property>
                 <property name="truncate-multiline">True</property>
                 <property name="adjustment">adjustment1</property>
+                <child internal-child="accessible">
+                  <object class="AtkObject" id="portNumEntry-atkobject">
+                    <property name="AtkObject::accessible-description" 
translatable="yes" context="postgrespage|extended_tip|portNumEntry">Enter the 
port number of the DBMS service. Default for PostgreSQL is 5432.</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -159,7 +189,7 @@
             <child>
               <object class="GtkLabel" id="portNumDefLabel">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="label" translatable="yes" 
context="specialpostgrespage|portNumDefLabel">Default: 5432</property>
               </object>
               <packing>
@@ -170,43 +200,43 @@
             </child>
           </object>
           <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
+            <property name="left-attach">1</property>
+            <property name="top-attach">2</property>
           </packing>
         </child>
       </object>
       <packing>
         <property name="expand">False</property>
         <property name="fill">True</property>
-        <property name="position">2</property>
+        <property name="position">3</property>
       </packing>
     </child>
     <child>
-      <!-- n-columns=2 n-rows=1 -->
+      <!-- n-columns=1 n-rows=2 -->
       <object class="GtkGrid" id="grid2">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">12</property>
+        <property name="row-spacing">6</property>
+        <property name="column-spacing">12</property>
         <child>
           <object class="GtkLabel" id="connectionStringLabel">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="halign">start</property>
-            <property name="label" translatable="yes" 
context="specialpostgrespage|connectionStringLabel">And/OR Enter the 
DBMS/driver-specific connection string here</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">browseurl</property>
+            <property name="label" translatable="yes" 
context="specialpostgrespage|connectionStringLabel">Alternatively, enter the 
driver-specific connection string here</property>
+            <property name="use-underline">True</property>
+            <property name="mnemonic-widget">browseurl</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
+            <property name="left-attach">0</property>
+            <property name="top-attach">0</property>
           </packing>
         </child>
         <child>
           <!-- n-columns=2 n-rows=1 -->
-          <object class="GtkGrid" id ="grid3">
+          <object class="GtkGrid" id="grid3">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
             <property name="hexpand">True</property>
@@ -217,6 +247,11 @@
                 <property name="hexpand">True</property>
                 <property name="activates-default">True</property>
                 <property name="truncate-multiline">True</property>
+                <child internal-child="accessible">
+                  <object class="AtkObject" id="browseurl-atkobject">
+                    <property name="AtkObject::accessible-description" 
translatable="yes" context="postgrespage|extended_tip|browseurl">Enter the 
complete connector URL to access the PostGreSQL DBMS service. The connector URL 
is in the form "postgresql://myHost:port/MyDatabase".</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="left-attach">1</property>
@@ -235,18 +270,15 @@
             </child>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
+            <property name="left-attach">0</property>
+            <property name="top-attach">1</property>
           </packing>
         </child>
-        <child>
-          <placeholder/>
-        </child>
       </object>
       <packing>
         <property name="expand">False</property>
         <property name="fill">True</property>
-        <property name="position">3</property>
+        <property name="position">4</property>
       </packing>
     </child>
   </object>

Reply via email to