From 3d55b8bda1d3fcfe298d3842cea3950544965230 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 20 Mar 2024 13:22:53 -0700 Subject: [PATCH 1/2] feat: Add new mdi mimetype svgs Signed-off-by: Christopher Ng --- img/x-office-document.svg | 6 +++++- img/x-office-drawing.svg | 5 ++++- img/x-office-presentation.svg | 5 ++++- img/x-office-spreadsheet.svg | 5 ++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/img/x-office-document.svg b/img/x-office-document.svg index d19fa659a6..adc8454f60 100644 --- a/img/x-office-document.svg +++ b/img/x-office-document.svg @@ -1 +1,5 @@ - + + + + diff --git a/img/x-office-drawing.svg b/img/x-office-drawing.svg index 352347b634..2fc507fa85 100644 --- a/img/x-office-drawing.svg +++ b/img/x-office-drawing.svg @@ -1 +1,4 @@ - + + + diff --git a/img/x-office-presentation.svg b/img/x-office-presentation.svg index 523aa38ec2..d7b61cba0d 100644 --- a/img/x-office-presentation.svg +++ b/img/x-office-presentation.svg @@ -1 +1,4 @@ - + + + diff --git a/img/x-office-spreadsheet.svg b/img/x-office-spreadsheet.svg index b7006a98ea..5e29558fe4 100644 --- a/img/x-office-spreadsheet.svg +++ b/img/x-office-spreadsheet.svg @@ -1 +1,4 @@ - + + + From bdfbae27fc9e679cf1d68cefef775ae59adc84d5 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 20 Mar 2024 13:22:53 -0700 Subject: [PATCH 2/2] feat: Use new svgs in New file menu Signed-off-by: Christopher Ng --- lib/AppInfo/Application.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 831e56b78c..084edf8bf2 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -101,12 +101,12 @@ public function register(IRegistrationContext $context): void { } public function boot(IBootContext $context): void { - $context->injectFn(function (ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager) { + $context->injectFn(function (ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager, IAppManager $appManager) { if (!$permissionManager->isEnabledForUser() || empty($capabilitiesService->getCapabilities())) { return; } $ooxml = $config->getAppValue(self::APPNAME, 'doc_format', '') === 'ooxml'; - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odtType = new TemplateFileCreator('richdocuments', $l10n->t('New document'), ($ooxml ? '.docx' : '.odt')); if ($ooxml) { $odtType->addMimetype('application/msword'); @@ -115,11 +115,11 @@ public function boot(IBootContext $context): void { $odtType->addMimetype('application/vnd.oasis.opendocument.text'); $odtType->addMimetype('application/vnd.oasis.opendocument.text-template'); } - $odtType->setIconClass('icon-filetype-document'); + $odtType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-document.svg')); $odtType->setRatio(21 / 29.7); return $odtType; }); - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odsType = new TemplateFileCreator('richdocuments', $l10n->t('New spreadsheet'), ($ooxml ? '.xlsx' : '.ods')); if ($ooxml) { $odsType->addMimetype('application/vnd.ms-excel'); @@ -128,11 +128,11 @@ public function boot(IBootContext $context): void { $odsType->addMimetype('application/vnd.oasis.opendocument.spreadsheet'); $odsType->addMimetype('application/vnd.oasis.opendocument.spreadsheet-template'); } - $odsType->setIconClass('icon-filetype-spreadsheet'); + $odsType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-spreadsheet.svg')); $odsType->setRatio(16 / 9); return $odsType; }); - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odpType = new TemplateFileCreator('richdocuments', $l10n->t('New presentation'), ($ooxml ? '.pptx' : '.odp')); if ($ooxml) { $odpType->addMimetype('application/vnd.ms-powerpoint'); @@ -141,7 +141,7 @@ public function boot(IBootContext $context): void { $odpType->addMimetype('application/vnd.oasis.opendocument.presentation'); $odpType->addMimetype('application/vnd.oasis.opendocument.presentation-template'); } - $odpType->setIconClass('icon-filetype-presentation'); + $odpType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-presentation.svg')); $odpType->setRatio(16 / 9); return $odpType; }); @@ -149,11 +149,11 @@ public function boot(IBootContext $context): void { if (!$capabilitiesService->hasDrawSupport()) { return; } - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odpType = new TemplateFileCreator('richdocuments', $l10n->t('New diagram'), '.odg'); $odpType->addMimetype('application/vnd.oasis.opendocument.graphics'); $odpType->addMimetype('application/vnd.oasis.opendocument.graphics-template'); - $odpType->setIconClass('icon-filetype-draw'); + $odpType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-drawing.svg')); $odpType->setRatio(1); return $odpType; });