Skip to content

Commit

Permalink
Add mailto: protocol handler
Browse files Browse the repository at this point in the history
Signed-off-by: GretaD <[email protected]>
  • Loading branch information
GretaD committed Jan 24, 2020
1 parent 50842d0 commit 9bccbf4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/AppSettingsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
/>
<label for="gravatar-enabled">{{ t('mail', 'Use Gravatar and favicon avatars') }}</label>
</p>

<p>
<button class="icon-mail app-settings-button" @click="registerProtocolHandler">
{{ t('mail', 'Register as application for mail links') }}
</button>
</p>
<p class="icon-details app-settings-button button">
<router-link :to="{name: 'keyboardShortcuts'}">
{{ t('mail', 'Keyboard shortcuts') }}
Expand All @@ -35,6 +39,7 @@

<script>
import Logger from '../logger'
import {generateUrl} from '@nextcloud/router'
export default {
name: 'AppSettingsMenu',
Expand Down Expand Up @@ -62,6 +67,17 @@ export default {
this.loadingAvatarSettings = false
})
},
registerProtocolHandler: function() {
if (window.navigator.registerProtocolHandler) {
var url =
window.location.protocol + '//' + window.location.host + generateUrl('apps/mail/compose?uri=%s')
try {
window.navigator.registerProtocolHandler('mailto', url, OC.theme.name + ' Mail')
} catch (err) {
Logger.error('could not register protocol handler', {err})
}
}
},
},
}
</script>
Expand Down

0 comments on commit 9bccbf4

Please sign in to comment.