cui/source/dialogs/welcomedlg.cxx |   23 ++++++++++++++---------
 cui/source/inc/welcomedlg.hxx     |    9 ++++++---
 cui/uiconfig/ui/welcomedialog.ui  |   34 +++++++++++++++++++++++++++++++---
 include/sfx2/strings.hrc          |   12 ++++++------
 4 files changed, 57 insertions(+), 21 deletions(-)

New commits:
commit 86e62c4ec7e076244b29ccb329abbaecedf70f37
Author:     Heiko Tietze <[email protected]>
AuthorDate: Mon May 12 15:26:10 2025 +0200
Commit:     Heiko Tietze <[email protected]>
CommitDate: Mon May 12 16:40:25 2025 +0200

    Resolves tdf#166541 - Welcome dialog must not use standard buttons
    
    Replaced hijacked Okay and Reset buttons by special buttons
    
    Change-Id: If8315be3f8f71ca1fc5fae0136eef4a76232b3e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185219
    Reviewed-by: Heiko Tietze <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/dialogs/welcomedlg.cxx 
b/cui/source/dialogs/welcomedlg.cxx
index 6797affcbf58..941bda793035 100644
--- a/cui/source/dialogs/welcomedlg.cxx
+++ b/cui/source/dialogs/welcomedlg.cxx
@@ -28,9 +28,11 @@ constexpr OUString sAppearanceTab = 
u"AppearanceTabPage"_ustr;
 
 WelcomeDialog::WelcomeDialog(weld::Window* pParent)
     : SfxTabDialogController(pParent, u"cui/ui/welcomedialog.ui"_ustr, 
u"WelcomeDialog"_ustr)
-    , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr)) // release notes / apply
+    , m_xActionBtn(m_xBuilder->weld_button(u"action"_ustr)) // release notes / 
apply
+    , m_xNextBtn(m_xBuilder->weld_button(u"next"_ustr)) // next / close
+    , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr)) // hidden
     , m_xResetBtn(m_xBuilder->weld_button(u"reset"_ustr)) // hidden
-    , m_xCancelBtn(m_xBuilder->weld_button(u"cancel"_ustr)) // next / close
+    , m_xCancelBtn(m_xBuilder->weld_button(u"cancel"_ustr)) // hidden
 {
     m_xDialog->set_title(SfxResId(STR_WELCOME_LINE1));
 
@@ -40,8 +42,11 @@ WelcomeDialog::WelcomeDialog(weld::Window* pParent)
 
     m_xTabCtrl->connect_enter_page(LINK(this, WelcomeDialog, OnActivatePage));
     m_xResetBtn->set_visible(false);
-    m_xOKBtn->connect_clicked(LINK(this, WelcomeDialog, OnApplyClick));
-    m_xCancelBtn->connect_clicked(LINK(this, WelcomeDialog, OnNextClick));
+    m_xOKBtn->set_visible(false);
+    m_xCancelBtn->set_visible(false);
+
+    m_xNextBtn->connect_clicked(LINK(this, WelcomeDialog, OnNextClick));
+    m_xActionBtn->connect_clicked(LINK(this, WelcomeDialog, OnActionClick));
 
     m_xTabCtrl->set_current_page(sNewsTab);
     OnActivatePage(sNewsTab);
@@ -50,14 +55,14 @@ WelcomeDialog::WelcomeDialog(weld::Window* pParent)
 IMPL_LINK(WelcomeDialog, OnActivatePage, const OUString&, rPage, void)
 {
     if (rPage == sNewsTab)
-        m_xOKBtn->set_label(SfxResId(STR_CREDITS_BUTTON));
+        m_xActionBtn->set_label(SfxResId(STR_CREDITS_BUTTON));
     else
-        m_xOKBtn->set_label(SfxResId(STR_WELCOME_APPLY));
+        m_xActionBtn->set_label(SfxResId(STR_WELCOME_APPLY));
 
     if (rPage == sAppearanceTab)
-        m_xCancelBtn->set_label(SfxResId(STR_WELCOME_CLOSE));
+        m_xNextBtn->set_label(SfxResId(STR_WELCOME_CLOSE));
     else
-        m_xCancelBtn->set_label(SfxResId(STR_WELCOME_NEXT));
+        m_xNextBtn->set_label(SfxResId(STR_WELCOME_NEXT));
 }
 
 IMPL_LINK_NOARG(WelcomeDialog, OnNextClick, weld::Button&, void)
@@ -73,7 +78,7 @@ IMPL_LINK_NOARG(WelcomeDialog, OnNextClick, weld::Button&, 
void)
         m_xDialog->response(RET_OK);
 }
 
