linuxwindowsinboxwhatsappicloudtweetdeckhipchattelegramhangoutsslackgmailskypefacebook-workplaceoutlookemailmicrosoft-teamsdiscordmessengercustom-servicesmacos
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.8 KiB
72 lines
1.8 KiB
Ext.define('Rambox.store.Services', { |
|
extend: 'Ext.data.Store' |
|
,alias: 'store.services' |
|
|
|
,requires: [ |
|
'Ext.data.proxy.LocalStorage' |
|
] |
|
|
|
,model: 'Rambox.model.Service' |
|
|
|
,autoLoad: true |
|
,autoSync: true |
|
|
|
,groupField: 'align' |
|
,sorters: [ |
|
{ |
|
property: 'position' |
|
,direction: 'ASC' |
|
} |
|
] |
|
|
|
,listeners: { |
|
load: function( store, records, successful ) { |
|
Ext.cq1('app-main').suspendEvent('add'); |
|
|
|
var servicesLeft = []; |
|
var servicesRight = []; |
|
store.each(function(service) { |
|
// Fix some services with bad IDs |
|
// TODO: Remove in next release |
|
switch ( service.get('type') ) { |
|
case 'office365': |
|
service.set('type', 'outlook365'); |
|
break; |
|
case ' irccloud': |
|
service.set('type', 'irccloud'); |
|
break; |
|
default: |
|
break; |
|
} |
|
|
|
// If the service is disabled, we dont add it to tab bar |
|
if ( !service.get('enabled') ) return; |
|
|
|
var cfg = { |
|
xtype: 'webview' |
|
,id: 'tab_'+service.get('id') |
|
,title: service.get('name') |
|
,icon: service.get('type') !== 'custom' ? 'resources/icons/'+service.get('logo') : ( service.get('logo') === '' ? 'resources/icons/custom.png' : service.get('logo')) |
|
,src: service.get('url') |
|
,type: service.get('type') |
|
,muted: service.get('muted') |
|
,includeInGlobalUnreadCounter: service.get('includeInGlobalUnreadCounter') |
|
,displayTabUnreadCounter: service.get('displayTabUnreadCounter') |
|
,enabled: service.get('enabled') |
|
,record: service |
|
,tabConfig: { |
|
service: service |
|
} |
|
}; |
|
|
|
service.get('align') === 'left' ? servicesLeft.push(cfg) : servicesRight.push(cfg); |
|
}); |
|
|
|
if ( !Ext.isEmpty(servicesLeft) ) Ext.cq1('app-main').insert(1, servicesLeft); |
|
if ( !Ext.isEmpty(servicesRight) ) Ext.cq1('app-main').add(servicesRight); |
|
|
|
store.suspendEvent('load'); |
|
Ext.cq1('app-main').resumeEvent('add'); |
|
} |
|
} |
|
});
|
|
|