From 59cbea50c24fe598f09e8e8c21d9cc84fb93e9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandino=20Araico=20S=C3=A1nchez?= Date: Mon, 9 Sep 2024 00:42:49 -0600 Subject: [PATCH] =?UTF-8?q?Actualizaci=C3=B3n=20del=20parche=20gob.mx=201.?= =?UTF-8?q?5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpmbuild/SOURCES/ed25519.key.asc | 15 +- ...reoffice-24.8.0.3+gobmx1.5-patchset.patch} | 343 ++++++++++++++++++ rpmbuild/SPECS/libreoffice.spec | 10 +- 3 files changed, 358 insertions(+), 10 deletions(-) rename rpmbuild/SOURCES/{libreoffice-24.8.0.3+gobmx1.4-patchset.patch => libreoffice-24.8.0.3+gobmx1.5-patchset.patch} (97%) diff --git a/rpmbuild/SOURCES/ed25519.key.asc b/rpmbuild/SOURCES/ed25519.key.asc index 2d5e010..57fb5e5 100644 --- a/rpmbuild/SOURCES/ed25519.key.asc +++ b/rpmbuild/SOURCES/ed25519.key.asc @@ -5,10 +5,13 @@ mDMEYtcYTRYJKwYBBAHaRw8BAQdAup3AWA5CpavhOX16tLl1r2LukqxrJq/ZW6BK YXF1ZXRlcyBkZSBnb2IubXguKSA8YnVpbGRlckB1Z2QuZ29iLm14PoiTBBMWCgA7 FiEEK0iGmHzdXnGx0L9QwXjKx7ZXh80FAmLXGE0CGwMFCwkIBwICIgIGFQoJCAsC BBYCAwECHgcCF4AACgkQwXjKx7ZXh82vRQEA20a8r7jKovPMlxGFRenlSdf5W4g4 -5VuSsZbslPeWK7oA/3jD6Na0othI93yCNabafOs/7u16M6UrbQO0GNFn/h4KuDgE -YtcYTRIKKwYBBAGXVQEFAQEHQF+XtJhl1KnE524dVYn/SE+/cHCE19+p+IZ9RYPA -aV0aAwEIB4h4BBgWCgAgFiEEK0iGmHzdXnGx0L9QwXjKx7ZXh80FAmLXGE0CGwwA -CgkQwXjKx7ZXh826EgD9HnaC2QyPWl7kYqCAMabqaGxekt8gAAgKiF+RNm4FmdAA -/2FhYOTg3uBaYjaESC+tdt4T+lPAyiSIRtcxTfyQMN4A -=UtGC +5VuSsZbslPeWK7oA/3jD6Na0othI93yCNabafOs/7u16M6UrbQO0GNFn/h4KiHUE +EBYIAB0WIQRpHwIZww2CmITkZ9qZHV1AzGIkTwUCZt1/swAKCRCZHV1AzGIkT7dU +AP9yKPqhD2/HAbH95UjafeJu7Y6ErJeWWEHM9SSeJXvcCgEAwouzIh33rUr8tFDG +hDrbWohZEJcaYQH/F/u9KU9BMwe4OARi1xhNEgorBgEEAZdVAQUBAQdAX5e0mGXU +qcTnbh1Vif9IT79wcITX36n4hn1Fg8BpXRoDAQgHiHgEGBYKACAWIQQrSIaYfN1e +cbHQv1DBeMrHtleHzQUCYtcYTQIbDAAKCRDBeMrHtleHzboSAP0edoLZDI9aXuRi +oIAxpupobF6S3yAACAqIX5E2bgWZ0AD/YWFg5ODe4FpiNoRIL6123hP6U8DKJIhG +1zFN/JAw3gA= +=0yC5 -----END PGP PUBLIC KEY BLOCK----- diff --git a/rpmbuild/SOURCES/libreoffice-24.8.0.3+gobmx1.4-patchset.patch b/rpmbuild/SOURCES/libreoffice-24.8.0.3+gobmx1.5-patchset.patch similarity index 97% rename from rpmbuild/SOURCES/libreoffice-24.8.0.3+gobmx1.4-patchset.patch rename to rpmbuild/SOURCES/libreoffice-24.8.0.3+gobmx1.5-patchset.patch index b72e188..0671036 100644 --- a/rpmbuild/SOURCES/libreoffice-24.8.0.3+gobmx1.4-patchset.patch +++ b/rpmbuild/SOURCES/libreoffice-24.8.0.3+gobmx1.5-patchset.patch @@ -304,6 +304,91 @@ index 000000000000..28b53b415a2a +$(eval $(call gb_UnpackedTarball_set_tarball,font_gmx,$(FONT_GMX_TARBALL))) + +# vim: set noet sw=4 ts=4: +diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc +index 35997819573d..bceccd006a10 100644 +--- a/include/sfx2/strings.hrc ++++ b/include/sfx2/strings.hrc +@@ -356,10 +356,13 @@ + #define STR_ACTION_RESET_IMPRESS_TEMPLATE NC_("STR_ACTION_RESET_IMPRESS_TEMPLATE","Reset De~fault Presentation") + #define STR_ACTION_RESET_DRAW_TEMPLATE NC_("STR_ACTION_RESET_DRAW_TEMPLATE","Reset De~fault Drawing") + #define STR_ACTION_IMPORT NC_("STR_ACTION_IMPORT","~Import") ++#define STR_ACTION_IMPORT_GMX NC_("STR_ACTION_IMPORT","~Importar GobMX") + #define STR_ACTION_EXTENSIONS NC_("STR_ACTION_EXTENSIONS","E~xtensions") + #define STR_WINDOW_TITLE_RENAME_TEMPLATE NC_("STR_WINDOW_TITLE_RENAME_TEMPLATE","Rename") + #define STR_WINDOW_TITLE_RENAME_CATEGORY NC_("STR_WINDOW_TITLE_RENAME_CATEGORY","Rename Category") + #define STR_WINDOW_TITLE_RENAME_NEW_CATEGORY NC_("STR_WINDOW_TITLE_RENAME_NEW_CATEGORY","New Category") ++#define STR_WINDOW_TITLE_RENAME_IMPORT_GMX NC_("STC_WINDOW_TITLE_IMPORT_GMX", "Importar Templates GobMX") ++#define STR_MSG_ERROR_FILE_INSTITUTIONS NC_("STR_MSG_ERROR_IMPORT", "Error en el archivo de instituciones $1:\n$2") + + #define STR_OBJECT_INSPECTOR NC_("STR_OBJECT_INSPECTOR", "UNO Object Inspector") + #endif +diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx +index c8f2ddf19655..d68bf4afb99d 100644 +--- a/include/sfx2/templatedlg.hxx ++++ b/include/sfx2/templatedlg.hxx +@@ -62,6 +62,7 @@ protected: + DECL_DLLPRIVATE_LINK(OkClickHdl, weld::Button&, void); + SAL_DLLPRIVATE void ImportActionHdl(); + SAL_DLLPRIVATE static void ExtensionsActionHdl(); ++ SAL_DLLPRIVATE void ImportActionGmxTemplates(); //GMX-CODE + + DECL_DLLPRIVATE_LINK(TVItemStateHdl, const ThumbnailViewItem*, void); + +@@ -90,6 +91,7 @@ protected: + DECL_DLLPRIVATE_LINK(FocusRectLocalHdl, weld::Widget&, tools::Rectangle); + + SAL_DLLPRIVATE void OnTemplateImportCategory(std::u16string_view sCategory); ++ SAL_DLLPRIVATE void OnTemplateImportGmxCategory(std::u16string_view sCategory); //GMX-CODE + // static void OnTemplateLink (); + SAL_DLLPRIVATE void OnTemplateOpen(); + SAL_DLLPRIVATE void OnTemplateExport(); +@@ -185,6 +187,34 @@ private: + Idle maIdle; + }; + ++// class SfxTemplateGmxDialog ------------------------------------------------------------------- ++ ++class SfxTemplateGmxDialog final : public weld::GenericDialogController ++{ ++private: ++ OUString msSelectedCategory; ++ bool mbIsNewCategory; ++ ++ std::unique_ptr mxLBCategory; ++ std::unique_ptr mxNewCategoryEdit; ++ std::unique_ptr mxOKButton; ++ ++public: ++ //DECL_LINK(NewCategoryEditHdl, weld::Entry&, void); ++ DECL_LINK(SelectCategoryHdl, weld::TreeView&, void); ++ ++ void SetCategoryLBEntries(std::vector names); ++ ++ const OUString& GetSelectedCategory() const { return msSelectedCategory; }; ++ ++ bool IsNewCategoryCreated() const { return mbIsNewCategory; } ++ ++public: ++ explicit SfxTemplateGmxDialog(weld::Window* pParent); ++ ++ virtual ~SfxTemplateGmxDialog() override; ++}; ++ + #endif // INCLUDED_SFX2_INC_TEMPLATEDLG_HXX + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx +index 4284c74b334f..9e37a6e1d846 100644 +--- a/include/sfx2/templatelocalview.hxx ++++ b/include/sfx2/templatelocalview.hxx +@@ -98,6 +98,7 @@ public: + OUString getRegionItemName(const sal_uInt16 nItemId) const; + + std::vector getFolderNames (); ++ std::vector getGmxLinks (); + + std::vector + getFilteredItems (const std::function &rFunc) const; diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk index b78899a2c10b..5534755ac7dc 100644 --- a/instsetoo_native/CustomTarget_setup.mk @@ -442,6 +527,264 @@ index b5da0bfb6697..abd2276640fd 100644 + include {installscriptdir},{customtargetpath}/readlicense_oo/readme,{customtargetpath}/sysui/{pkgtype},{customtargetpath}/setup_native,{filelistpath}/PackageSet,{filelistpath}/GeneratedPackage,{filelistpath}/Package,{filelistpath}/ExtensionPackage,{filelistpath}/CustomTarget/helpcontent2/help3xsl/filelists,{extensionsdir},{licensepath},{packinfopath} + } +} +diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx +index ca165c99e9c6..2463be11701f 100644 +--- a/sfx2/source/control/templatelocalview.cxx ++++ b/sfx2/source/control/templatelocalview.cxx +@@ -32,7 +32,13 @@ + #include + #include <../doc/doctemplateslocal.hxx> + ++#include ++#include ++#include ++#include ++ + using namespace ::com::sun::star; ++namespace fs = std::filesystem; + + bool ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION filter, std::u16string_view rExt) + { +@@ -289,6 +295,54 @@ std::vector TemplateLocalView::getFolderNames() + return ret; + } + ++// GMX-CODE Listado de instituciones ++std::vector TemplateLocalView::getGmxLinks() ++{ ++ std::vector ret; ++ fs::path tmpDir = fs::temp_directory_path(); ++ // Verificar si el directorio temporal existe ++ if (!fs::exists(tmpDir)) ++ { ++ fs::create_directories(tmpDir); ++ } ++ std::string fileName = "instituciones.txt"; ++ std::string command = "wget -O "; ++ std::string urlFile = " https://repos.libreoffice.gob.mx/templates/instituciones.txt"; ++ ++ fs::path filePath = tmpDir / fileName; ++ ++ #if defined(_WIN32) || defined(_WIN64) ++ command = "curl -o "; ++ #endif ++ ++ command += filePath.string() + urlFile; ++ // Descargar el archivo de instituciones ++ int result = system(command.c_str()); ++ if (result != 0) ++ { ++ std::cerr << "Error al descargar el archivo. Instituciones.txt" << std::endl; ++ return ret; ++ } ++ std::ifstream file(filePath); ++ if (file.is_open()){ ++ std::string line; ++ while (std::getline(file, line)) ++ { ++ ret.push_back(OUString::createFromAscii(line.c_str())); ++ } ++ file.close(); ++ } else { ++ OUString aMsg(SfxResId(STR_MSG_ERROR_FILE_INSTITUTIONS)); ++ aMsg = aMsg.replaceFirst("$1", "Error no se pudo abrir archivo de instituciones"); ++ std::unique_ptr xBox(Application::CreateMessageDialog(GetDrawingArea(), ++ VclMessageType::Warning, VclButtonsType::Ok, ++ aMsg)); ++ xBox->run(); ++ } ++ ++ return ret; ++} ++ + std::vector + TemplateLocalView::getFilteredItems(const std::function &rFunc) const + { +diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx +index f0f0322a14d9..c68db2c1f134 100644 +--- a/sfx2/source/doc/templatedlg.cxx ++++ b/sfx2/source/doc/templatedlg.cxx +@@ -52,6 +52,10 @@ + + #include + #include ++#include ++#include ++#include ++#include + + constexpr OUString TM_SETTING_MANAGER = u"TemplateManager"_ustr; + constexpr OUString TM_SETTING_LASTFOLDER = u"LastFolder"_ustr; +@@ -68,6 +72,7 @@ constexpr OUString MNI_ACTION_DEFAULT_IMPRESS = u"default_impress"_ustr; + constexpr OUString MNI_ACTION_DEFAULT_DRAW = u"default_draw"_ustr; + constexpr OUString MNI_ACTION_IMPORT = u"import_template"_ustr; + constexpr OUString MNI_ACTION_EXTENSIONS = u"extensions"_ustr; ++constexpr OUString MNI_ACTION_IMPORT_GMX = u"import_template_gmx"_ustr; + #define MNI_ALL_APPLICATIONS 0 + #define MNI_WRITER 1 + #define MNI_CALC 2 +@@ -81,6 +86,7 @@ using namespace ::com::sun::star::frame; + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::ui::dialogs; + using namespace ::com::sun::star::document; ++namespace fs = std::filesystem; + + static bool lcl_getServiceName (const OUString &rFileURL, OUString &rName ); + +@@ -182,6 +188,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(weld::Window *pParent) + mxActionBar->append_separator(u"separator2"_ustr); + mxActionBar->append_item(MNI_ACTION_IMPORT, SfxResId(STR_ACTION_IMPORT), BMP_ACTION_IMPORT); + mxActionBar->append_item(MNI_ACTION_EXTENSIONS, SfxResId(STR_ACTION_EXTENSIONS), BMP_ACTION_EXTENSIONS); ++ mxActionBar->append_separator(u"separator2"_ustr); //GMX-CODE ++ mxActionBar->append_item(MNI_ACTION_IMPORT_GMX, SfxResId(STR_ACTION_IMPORT_GMX), BMP_ACTION_IMPORT); //Agrega en lista la opción para importar GMX + + mxActionBar->connect_selected(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl)); + +@@ -529,6 +537,8 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OUString&, rIdent, void) + ImportActionHdl(); + else if(rIdent == MNI_ACTION_EXTENSIONS) + ExtensionsActionHdl(); ++ else if(rIdent == MNI_ACTION_IMPORT_GMX) //GMX-CODE ++ ImportActionGmxTemplates(); + } + + void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(std::u16string_view rIdent) +@@ -651,6 +661,41 @@ void SfxTemplateManagerDlg::ExtensionsActionHdl() + comphelper::dispatchCommand(u".uno:AdditionsDialog"_ustr, aArgs); + } + ++ /* GMX-CODE ++ Código para importar las templates GMX ++ */ ++void SfxTemplateManagerDlg::ImportActionGmxTemplates() ++{ ++ SfxTemplateCategoryDialog xDlg(m_xDialog.get()); ++ // Obtiene la lista de instituciones ++ xDlg.SetCategoryLBEntries(mxLocalView->getGmxLinks()); ++ ++ if (xDlg.run() == RET_OK) ++ { ++ const OUString& sCategory = xDlg.GetSelectedCategory(); ++ bool bIsNewCategory = xDlg.IsNewCategoryCreated(); ++ if(bIsNewCategory) ++ { ++ if(mxLocalView->createRegion(sCategory)) ++ { ++ mxCBFolder->append_text(sCategory); ++ OnTemplateImportCategory(sCategory); ++ } ++ else ++ { ++ OUString aMsg( SfxResId(STR_CREATE_ERROR) ); ++ std::unique_ptr xBox(Application::CreateMessageDialog(m_xDialog.get(), ++ VclMessageType::Warning, VclButtonsType::Ok, ++ aMsg.replaceFirst("$1", sCategory))); ++ xBox->run(); ++ return; ++ } ++ } ++ else ++ OnTemplateImportGmxCategory(sCategory); ++ } ++} ++ + IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl, void*, void) + { + maSelTemplates.clear(); +@@ -991,6 +1036,93 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(std::u16string_view sCatego + } + } + ++/* Based on OnTemplateImportCategory */ ++void SfxTemplateManagerDlg::OnTemplateImportGmxCategory(std::u16string_view sCategory) ++{ ++ std::u16string sCategoryStr(sCategory); ++ icu::UnicodeString unicodeString(reinterpret_cast(sCategoryStr.data()), sCategoryStr.size()); ++ std::string category; ++ unicodeString.toUTF8String(category); ++ ++ const std::string repoUrl = "https://repos.libreoffice.gob.mx/templates/" + category; ++ fs::path tempDir = fs::temp_directory_path() / "temporal-gmx-templates" / category; ++ ++ // Verificar si el directorio temporal existe ++ if (!fs::exists(tempDir)) ++ { ++ fs::create_directories(tempDir); ++ } ++ // Ejecutar el comando de descarga ++ std::string command = "wget -r -np -nH --cut-dirs=2 -P " + tempDir.string() + " " + repoUrl; ++ #if defined(_WIN32) || defined(_WIN64) ++ std::string command = "curl -o " + tempDir.string() + " " + repoUrl; ++ #endif ++ int result = std::system(command.c_str()); ++ if (result != 0) ++ { ++ OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT)); ++ aMsg = aMsg.replaceFirst("$1", "Error clonando el repositorio"); ++ std::unique_ptr xBox(Application::CreateMessageDialog(m_xDialog.get(), ++ VclMessageType::Warning, VclButtonsType::Ok, ++ aMsg)); ++ xBox->run(); ++ return; ++ } ++ ++ // Obtener la lista de archivos en la carpeta clonada ++ std::vector aFiles; ++ for (const auto& entry : std::filesystem::directory_iterator(tempDir)) ++ { ++ if (entry.is_regular_file()) ++ { ++ aFiles.push_back(OUString::fromUtf8(entry.path().string())); ++ } ++ } ++ ++ if (aFiles.empty()) ++ { ++ OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT)); ++ aMsg = aMsg.replaceFirst("$1", "No se encontraron archivos en el repositorio clonado"); ++ std::unique_ptr xBox(Application::CreateMessageDialog(m_xDialog.get(), ++ VclMessageType::Warning, VclButtonsType::Ok, ++ aMsg)); ++ xBox->run(); ++ return; ++ } ++ ++ // Importar a las regiones seleccionadas ++ TemplateContainerItem* pContItem = mxLocalView->getRegion(sCategory); ++ if (!pContItem) ++ return; ++ ++ OUString aTemplateList; ++ ++ for (const auto& rFile : aFiles) ++ { ++ if (!mxLocalView->copyFrom(pContItem, rFile)) ++ { ++ if (aTemplateList.isEmpty()) ++ aTemplateList = rFile; ++ else ++ aTemplateList += "\n" + rFile; ++ } ++ } ++ ++ if (!aTemplateList.isEmpty()) ++ { ++ OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT)); ++ aMsg = aMsg.replaceFirst("$1", pContItem->maTitle); ++ std::unique_ptr xBox(Application::CreateMessageDialog(m_xDialog.get(), ++ VclMessageType::Warning, VclButtonsType::Ok, ++ aMsg.replaceFirst("$2", aTemplateList))); ++ fs::remove_all(tempDir); ++ xBox->run(); ++ } ++ ++ // Eliminar la carpeta temporal ++ fs::remove_all(tempDir); ++} ++ + void SfxTemplateManagerDlg::OnTemplateExport() + { + uno::Reference xContext(comphelper::getProcessComponentContext()); diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in index 3aef4468fa0d..3808a26e79e4 100644 --- a/solenv/flatpak-manifest.in diff --git a/rpmbuild/SPECS/libreoffice.spec b/rpmbuild/SPECS/libreoffice.spec index 8801c51..599bb2a 100644 --- a/rpmbuild/SPECS/libreoffice.spec +++ b/rpmbuild/SPECS/libreoffice.spec @@ -78,7 +78,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.3 -Release: 4+gob.mx1.4%{?dist} +Release: 5+gob.mx1.5%{?dist} # default new files are: MPLv2 # older files are typically: MPLv2 incorporating work under ASLv2 @@ -369,8 +369,8 @@ Patch12: cflags.patch # https://bugs.documentfoundation.org/show_bug.cgi?id=158108 #Patch12: libreoffice-7.5.8.2-icu-74-compatibility.patch -# Patchset gob.mx 1.3 -Patch21: libreoffice-24.2.5.2+gobmx1.4-patchset.patch +# Patchset gob.mx 1.5 +Patch21: libreoffice-24.8.0.3+gobmx1.5-patchset.patch Patch500: 0001-disable-libe-book-support.patch # https://lists.freedesktop.org/archives/libreoffice/2023-September/090948.html @@ -2875,7 +2875,9 @@ gtk-update-icon-cache -q %{_datadir}/icons/hicolor &>/dev/null || : %{_includedir}/LibreOfficeKit %changelog -## START: Generated by rpmautospec +* Sun Sep 08 2024 Sandino Araico Sánchez - 1:24.8.0.3-5+gob.mx1.5 +- Actualización del parche gob.mx 1.5 + * Sun Sep 08 2024 Sandino Araico Sánchez - 1:24.8.0.3-4+gob.mx1.4 - Merge 24.8.0.3-fc40 - Actualización del parche gob.mx 1.4