[Libreoffice-commits] core.git: vcl/inc vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Fri Jul 12 12:36:05 PDT 2013


 vcl/inc/svids.hrc                        |   37 +++++++++++++++---------------
 vcl/source/src/fpicker.src               |    9 +++++--
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |   38 +++++++++++++++++++++++++++----
 vcl/unx/gtk/fpicker/SalGtkPicker.hxx     |   15 ++++++------
 vcl/unx/gtk/fpicker/resourceprovider.cxx |    3 +-
 5 files changed, 70 insertions(+), 32 deletions(-)

New commits:
commit 466545933a70716cb1ca132f7e61cc12c60acbb1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 12 20:34:27 2013 +0100

    set primary and secondary text on the gtk overwrite querybox
    
    Change-Id: Ie671ddaba0e749dd0714de589fbaa45d914ba5c9

diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index abe1a14..d1fb135 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -177,24 +177,25 @@
 #define SV_MAC_SCREENNNAME                  10216
 #define SV_STDTEXT_ALLFILETYPES             10217
 
-#define STR_FPICKER_AUTO_EXTENSION                10300
-#define STR_FPICKER_PASSWORD                      10301
-#define STR_FPICKER_FILTER_OPTIONS                10302
-#define STR_FPICKER_READONLY                      10303
-#define STR_FPICKER_INSERT_AS_LINK                10304
-#define STR_FPICKER_SHOW_PREVIEW                  10305
-#define STR_FPICKER_PLAY                          10306
-#define STR_FPICKER_VERSION                       10307
-#define STR_FPICKER_TEMPLATES                     10308
-#define STR_FPICKER_IMAGE_TEMPLATE                10309
-#define STR_FPICKER_SELECTION                     10310
-#define STR_FPICKER_FOLDER_DEFAULT_TITLE          10311
-#define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION    10312
-#define STR_FPICKER_ALREADYEXISTOVERWRITE         10313
-#define STR_FPICKER_ALLFORMATS                    10314
-#define STR_FPICKER_OPEN                          10315
-#define STR_FPICKER_SAVE                          10316
-#define STR_FPICKER_TYPE                          10317
+#define STR_FPICKER_AUTO_EXTENSION                  10300
+#define STR_FPICKER_PASSWORD                        10301
+#define STR_FPICKER_FILTER_OPTIONS                  10302
+#define STR_FPICKER_READONLY                        10303
+#define STR_FPICKER_INSERT_AS_LINK                  10304
+#define STR_FPICKER_SHOW_PREVIEW                    10305
+#define STR_FPICKER_PLAY                            10306
+#define STR_FPICKER_VERSION                         10307
+#define STR_FPICKER_TEMPLATES                       10308
+#define STR_FPICKER_IMAGE_TEMPLATE                  10309
+#define STR_FPICKER_SELECTION                       10310
+#define STR_FPICKER_FOLDER_DEFAULT_TITLE            10311
+#define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION      10312
+#define STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY   10313
+#define STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY 10314
+#define STR_FPICKER_ALLFORMATS                      10315
+#define STR_FPICKER_OPEN                            10316
+#define STR_FPICKER_SAVE                            10317
+#define STR_FPICKER_TYPE                            10318
 
 #define SV_ACCESSERROR_WRONG_VERSION        10500
 #define SV_ACCESSERROR_BRIDGE_MSG           10501
diff --git a/vcl/source/src/fpicker.src b/vcl/source/src/fpicker.src
index 324cffb..1196a31 100644
--- a/vcl/source/src/fpicker.src
+++ b/vcl/source/src/fpicker.src
@@ -84,9 +84,14 @@ String STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION
     Text [ en-US ] = "Please select a folder.";
 };
 
