diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2022-03-07 21:44:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-03-11 13:10:45 +0100 |
commit | 3307afa99c28fd282094e9558795b0a20ba5c6a0 (patch) | |
tree | 5879ac4acbea451c772b368af2ed4f7160ee8cc3 /vcl | |
parent | d680b29e05dd3ac2e64e47c4e1f83a4e38b1db24 (diff) |
tdf#114150: Remove duplication of strings found in file dialogs
Change-Id: I86f720a23dd9d400d39d9606e073b483850a9df2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131153
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/strings.hrc | 19 | ||||
-rw-r--r-- | vcl/qt5/QtFilePicker.cxx | 37 | ||||
-rw-r--r-- | vcl/unx/gtk3/fpicker/resourceprovider.cxx | 48 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx | 31 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.cxx | 4 |
6 files changed, 62 insertions, 81 deletions
diff --git a/vcl/inc/strings.hrc b/vcl/inc/strings.hrc index 33462929e300..0439162f07c3 100644 --- a/vcl/inc/strings.hrc +++ b/vcl/inc/strings.hrc @@ -67,28 +67,9 @@ #define SV_STDTEXT_PREFERENCES NC_("SV_STDTEXT_PREFERENCES", "Preferences...") #define SV_STDTEXT_ALLFILETYPES NC_("SV_STDTEXT_ALLFILETYPES", "Any type") -#define STR_FPICKER_AUTO_EXTENSION NC_("STR_FPICKER_AUTO_EXTENSION", "~Automatic file name extension") -#define STR_FPICKER_PASSWORD NC_("STR_FPICKER_PASSWORD", "Save with pass~word") // dear loplugins, please don't remove this constant, it will be used in follow-up commits -#define STR_FPICKER_GPGENCRYPT NC_("STR_FPICKER_GPGENCRYPT", "Encrypt with ~GPG key") -#define STR_FPICKER_FILTER_OPTIONS NC_("STR_FPICKER_FILTER_OPTIONS", "~Edit filter settings") -#define STR_FPICKER_READONLY NC_("STR_FPICKER_READONLY", "~Read-only") -#define STR_FPICKER_INSERT_AS_LINK NC_("STR_FPICKER_INSERT_AS_LINK", "Insert as ~Link") -#define STR_FPICKER_SHOW_PREVIEW NC_("STR_FPICKER_SHOW_PREVIEW", "Pr~eview") -#define STR_FPICKER_PLAY NC_("STR_FPICKER_PLAY", "~Play") -#define STR_FPICKER_VERSION NC_("STR_FPICKER_VERSION", "~Version:") -#define STR_FPICKER_TEMPLATES NC_("STR_FPICKER_TEMPLATES", "S~tyles:") -#define STR_FPICKER_IMAGE_TEMPLATE NC_("STR_FPICKER_IMAGE_TEMPLATE", "Frame Style: ") -#define STR_FPICKER_IMAGE_ANCHOR NC_("STR_FPICKER_IMAGE_ANCHOR", "A~nchor: ") -#define STR_FPICKER_SELECTION NC_("STR_FPICKER_SELECTION", "~Selection") -#define STR_FPICKER_FOLDER_DEFAULT_TITLE NC_("STR_FPICKER_FOLDER_DEFAULT_TITLE", "Select Path") -#define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION NC_("STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION", "Please select a folder.") -#define STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY NC_("STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY", "A file named \"$filename$\" already exists. Do you want to replace it?") #define STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY NC_("STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY", "The file already exists in \"$dirname$\". Replacing it will overwrite its contents.") #define STR_FPICKER_ALLFORMATS NC_("STR_FPICKER_ALLFORMATS", "All Formats") -#define STR_FPICKER_OPEN NC_("STR_FPICKER_OPEN", "Open") -#define STR_FPICKER_SAVE NC_("STR_FPICKER_SAVE", "Save") -#define STR_FPICKER_TYPE NC_("STR_FPICKER_TYPE", "File ~type") #define SV_ACCESSERROR_NO_FONTS NC_("SV_ACCESSERROR_NO_FONTS", "No fonts could be found on the system.") diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx index 42caf06149f0..392e4f800925 100644 --- a/vcl/qt5/QtFilePicker.cxx +++ b/vcl/qt5/QtFilePicker.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <fpicker/fpsofficeResMgr.hxx> #include <QtFilePicker.hxx> #include <QtFilePicker.moc> @@ -63,7 +64,7 @@ #include <QtWidgets/QWidget> #include <unx/geninst.h> -#include <strings.hrc> +#include <fpicker/strings.hrc> using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; @@ -100,7 +101,7 @@ QtFilePicker::QtFilePicker(css::uno::Reference<css::uno::XComponentContext> cons if (m_bIsFolderPicker) { m_pFileDialog->setOption(QFileDialog::ShowDirsOnly, true); - m_pFileDialog->setWindowTitle(toQString(VclResId(STR_FPICKER_FOLDER_DEFAULT_TITLE))); + m_pFileDialog->setWindowTitle(toQString(FpsResId(STR_SVT_FOLDERPICKER_DEFAULT_TITLE))); } m_pLayout = dynamic_cast<QGridLayout*>(m_pFileDialog->layout()); @@ -619,7 +620,7 @@ QString QtFilePicker::getResString(TranslateId pResId) if (!pResId) return aResString; - aResString = toQString(VclResId(pResId)); + aResString = toQString(FpsResId(pResId)); return aResString.replace('~', '&'); } @@ -634,43 +635,43 @@ void QtFilePicker::addCustomControl(sal_Int16 controlId) switch (controlId) { case CHECKBOX_AUTOEXTENSION: - resId = STR_FPICKER_AUTO_EXTENSION; + resId = STR_SVT_FILEPICKER_AUTO_EXTENSION; break; case CHECKBOX_PASSWORD: - resId = STR_FPICKER_PASSWORD; + resId = STR_SVT_FILEPICKER_PASSWORD; break; case CHECKBOX_FILTEROPTIONS: - resId = STR_FPICKER_FILTER_OPTIONS; + resId = STR_SVT_FILEPICKER_FILTER_OPTIONS; break; case CHECKBOX_READONLY: - resId = STR_FPICKER_READONLY; + resId = STR_SVT_FILEPICKER_READONLY; break; case CHECKBOX_LINK: - resId = STR_FPICKER_INSERT_AS_LINK; + resId = STR_SVT_FILEPICKER_INSERT_AS_LINK; break; case CHECKBOX_PREVIEW: - resId = STR_FPICKER_SHOW_PREVIEW; + resId = STR_SVT_FILEPICKER_SHOW_PREVIEW; break; case CHECKBOX_SELECTION: - resId = STR_FPICKER_SELECTION; + resId = STR_SVT_FILEPICKER_SELECTION; break; case CHECKBOX_GPGENCRYPTION: - resId = STR_FPICKER_GPGENCRYPT; + resId = STR_SVT_FILEPICKER_GPGENCRYPT; break; case PUSHBUTTON_PLAY: - resId = STR_FPICKER_PLAY; + resId = STR_SVT_FILEPICKER_PLAY; break; case LISTBOX_VERSION: - resId = STR_FPICKER_VERSION; + resId = STR_SVT_FILEPICKER_VERSION; break; case LISTBOX_TEMPLATE: - resId = STR_FPICKER_TEMPLATES; + resId = STR_SVT_FILEPICKER_TEMPLATES; break; case LISTBOX_IMAGE_TEMPLATE: - resId = STR_FPICKER_IMAGE_TEMPLATE; + resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE; break; case LISTBOX_IMAGE_ANCHOR: - resId = STR_FPICKER_IMAGE_ANCHOR; + resId = STR_SVT_FILEPICKER_IMAGE_ANCHOR; break; case LISTBOX_VERSION_LABEL: case LISTBOX_TEMPLATE_LABEL: @@ -845,10 +846,10 @@ void SAL_CALL QtFilePicker::initialize(const uno::Sequence<uno::Any>& args) switch (acceptMode) { case QFileDialog::AcceptOpen: - resId = STR_FPICKER_OPEN; + resId = STR_FILEDLG_OPEN; break; case QFileDialog::AcceptSave: - resId = STR_FPICKER_SAVE; + resId = STR_FILEDLG_SAVE; m_pFileDialog->setFileMode(QFileDialog::AnyFile); break; } diff --git a/vcl/unx/gtk3/fpicker/resourceprovider.cxx b/vcl/unx/gtk3/fpicker/resourceprovider.cxx index f656a93093a8..fa90b8126627 100644 --- a/vcl/unx/gtk3/fpicker/resourceprovider.cxx +++ b/vcl/unx/gtk3/fpicker/resourceprovider.cxx @@ -20,8 +20,8 @@ #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> -#include <strings.hrc> -#include <svdata.hxx> +#include <fpicker/strings.hrc> +#include <fpicker/fpsofficeResMgr.hxx> #include "SalGtkPicker.hxx" using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; @@ -34,27 +34,27 @@ const struct sal_Int32 ctrlId; TranslateId resId; } CtrlIdToResIdTable[] = { - { CHECKBOX_AUTOEXTENSION, STR_FPICKER_AUTO_EXTENSION }, - { CHECKBOX_PASSWORD, STR_FPICKER_PASSWORD }, - { CHECKBOX_GPGENCRYPTION, STR_FPICKER_GPGENCRYPT }, - { CHECKBOX_FILTEROPTIONS, STR_FPICKER_FILTER_OPTIONS }, - { CHECKBOX_READONLY, STR_FPICKER_READONLY }, - { CHECKBOX_LINK, STR_FPICKER_INSERT_AS_LINK }, - { CHECKBOX_PREVIEW, STR_FPICKER_SHOW_PREVIEW }, - { PUSHBUTTON_PLAY, STR_FPICKER_PLAY }, - { LISTBOX_VERSION_LABEL, STR_FPICKER_VERSION }, - { LISTBOX_TEMPLATE_LABEL, STR_FPICKER_TEMPLATES }, - { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_FPICKER_IMAGE_TEMPLATE }, - { LISTBOX_IMAGE_ANCHOR_LABEL, STR_FPICKER_IMAGE_ANCHOR }, - { CHECKBOX_SELECTION, STR_FPICKER_SELECTION }, - { FOLDERPICKER_TITLE, STR_FPICKER_FOLDER_DEFAULT_TITLE }, - { FOLDER_PICKER_DEF_DESCRIPTION, STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION }, - { 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 }, - { FILE_PICKER_FILE_TYPE, STR_FPICKER_TYPE } + { CHECKBOX_AUTOEXTENSION, STR_SVT_FILEPICKER_AUTO_EXTENSION }, + { CHECKBOX_PASSWORD, STR_SVT_FILEPICKER_PASSWORD }, + { CHECKBOX_GPGENCRYPTION, STR_SVT_FILEPICKER_GPGENCRYPT }, + { CHECKBOX_FILTEROPTIONS, STR_SVT_FILEPICKER_FILTER_OPTIONS }, + { CHECKBOX_READONLY, STR_SVT_FILEPICKER_READONLY }, + { CHECKBOX_LINK, STR_SVT_FILEPICKER_INSERT_AS_LINK }, + { CHECKBOX_PREVIEW, STR_SVT_FILEPICKER_SHOW_PREVIEW }, + { PUSHBUTTON_PLAY, STR_SVT_FILEPICKER_PLAY }, + { LISTBOX_VERSION_LABEL, STR_SVT_FILEPICKER_VERSION }, + { LISTBOX_TEMPLATE_LABEL, STR_SVT_FILEPICKER_TEMPLATES }, + { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_SVT_FILEPICKER_IMAGE_TEMPLATE }, + { LISTBOX_IMAGE_ANCHOR_LABEL, STR_SVT_FILEPICKER_IMAGE_ANCHOR }, + { CHECKBOX_SELECTION, STR_SVT_FILEPICKER_SELECTION }, + { FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE }, + { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION }, + { FILE_PICKER_OVERWRITE_PRIMARY, STR_SVT_ALREADYEXISTOVERWRITE }, + { FILE_PICKER_OVERWRITE_SECONDARY, STR_SVT_ALREADYEXISTOVERWRITE_SECONDARY }, + { FILE_PICKER_ALLFORMATS, STR_SVT_ALLFORMATS }, + { FILE_PICKER_TITLE_OPEN, STR_FILEDLG_OPEN }, + { FILE_PICKER_TITLE_SAVE, STR_FILEDLG_SAVE }, + { FILE_PICKER_FILE_TYPE, STR_FILEDLG_TYPE } }; static TranslateId CtrlIdToResId( sal_Int32 aControlId ) @@ -73,7 +73,7 @@ OUString SalGtkPicker::getResString( sal_Int32 aId ) // translate the control id to a resource id TranslateId pResId = CtrlIdToResId( aId ); if (pResId) - aResString = VclResId(pResId); + aResString = FpsResId(pResId); return aResString.replace('~', '_'); } diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx index 37335b74e8d6..d3a053a08008 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx @@ -30,12 +30,11 @@ #include <sal/log.hxx> #include <vcl/svapp.hxx> - #include "FPServiceInfo.hxx" #undef Region -#include <strings.hrc> +#include <fpicker/strings.hrc> using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; @@ -221,43 +220,43 @@ void Gtk3KDE5FilePicker::addCustomControl(sal_Int16 controlId) switch (controlId) { case CHECKBOX_AUTOEXTENSION: - resId = STR_FPICKER_AUTO_EXTENSION; + resId = STR_SVT_FILEPICKER_AUTO_EXTENSION; break; case CHECKBOX_PASSWORD: - resId = STR_FPICKER_PASSWORD; + resId = STR_SVT_FILEPICKER_PASSWORD; break; case CHECKBOX_FILTEROPTIONS: - resId = STR_FPICKER_FILTER_OPTIONS; + resId = STR_SVT_FILEPICKER_FILTER_OPTIONS; break; case CHECKBOX_READONLY: - resId = STR_FPICKER_READONLY; + resId = STR_SVT_FILEPICKER_READONLY; break; case CHECKBOX_LINK: - resId = STR_FPICKER_INSERT_AS_LINK; + resId = STR_SVT_FILEPICKER_INSERT_AS_LINK; break; case CHECKBOX_PREVIEW: - resId = STR_FPICKER_SHOW_PREVIEW; + resId = STR_SVT_FILEPICKER_SHOW_PREVIEW; break; case CHECKBOX_SELECTION: - resId = STR_FPICKER_SELECTION; + resId = STR_SVT_FILEPICKER_SELECTION; break; case CHECKBOX_GPGENCRYPTION: - resId = STR_FPICKER_GPGENCRYPT; + resId = STR_SVT_FILEPICKER_GPGENCRYPT; break; case PUSHBUTTON_PLAY: - resId = STR_FPICKER_PLAY; + resId = STR_SVT_FILEPICKER_PLAY; break; case LISTBOX_VERSION: - resId = STR_FPICKER_VERSION; + resId = STR_SVT_FILEPICKER_VERSION; break; case LISTBOX_TEMPLATE: - resId = STR_FPICKER_TEMPLATES; + resId = STR_SVT_FILEPICKER_TEMPLATES; break; case LISTBOX_IMAGE_TEMPLATE: - resId = STR_FPICKER_IMAGE_TEMPLATE; + resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE; break; case LISTBOX_IMAGE_ANCHOR: - resId = STR_FPICKER_IMAGE_ANCHOR; + resId = STR_SVT_FILEPICKER_IMAGE_ANCHOR; break; case LISTBOX_VERSION_LABEL: case LISTBOX_TEMPLATE_LABEL: @@ -404,7 +403,7 @@ void SAL_CALL Gtk3KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args return; } - setTitle(getResString(saveDialog ? STR_FPICKER_SAVE : STR_FPICKER_OPEN)); + setTitle(getResString(saveDialog ? STR_FILEDLG_SAVE : STR_FILEDLG_OPEN)); m_ipc.sendCommand(Commands::Initialize, saveDialog); } diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx index f9fd85e94b80..f9b0da12ce9c 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx @@ -40,7 +40,7 @@ #include <boost/filesystem/path.hpp> -#include <svdata.hxx> +#include <fpicker/fpsofficeResMgr.hxx> using namespace ::com::sun::star::ui::dialogs; @@ -103,7 +103,7 @@ OUString getResString(TranslateId pResId) if (!pResId) return {}; - return VclResId(pResId); + return FpsResId(pResId); } // handles the IPC commands for dialog execution and ends the dummy Gtk dialog once the IPC response is there diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.cxx index fa0b562cc81c..c1569e6be209 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.cxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.cxx @@ -21,7 +21,7 @@ #include <vcl/svapp.hxx> -#include <strings.hrc> +#include <fpicker/strings.hrc> using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; @@ -34,7 +34,7 @@ Gtk3KDE5FolderPicker::Gtk3KDE5FolderPicker( const uno::Reference<uno::XComponentContext>& /*xContext*/) { m_ipc.sendCommand(Commands::EnablePickFolderMode); - setTitle(getResString(STR_FPICKER_FOLDER_DEFAULT_TITLE)); + setTitle(getResString(STR_SVT_FOLDERPICKER_DEFAULT_TITLE)); } Gtk3KDE5FolderPicker::~Gtk3KDE5FolderPicker() = default; |