Get Kolab integration working

This commit is contained in:
djmaze 2021-10-15 11:58:06 +02:00
parent 11823c280d
commit 0c237376e5
13 changed files with 95 additions and 15 deletions

View file

@ -17,6 +17,7 @@ export const Capa = {
Sieve: 'SIEVE',
AttachmentThumbnails: 'ATTACHMENT_THUMBNAILS',
AutoLogout: 'AUTOLOGOUT',
Kolab: 'KOLAB',
AdditionalAccounts: 'ADDITIONAL_ACCOUNTS',
Identities: 'IDENTITIES'
};

View file

@ -215,6 +215,10 @@ export class FolderModel extends AbstractModel {
collapsedPrivate: true
});
this.addSubscribables({
kolabType: sValue => this.metadata[FolderMetadataKeys.KolabFolderType] = sValue
});
this.subFolders = ko.observableArray(new FolderCollectionModel);
this.actionBlink = ko.observable(false).extend({ falseTimeout: 1000 });
}

View file

@ -494,6 +494,19 @@ class RemoteUserFetch extends AbstractFetchRemote {
});
}
/**
* @param {?Function} fCallback
* @param {string} sFolderFullNameRaw
* @param {boolean} bSubscribe
*/
folderSetMetadata(fCallback, sFolderFullNameRaw, sKey, sValue) {
this.defaultRequest(fCallback, 'FolderSetMetadata', {
Folder: sFolderFullNameRaw,
Key: sKey,
Value: sValue
});
}
/**
* @param {?Function} fCallback
* @param {string} sFolderFullNameRaw

View file

@ -1,11 +1,14 @@
import ko from 'ko';
import { Notification } from 'Common/Enums';
import { ClientSideKeyName } from 'Common/EnumsUser';
import { ClientSideKeyName, FolderMetadataKeys } from 'Common/EnumsUser';
import { Settings } from 'Common/Globals';
import { getNotification } from 'Common/Translator';
import { removeFolderFromCacheList } from 'Common/Cache';
import { Capa } from 'Common/Enums';
import { defaultOptionsAfterRender } from 'Common/Utils';
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
import * as Local from 'Storage/Client';
@ -21,6 +24,23 @@ import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
export class FoldersUserSettings /*extends AbstractViewSettings*/ {
constructor() {
this.showKolab = Settings.capa(Capa.Kolab);
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
this.kolabTypeOptions = ko.observableArray()
let i18nFilter = key => i18n('SETTINGS_FOLDERS/TYPE_' + key);
initOnStartOrLangChange(()=>{
this.kolabTypeOptions([
{ id: '', name: '' },
{ id: 'event', name: i18nFilter('CALENDAR') },
{ id: 'contact', name: i18nFilter('CONTACTS') },
{ id: 'task', name: i18nFilter('TASKS') },
{ id: 'note', name: i18nFilter('NOTES') },
{ id: 'file', name: i18nFilter('FILES') },
{ id: 'journal', name: i18nFilter('JOURNAL') },
{ id: 'configuration', name: i18nFilter('CONFIGURATION') }
]);
});
this.displaySpecSetting = FolderUserStore.displaySpecSetting;
this.folderList = FolderUserStore.folderList;
this.folderListOptimized = FolderUserStore.folderListOptimized;
@ -117,6 +137,12 @@ export class FoldersUserSettings /*extends AbstractViewSettings*/ {
}
}
toggleFolderKolabType(folder, event) {
let type = event.target.value;
Remote.folderSetMetadata(()=>0, folder.fullNameRaw, FolderMetadataKeys.KolabFolderType, type);
folder.kolabType(type);
}
toggleFolderSubscription(folder) {
let subscribe = !folder.subscribed();
Local.set(ClientSideKeyName.FoldersLashHash, '');

View file

@ -13,10 +13,6 @@
width: 1em;
}
table:not(.displaySpecSetting) td:last-child {
display: none;
}
.folder-name {
word-break: break-all;
white-space: pre-wrap;
@ -31,6 +27,10 @@
cursor: pointer;
}
select {
width: auto;
}
tr {
&:not(.selectable) {