-String STR_FPICKER_ALREADYEXISTOVERWRITE
+String STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY
 {
-    Text [ en-US ] = "A file named \"$filename$\" already exists.\n\nDo you want to replace it?" ;
+    Text [ en-US ] = "A file named \"$filename$\" already exists. Do you want to replace it?" ;
+};
+
+String STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY
+{
+    Text [ en-US ] = "The file already exists in \"$dirname$\". Replacing it will overwrite its contents." ;
 };
 
 String STR_FPICKER_ALLFORMATS
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index d237b86..2f35174 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -1011,7 +1011,6 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                         gchar *gFileName = g_filename_from_uri ( sFileName.getStr(), NULL, NULL );
                         if( g_file_test( gFileName, G_FILE_TEST_IS_REGULAR ) )
                         {
-                            GtkWidget *dlg;
                             INetURLObject aFileObj( sFileName );
 
                             OString baseName(
@@ -1026,11 +1025,11 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                             );
                             OString aMsg(
                               OUStringToOString(
-                                getResString( FILE_PICKER_OVERWRITE ),
+                                getResString( FILE_PICKER_OVERWRITE_PRIMARY ),
                                 RTL_TEXTENCODING_UTF8
                               )
                             );
-                            OString toReplace( RTL_CONSTASCII_STRINGPARAM( "$filename$" ));
+                            OString toReplace("$filename$");
 
                             aMsg = aMsg.replaceAt(
                               aMsg.indexOf( toReplace ),
@@ -1038,7 +1037,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                               baseName
                             );
 
-                            dlg = gtk_message_dialog_new( NULL,
+                            GtkWidget *dlg = gtk_message_dialog_new( NULL,
                                 GTK_DIALOG_MODAL,
                                 GTK_MESSAGE_QUESTION,
                                 GTK_BUTTONS_YES_NO,
@@ -1046,6 +1045,37 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                                 aMsg.getStr()
                             );
 
+                            sal_Int32 nSegmentCount = aFileObj.getSegmentCount();
+                            if (nSegmentCount >= 2)
+                            {
+                                OString dirName(
+                                  OUStringToOString(
+                                    aFileObj.getName(
+                                      nSegmentCount-2,
+                                      true,
+                                      INetURLObject::DECODE_WITH_CHARSET
+                                    ),
+                                    RTL_TEXTENCODING_UTF8
+                                  )
+                                );
+
+                                aMsg =
+                                  OUStringToOString(
+                                    getResString( FILE_PICKER_OVERWRITE_SECONDARY ),
+                                    RTL_TEXTENCODING_UTF8
+                                  );
+
+                                toReplace = "$dirname$";
+
+                                aMsg = aMsg.replaceAt(
+                                  aMsg.indexOf( toReplace ),
+                                  toReplace.getLength(),
+                                  dirName
+                                );
+
+                                gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG( dlg ), "%s", aMsg.getStr() );
+                            }
+
                             gtk_window_set_title( GTK_WINDOW( dlg ),
                                 OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ),
                                 RTL_TEXTENCODING_UTF8 ).getStr() );
diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.hxx b/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
index 477c707..fc8d2a2 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
@@ -31,13 +31,14 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
-#define FOLDERPICKER_TITLE            500
-#define FOLDER_PICKER_DEF_DESCRIPTION 501
-#define FILE_PICKER_TITLE_OPEN        502
-#define FILE_PICKER_TITLE_SAVE        503
-#define FILE_PICKER_FILE_TYPE         504
-#define FILE_PICKER_OVERWRITE         505
-#define FILE_PICKER_ALLFORMATS        506
+#define FOLDERPICKER_TITLE              500
+#define FOLDER_PICKER_DEF_DESCRIPTION   501
+#define FILE_PICKER_TITLE_OPEN          502
+#define FILE_PICKER_TITLE_SAVE          503
+#define FILE_PICKER_FILE_TYPE           504
+#define FILE_PICKER_OVERWRITE_PRIMARY   505
+#define FILE_PICKER_OVERWRITE_SECONDARY 506
+#define FILE_PICKER_ALLFORMATS          507
 
 class SalGtkPicker
 {
diff --git a/vcl/unx/gtk/fpicker/resourceprovider.cxx b/vcl/unx/gtk/fpicker/resourceprovider.cxx
index ec588c1..b07e581 100644
--- a/vcl/unx/gtk/fpicker/resourceprovider.cxx
+++ b/vcl/unx/gtk/fpicker/resourceprovider.cxx
@@ -51,7 +51,8 @@ static const struct
     { CHECKBOX_SELECTION,                       STR_FPICKER_SELECTION },
     { FOLDERPICKER_TITLE,                       STR_FPICKER_FOLDER_DEFAULT_TITLE },
     { FOLDER_PICKER_DEF_DESCRIPTION,            STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION },
-    { FILE_PICKER_OVERWRITE,                    STR_FPICKER_ALREADYEXISTOVERWRITE },
+    { FILE_PICKER_OVERWRITE_PRIMARY,            STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY },
+    { FILE_PICKER_OVERWRITE_SECONDARY,          STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY },
     { FILE_PICKER_ALLFORMATS,                   STR_FPICKER_ALLFORMATS },
     { FILE_PICKER_TITLE_OPEN,                   STR_FPICKER_OPEN },
     { FILE_PICKER_TITLE_SAVE,                   STR_FPICKER_SAVE },


More information about the Libreoffice-commits mailing list