Skip to content

Commit bdfbae2

Browse files
Pytaljuliusknorr
authored andcommitted
feat: Use new svgs in New file menu
Signed-off-by: Christopher Ng <[email protected]>
1 parent 3d55b8b commit bdfbae2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/AppInfo/Application.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public function register(IRegistrationContext $context): void {
101101
}
102102

103103
public function boot(IBootContext $context): void {
104-
$context->injectFn(function (ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager) {
104+
$context->injectFn(function (ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager, IAppManager $appManager) {
105105
if (!$permissionManager->isEnabledForUser() || empty($capabilitiesService->getCapabilities())) {
106106
return;
107107
}
108108
$ooxml = $config->getAppValue(self::APPNAME, 'doc_format', '') === 'ooxml';
109-
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) {
109+
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) {
110110
$odtType = new TemplateFileCreator('richdocuments', $l10n->t('New document'), ($ooxml ? '.docx' : '.odt'));
111111
if ($ooxml) {
112112
$odtType->addMimetype('application/msword');
@@ -115,11 +115,11 @@ public function boot(IBootContext $context): void {
115115
$odtType->addMimetype('application/vnd.oasis.opendocument.text');
116116
$odtType->addMimetype('application/vnd.oasis.opendocument.text-template');
117117
}
118-
$odtType->setIconClass('icon-filetype-document');
118+
$odtType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-document.svg'));
119119
$odtType->setRatio(21 / 29.7);
120120
return $odtType;
121121
});
122-
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) {
122+
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) {
123123
$odsType = new TemplateFileCreator('richdocuments', $l10n->t('New spreadsheet'), ($ooxml ? '.xlsx' : '.ods'));
124124
if ($ooxml) {
125125
$odsType->addMimetype('application/vnd.ms-excel');
@@ -128,11 +128,11 @@ public function boot(IBootContext $context): void {
128128
$odsType->addMimetype('application/vnd.oasis.opendocument.spreadsheet');
129129
$odsType->addMimetype('application/vnd.oasis.opendocument.spreadsheet-template');
130130
}
131-
$odsType->setIconClass('icon-filetype-spreadsheet');
131+
$odsType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-spreadsheet.svg'));
132132
$odsType->setRatio(16 / 9);
133133
return $odsType;
134134
});
135-
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) {
135+
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) {
136136
$odpType = new TemplateFileCreator('richdocuments', $l10n->t('New presentation'), ($ooxml ? '.pptx' : '.odp'));
137137
if ($ooxml) {
138138
$odpType->addMimetype('application/vnd.ms-powerpoint');
@@ -141,19 +141,19 @@ public function boot(IBootContext $context): void {
141141
$odpType->addMimetype('application/vnd.oasis.opendocument.presentation');
142142
$odpType->addMimetype('application/vnd.oasis.opendocument.presentation-template');
143143
}
144-
$odpType->setIconClass('icon-filetype-presentation');
144+
$odpType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-presentation.svg'));
145145
$odpType->setRatio(16 / 9);
146146
return $odpType;
147147
});
148148

149149
if (!$capabilitiesService->hasDrawSupport()) {
150150
return;
151151
}
152-
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) {
152+
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) {
153153
$odpType = new TemplateFileCreator('richdocuments', $l10n->t('New diagram'), '.odg');
154154
$odpType->addMimetype('application/vnd.oasis.opendocument.graphics');
155155
$odpType->addMimetype('application/vnd.oasis.opendocument.graphics-template');
156-
$odpType->setIconClass('icon-filetype-draw');
156+
$odpType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-drawing.svg'));
157157
$odpType->setRatio(1);
158158
return $odpType;
159159
});

0 commit comments

Comments
 (0)