-IMPL_LINK_NOARG(WelcomeDialog, OnApplyClick, weld::Button&, void)
+IMPL_LINK_NOARG(WelcomeDialog, OnActionClick, weld::Button&, void)
 {
     switch (m_xTabCtrl->get_current_page())
     {
diff --git a/cui/source/inc/welcomedlg.hxx b/cui/source/inc/welcomedlg.hxx
index a52af751da08..0af9fbab053a 100644
--- a/cui/source/inc/welcomedlg.hxx
+++ b/cui/source/inc/welcomedlg.hxx
@@ -14,11 +14,14 @@
 class WelcomeDialog : public SfxTabDialogController
 {
 private:
-    std::unique_ptr<weld::Button> m_xOKBtn; // release notes / apply
+    std::unique_ptr<weld::Button> m_xActionBtn; // release notes / apply
+    std::unique_ptr<weld::Button> m_xNextBtn; // next / close
+    std::unique_ptr<weld::Button> m_xOKBtn; // hidden
     std::unique_ptr<weld::Button> m_xResetBtn; // hidden
-    std::unique_ptr<weld::Button> m_xCancelBtn; // next / close
+    std::unique_ptr<weld::Button> m_xCancelBtn; // hidden
+
     DECL_LINK(OnActivatePage, const OUString&, void);
-    DECL_LINK(OnApplyClick, weld::Button&, void);
+    DECL_LINK(OnActionClick, weld::Button&, void);
     DECL_LINK(OnNextClick, weld::Button&, void);
 
 public:
diff --git a/cui/uiconfig/ui/welcomedialog.ui b/cui/uiconfig/ui/welcomedialog.ui
index 0bf0072ebb7f..3866ee0c4db0 100644
--- a/cui/uiconfig/ui/welcomedialog.ui
+++ b/cui/uiconfig/ui/welcomedialog.ui
@@ -20,6 +20,34 @@
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can-focus">False</property>
             <property name="layout-style">end</property>
+            <child>
+              <object class="GtkButton" id="action">
+                <property name="label">_Apply</property>
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
+                <property name="use-underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="next">
+                <property name="label">_Next</property>
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
+                <property name="use-underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="reset">
                 <property name="label" translatable="yes" 
context="stock">_Reset</property>
@@ -30,7 +58,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -46,7 +74,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -60,7 +88,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">4</property>
               </packing>
             </child>
           </object>
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index 38d9aac4afc7..595e43ca9ee6 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -269,13 +269,13 @@
 #define STR_DONATE_TEXT                         NC_("STR_DONATE_TEXT", 
"Support the development of %PRODUCTNAME.")
 // Translators: text will be abbreviated at >8 characters, eg. "Please D..."
 #define STR_DONATE_BUTTON                       NC_("STR_DONATE_BUTTON", 
"Donate")
-#define STR_CREDITS_BUTTON                      NC_("STR_CREDITS_BUTTON", 
"Credits")
+#define STR_CREDITS_BUTTON                      NC_("STR_CREDITS_BUTTON", 
"~Credits")
 #define STR_WHATSNEW_TEXT                       NC_("STR_WHATSNEW", "You are 
running version %PRODUCTVERSION of %PRODUCTNAME for the first time. Do you want 
to learn what's new?")
-#define STR_WHATSNEW_FIRST                      NC_("STR_WHATSNEWFIRST", "You 
are running %PRODUCTNAME for the first time.

Please take a moment to personalize your settings.")
-#define STR_WHATSNEW_BUTTON                     NC_("STR_WHATSNEW_BUTTON", 
"Release Notes")
-#define STR_WELCOME_APPLY                       NC_("STR_WELCOME_APPLY", 
"Apply")
-#define STR_WELCOME_CLOSE                       NC_("STR_WELCOME_CLOSE", 
"Close")
-#define STR_WELCOME_NEXT                        NC_("STR_WELCOME_NEXT", "Next")
+#define STR_WHATSNEW_FIRST                      NC_("STR_WHATSNEW_FIRST", "You 
are running %PRODUCTNAME for the first time.

Please take a moment to personalize your settings.")
+#define STR_WHATSNEW_BUTTON                     NC_("STR_WHATSNEW_BUTTON", 
"~Release Notes")
+#define STR_WELCOME_APPLY                       NC_("STR_WELCOME_APPLY", 
"~Apply")
+#define STR_WELCOME_CLOSE                       NC_("STR_WELCOME_CLOSE", 
"~Close")
+#define STR_WELCOME_NEXT                        NC_("STR_WELCOME_NEXT", 
"~Next")
 
 #define STR_READONLY_DOCUMENT                   NC_("STR_READONLY_DOCUMENT", 
"This document is open in read-only mode.")
 #define STR_READONLY_PDF                        NC_("STR_READONLY_PDF", "This 
PDF is open in read-only mode to allow signing the existing file.")

Reply via email to