Skip to content
Open
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
33 changes: 32 additions & 1 deletion src/components/AppNavigation/ContactsSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
:addressbooks="addressbooks"
@clicked="onClickImport"
@file-loaded="onLoad" />

<NcFormGroup
:label="t('contacts', 'CardDAV')"
:description="t('contacts', 'Access Nextcloud contacts from other apps and devices')">
<NcFormBox>
<NcFormBoxCopyButton :label="t('contacts', 'CardDAV URL')" :value="primaryCardDAV" />
<NcFormBoxCopyButton :label="t('contacts', 'Server Address for iOS and macOS')" :value="appleCardDAV" />
</NcFormBox>
</NcFormGroup>
</AppSettingsSection>

<AppSettingsSection id="address-books" :name="t('contacts', 'Address books')">
Expand All @@ -42,25 +51,30 @@
import axios from '@nextcloud/axios'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
import { generateRemoteUrl, generateUrl } from '@nextcloud/router'
import {
NcAppSettingsDialog as AppSettingsDialog,
NcAppSettingsSection as AppSettingsSection,
} from '@nextcloud/vue'
import NcFormBox from '@nextcloud/vue/components/NcFormBox'
import NcFormBoxCopyButton from '@nextcloud/vue/components/NcFormBoxCopyButton'
import NcFormBoxSwitch from '@nextcloud/vue/components/NcFormBoxSwitch'
import NcFormGroup from '@nextcloud/vue/components/NcFormGroup'
import SettingsAddressbook from './Settings/SettingsAddressbook.vue'
import SettingsImportContacts from './Settings/SettingsImportContacts.vue'
import SettingsNewAddressbook from './Settings/SettingsNewAddressbook.vue'
import SettingsSortContacts from './Settings/SettingsSortContacts.vue'
import usePrincipalsStore from '../../store/principals.js'

export default {
name: 'ContactsSettings',
components: {
AppSettingsDialog,
AppSettingsSection,
NcFormBox,
NcFormBoxCopyButton,
NcFormBoxSwitch,
NcFormGroup,
SettingsAddressbook,
SettingsNewAddressbook,
SettingsImportContacts,
Expand Down Expand Up @@ -88,12 +102,29 @@
addressbooks() {
return this.$store.getters.getAddressbooks
},

currentUserPrincipal() {
const principalsStore = usePrincipalsStore()
return principalsStore.currentUserPrincipal
},

primaryCardDAV() {
return generateRemoteUrl('dav')
},

appleCardDAV() {
const principalUrl = this.currentUserPrincipal?.url || this.currentUserPrincipal?.principalUrl
if (!principalUrl) {
return ''
}
return new URL(principalUrl, this.primaryCardDAV).toString()
},
},

watch: {
showSettings(value) {
if (!value) {
this.$emit('update:open', value)

Check warning on line 127 in src/components/AppNavigation/ContactsSettings.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "update:open" event has been triggered but not declared on `emits` option
}
},

Expand All @@ -106,7 +137,7 @@

methods: {
onClickImport(event) {
this.$emit('clicked', event)

Check warning on line 140 in src/components/AppNavigation/ContactsSettings.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "clicked" event has been triggered but not declared on `emits` option
},

async toggleSocialSync(value) {
Expand All @@ -127,7 +158,7 @@
},

onLoad() {
this.$emit('file-loaded', false)

Check warning on line 161 in src/components/AppNavigation/ContactsSettings.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "file-loaded" event has been triggered but not declared on `emits` option
},

async onOpen() {
Expand Down
Loading