diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php index af49637741..84d05fe695 100644 --- a/filemanager/inc/class.filemanager_hooks.inc.php +++ b/filemanager/inc/class.filemanager_hooks.inc.php @@ -308,6 +308,22 @@ class filemanager_hooks return $link; } + /** + * Get supported mime types for editor based on user preferences + * @return array|mixed + */ + static function getEditorPrefMimes() + { + $mimes = self::getEditorLink()['mime']??[]; + $excluedMimes = is_string($GLOBALS['egw_info']['user']['preferences']['filemanager']['collab_excluded_mimes'])? + explode(',', $GLOBALS['egw_info']['user']['preferences']['filemanager']['collab_excluded_mimes']) : []; + foreach ($mimes as $mime => $value) + { + if (in_array($mime, $excluedMimes)) unset($mimes[$mime]); + } + return $mimes; + } + /** * Hooks called by vfs, implemented to be able to notify subscribed users about changed files * diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 558f7fcb50..84081e13ef 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2526,9 +2526,19 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $attachmentHTML[$key]['mail_id'] = $rowID; $attachmentHTML[$key]['winmailFlag']=$value['is_winmail']; $attachmentHTML[$key]['smime_type'] = $value['smime_type']; - $attachmentHTML[$key]['actions'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_doubleclick_action'] === 'collabora' ? - 'collabora' : 'downloadOneAsFile'; - $attachmentHTML[$key]['actionsDefaultLabel'] = 'Download'; + + if ($GLOBALS['egw_info']['apps']['collabora'] + && $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_doubleclick_action'] === 'collabora' + && array_key_exists($value['mimeType'], filemanager_hooks::getEditorPrefMimes())) + { + $attachmentHTML[$key]['actions'] = 'collabora'; + $attachmentHTML[$key]['actionsDefaultLabel'] = 'Open with Collabora'; + } + else + { + $attachmentHTML[$key]['actions'] = 'downloadOneAsFile'; + $attachmentHTML[$key]['actionsDefaultLabel'] = 'Download'; + } // reset mode array as it should be considered differently for // each attachment diff --git a/mail/templates/default/app.css b/mail/templates/default/app.css index b45581a118..89d5199c4c 100644 --- a/mail/templates/default/app.css +++ b/mail/templates/default/app.css @@ -1134,4 +1134,5 @@ et2-split#mail-index_mailSplitter.squeezed .mail-index_quotabox{ } .expanderFirstRow { position: absolute; -} \ No newline at end of file +} +.attachments et2-dropdown-button[id$="\[actions\]"]{display: inline} \ No newline at end of file diff --git a/mail/templates/default/display.xet b/mail/templates/default/display.xet index c228491fee..3fcda9995b 100644 --- a/mail/templates/default/display.xet +++ b/mail/templates/default/display.xet @@ -108,8 +108,7 @@ - - + @@ -118,7 +117,6 @@ - @@ -131,8 +129,8 @@ - - + + @@ -143,7 +141,7 @@ - +