mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Improved Kolab AddressBook/Contacts
This commit is contained in:
parent
5c9b7d7000
commit
824311937a
42 changed files with 299 additions and 54 deletions
|
|
@ -4,6 +4,7 @@ import { koComputable } from 'External/ko';
|
|||
import { SettingsGet } from 'Common/Globals';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
import { ContactUserStore } from 'Stores/User/Contact';
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
export class UserSettingsContacts /*extends AbstractViewSettings*/ {
|
||||
|
|
@ -48,5 +49,33 @@ export class UserSettingsContacts /*extends AbstractViewSettings*/ {
|
|||
Password: ContactUserStore.syncPass()
|
||||
})
|
||||
);
|
||||
|
||||
this.kolabContactFolder = ko.observable(SettingsGet('KolabContactFolder'));
|
||||
this.kolabContactFolder.subscribe(value =>
|
||||
Remote.saveSettings(null, { KolabContactFolder: value })
|
||||
);
|
||||
this.showKolab = FolderUserStore.allowKolab();
|
||||
this.folderSelectList = koComputable(() => {
|
||||
const
|
||||
aResult = [{
|
||||
id: '',
|
||||
name: '',
|
||||
}],
|
||||
foldersWalk = folders => {
|
||||
folders.forEach(oItem => {
|
||||
if ('contact' === oItem.kolabType()) {
|
||||
aResult.push({
|
||||
id: oItem.fullName,
|
||||
name: oItem.fullName
|
||||
});
|
||||
}
|
||||
if (oItem.subFolders.length) {
|
||||
foldersWalk(oItem.subFolders());
|
||||
}
|
||||
});
|
||||
};
|
||||
foldersWalk(FolderUserStore.folderList());
|
||||
return aResult;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { koComputable } from 'External/ko';
|
|||
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { FolderMetadataKeys } from 'Common/EnumsUser';
|
||||
import { SettingsCapa } from 'Common/Globals';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import { setFolder, getFolderFromCacheList, removeFolderFromCacheList } from 'Common/Cache';
|
||||
|
|
@ -26,7 +25,7 @@ const folderForDeletion = ko.observable(null).askDeleteHelper();
|
|||
|
||||
export class UserSettingsFolders /*extends AbstractViewSettings*/ {
|
||||
constructor() {
|
||||
this.showKolab = koComputable(() => FolderUserStore.hasCapability('METADATA') && SettingsCapa('Kolab'));
|
||||
this.showKolab = FolderUserStore.allowKolab();
|
||||
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
|
||||
this.kolabTypeOptions = ko.observableArray();
|
||||
let i18nFilter = key => i18n('SETTINGS_FOLDERS/TYPE_' + key);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
|||
import { forEachObjectEntry } from 'Common/Utils';
|
||||
import { addObservablesTo, addSubscribablesTo, addComputablesTo } from 'External/ko';
|
||||
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
||||
import { Settings } from 'Common/Globals';
|
||||
import { Settings, SettingsCapa } from 'Common/Globals';
|
||||
//import Remote from 'Remote/User/Fetch'; // Circular dependency
|
||||
|
||||
export const FolderUserStore = new class {
|
||||
|
|
@ -117,6 +117,10 @@ export const FolderUserStore = new class {
|
|||
return this.capabilities().includes(name);
|
||||
}
|
||||
|
||||
allowKolab() {
|
||||
return FolderUserStore.hasCapability('METADATA') && SettingsCapa('Kolab');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue