vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |   29 +++++++++++++++++------------
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx |    2 ++
 2 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 4f6cabae397424caa1edf7cc084f5f458b9e5cb7
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Oct 6 09:59:44 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Feb 6 12:24:43 2023 +0000

    Related: tdf#150706 & tdf#153330 add OK and CANCEL to known controls
    
    which results that we can rename "Save" to "Export" in pdf export dialog
    
    Change-Id: I8186a9ea3d18bfb383b07ba54f2fd7a5cd71e7b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141004
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit 1da3406a8e97934615b5b644cbb81bf3108143ec)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146520
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index cdb31b326c92..fc990b6fe501 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -1102,6 +1102,10 @@ GtkWidget *SalGtkFilePicker::getWidget( sal_Int16 
nControlId, GType *pType )
             pWidget = m_pToggles[elem]; tType = GTK_TYPE_CHECK_BUTTON; \
             break
 #define MAP_BUTTON( elem ) \
+        case CommonFilePickerElementIds::PUSHBUTTON_##elem: \
+            pWidget = m_pButtons[elem]; tType = GTK_TYPE_BUTTON; \
+            break
+#define MAP_EXT_BUTTON( elem ) \
         case ExtendedFilePickerElementIds::PUSHBUTTON_##elem: \
             pWidget = m_pButtons[elem]; tType = GTK_TYPE_BUTTON; \
             break
@@ -1124,7 +1128,9 @@ GtkWidget *SalGtkFilePicker::getWidget( sal_Int16 
nControlId, GType *pType )
         MAP_TOGGLE( LINK );
         MAP_TOGGLE( PREVIEW );
         MAP_TOGGLE( SELECTION );
-        MAP_BUTTON( PLAY );
+        MAP_BUTTON( OK );
+        MAP_BUTTON( CANCEL );
+        MAP_EXT_BUTTON( PLAY );
         MAP_LIST( VERSION );
         MAP_LIST( TEMPLATE );
         MAP_LIST( IMAGE_TEMPLATE );
@@ -1386,7 +1392,7 @@ void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 
nControlId, const OUString&
 
     if( !( pWidget = getWidget( nControlId, &tType ) ) )
     {
-        SAL_WARN( "vcl.gtk", "Set label on unknown control " << nControlId);
+        SAL_WARN( "vcl.gtk", "Set label '" << rLabel << "' on unknown control 
" << nControlId);
         return;
     }
 
@@ -1778,18 +1784,17 @@ void SalGtkFilePicker::impl_initialize(GtkWidget* 
pParentWidget, sal_Int16 templ
     }
 
     gtk_file_chooser_set_action( GTK_FILE_CHOOSER( m_pDialog ), eAction);
-    gtk_dialog_add_button(GTK_DIALOG( m_pDialog ),
-                          getCancelText().getStr(),
-                          GTK_RESPONSE_CANCEL);
-    for( int nTVIndex = 0; nTVIndex < BUTTON_LAST; nTVIndex++ )
+    m_pButtons[CANCEL] = gtk_dialog_add_button(GTK_DIALOG(m_pDialog), 
getCancelText().getStr(), GTK_RESPONSE_CANCEL);
+    mbButtonVisibility[CANCEL] = true;
+
+    if (mbButtonVisibility[PLAY])
     {
-        if( mbButtonVisibility[nTVIndex] )
-        {
-            OString aPlay = OUStringToOString( getResString( PUSHBUTTON_PLAY 
), RTL_TEXTENCODING_UTF8 );
-            m_pButtons[ nTVIndex ] = gtk_dialog_add_button( GTK_DIALOG( 
m_pDialog ), aPlay.getStr(), 1 );
-        }
+        OString aPlay = OUStringToOString(getResString(PUSHBUTTON_PLAY), 
RTL_TEXTENCODING_UTF8);
+        m_pButtons[PLAY] = gtk_dialog_add_button(GTK_DIALOG(m_pDialog), 
aPlay.getStr(), 1);
     }
-    gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), first_button_text, 
GTK_RESPONSE_ACCEPT );
+
+    m_pButtons[OK] = gtk_dialog_add_button(GTK_DIALOG(m_pDialog), 
first_button_text, GTK_RESPONSE_ACCEPT);
+    mbButtonVisibility[OK] = true;
 
     gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), 
GTK_RESPONSE_ACCEPT );
 
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
index c412478e8aab..fdc701a20384 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
@@ -170,6 +170,8 @@ class SalGtkFilePicker : public SalGtkPicker, public 
SalGtkFilePicker_Base
         bool mbToggleVisibility[TOGGLE_LAST];
 
         enum {
+            OK,
+            CANCEL,
             PLAY,
             BUTTON_LAST };
 

Reply via email to