Kaydet (Commit) 46654593 authored tarafından Caolán McNamara's avatar Caolán McNamara

set primary and secondary text on the gtk overwrite querybox

Change-Id: Ie671ddaba0e749dd0714de589fbaa45d914ba5c9
üst 2cca46d5
...@@ -177,24 +177,25 @@ ...@@ -177,24 +177,25 @@
#define SV_MAC_SCREENNNAME 10216 #define SV_MAC_SCREENNNAME 10216
#define SV_STDTEXT_ALLFILETYPES 10217 #define SV_STDTEXT_ALLFILETYPES 10217
#define STR_FPICKER_AUTO_EXTENSION 10300 #define STR_FPICKER_AUTO_EXTENSION 10300
#define STR_FPICKER_PASSWORD 10301 #define STR_FPICKER_PASSWORD 10301
#define STR_FPICKER_FILTER_OPTIONS 10302 #define STR_FPICKER_FILTER_OPTIONS 10302
#define STR_FPICKER_READONLY 10303 #define STR_FPICKER_READONLY 10303
#define STR_FPICKER_INSERT_AS_LINK 10304 #define STR_FPICKER_INSERT_AS_LINK 10304
#define STR_FPICKER_SHOW_PREVIEW 10305 #define STR_FPICKER_SHOW_PREVIEW 10305
#define STR_FPICKER_PLAY 10306 #define STR_FPICKER_PLAY 10306
#define STR_FPICKER_VERSION 10307 #define STR_FPICKER_VERSION 10307
#define STR_FPICKER_TEMPLATES 10308 #define STR_FPICKER_TEMPLATES 10308
#define STR_FPICKER_IMAGE_TEMPLATE 10309 #define STR_FPICKER_IMAGE_TEMPLATE 10309
#define STR_FPICKER_SELECTION 10310 #define STR_FPICKER_SELECTION 10310
#define STR_FPICKER_FOLDER_DEFAULT_TITLE 10311 #define STR_FPICKER_FOLDER_DEFAULT_TITLE 10311
#define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION 10312 #define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION 10312
#define STR_FPICKER_ALREADYEXISTOVERWRITE 10313 #define STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY 10313
#define STR_FPICKER_ALLFORMATS 10314 #define STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY 10314
#define STR_FPICKER_OPEN 10315 #define STR_FPICKER_ALLFORMATS 10315
#define STR_FPICKER_SAVE 10316 #define STR_FPICKER_OPEN 10316
#define STR_FPICKER_TYPE 10317 #define STR_FPICKER_SAVE 10317
#define STR_FPICKER_TYPE 10318
#define SV_ACCESSERROR_WRONG_VERSION 10500 #define SV_ACCESSERROR_WRONG_VERSION 10500
#define SV_ACCESSERROR_BRIDGE_MSG 10501 #define SV_ACCESSERROR_BRIDGE_MSG 10501
......
...@@ -84,9 +84,14 @@ String STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION ...@@ -84,9 +84,14 @@ String STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION
Text [ en-US ] = "Please select a folder."; 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 String STR_FPICKER_ALLFORMATS
......
...@@ -1011,7 +1011,6 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) ...@@ -1011,7 +1011,6 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
gchar *gFileName = g_filename_from_uri ( sFileName.getStr(), NULL, NULL ); gchar *gFileName = g_filename_from_uri ( sFileName.getStr(), NULL, NULL );
if( g_file_test( gFileName, G_FILE_TEST_IS_REGULAR ) ) if( g_file_test( gFileName, G_FILE_TEST_IS_REGULAR ) )
{ {
GtkWidget *dlg;
INetURLObject aFileObj( sFileName ); INetURLObject aFileObj( sFileName );
OString baseName( OString baseName(
...@@ -1026,11 +1025,11 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) ...@@ -1026,11 +1025,11 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
); );
OString aMsg( OString aMsg(
OUStringToOString( OUStringToOString(
getResString( FILE_PICKER_OVERWRITE ), getResString( FILE_PICKER_OVERWRITE_PRIMARY ),
RTL_TEXTENCODING_UTF8 RTL_TEXTENCODING_UTF8
) )
); );
OString toReplace( RTL_CONSTASCII_STRINGPARAM( "$filename$" )); OString toReplace("$filename$");
aMsg = aMsg.replaceAt( aMsg = aMsg.replaceAt(
aMsg.indexOf( toReplace ), aMsg.indexOf( toReplace ),
...@@ -1038,7 +1037,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) ...@@ -1038,7 +1037,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
baseName baseName
); );
dlg = gtk_message_dialog_new( NULL, GtkWidget *dlg = gtk_message_dialog_new( NULL,
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION, GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO, GTK_BUTTONS_YES_NO,
...@@ -1046,6 +1045,37 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) ...@@ -1046,6 +1045,37 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
aMsg.getStr() 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 ), gtk_window_set_title( GTK_WINDOW( dlg ),
OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ), OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ),
RTL_TEXTENCODING_UTF8 ).getStr() ); RTL_TEXTENCODING_UTF8 ).getStr() );
......
...@@ -31,13 +31,14 @@ ...@@ -31,13 +31,14 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#define FOLDERPICKER_TITLE 500 #define FOLDERPICKER_TITLE 500
#define FOLDER_PICKER_DEF_DESCRIPTION 501 #define FOLDER_PICKER_DEF_DESCRIPTION 501
#define FILE_PICKER_TITLE_OPEN 502 #define FILE_PICKER_TITLE_OPEN 502
#define FILE_PICKER_TITLE_SAVE 503 #define FILE_PICKER_TITLE_SAVE 503
#define FILE_PICKER_FILE_TYPE 504 #define FILE_PICKER_FILE_TYPE 504
#define FILE_PICKER_OVERWRITE 505 #define FILE_PICKER_OVERWRITE_PRIMARY 505
#define FILE_PICKER_ALLFORMATS 506 #define FILE_PICKER_OVERWRITE_SECONDARY 506
#define FILE_PICKER_ALLFORMATS 507
class SalGtkPicker class SalGtkPicker
{ {
......
...@@ -51,7 +51,8 @@ static const struct ...@@ -51,7 +51,8 @@ static const struct
{ CHECKBOX_SELECTION, STR_FPICKER_SELECTION }, { CHECKBOX_SELECTION, STR_FPICKER_SELECTION },
{ FOLDERPICKER_TITLE, STR_FPICKER_FOLDER_DEFAULT_TITLE }, { FOLDERPICKER_TITLE, STR_FPICKER_FOLDER_DEFAULT_TITLE },
{ FOLDER_PICKER_DEF_DESCRIPTION, STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION }, { 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_ALLFORMATS, STR_FPICKER_ALLFORMATS },
{ FILE_PICKER_TITLE_OPEN, STR_FPICKER_OPEN }, { FILE_PICKER_TITLE_OPEN, STR_FPICKER_OPEN },
{ FILE_PICKER_TITLE_SAVE, STR_FPICKER_SAVE }, { FILE_PICKER_TITLE_SAVE, STR_FPICKER_SAVE },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment