Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add new mdi icons #3538

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion img/x-office-document.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion img/x-office-drawing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion img/x-office-presentation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion img/x-office-spreadsheet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -141,19 +141,19 @@ 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;
});

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;
});
Expand Down
Loading