Browse Source

Merge branch 'master' into xing-522

pull/523/head
Ramiro Saenz 8 years ago committed by GitHub
parent
commit
d07e32125a
  1. 1
      Backers.md
  2. 11
      app/Application.js
  3. 13
      app/model/Service.js
  4. 6
      app/store/Services.js
  5. 30
      app/store/ServicesList.js
  6. 57
      app/util/Notifier.js
  7. 75
      app/util/UnreadCounter.js
  8. 118
      app/ux/WebView.js
  9. 27
      app/view/add/Add.js
  10. 46
      app/view/add/AddController.js
  11. 33
      app/view/preferences/Preferences.js
  12. 28
      app/view/preferences/PreferencesController.js
  13. 23
      electron/main.js
  14. 34
      overrides/layout/container/boxOverflow/Scroller.js
  15. BIN
      resources/icons/workplace.png

1
Backers.md

@ -3,3 +3,4 @@
[Martin Grünbaum](https://github.com/alathon) [Martin Grünbaum](https://github.com/alathon)
Ivan Toshkov Ivan Toshkov
[Simon Joda Stößer](https://github.com/SimJoSt)

11
app/Application.js

@ -44,9 +44,14 @@ Ext.define('Rambox.Application', {
var tabPanel = Ext.cq1('app-main'); var tabPanel = Ext.cq1('app-main');
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex + 1; var i = activeIndex + 1;
if ( i >= tabPanel.items.items.length - 1 ) i = 0;
while ( tabPanel.items.items[i].id === 'tbfill' ) i++; // "cycle" (go to the start) when the end is reached or the end is the spacer "tbfill"
tabPanel.setActiveTab( i ); if (i === tabPanel.items.items.length || i === tabPanel.items.items.length - 1 && tabPanel.items.items[i].id === 'tbfill') i = 0;
// skip spacer
while (tabPanel.items.items[i].id === 'tbfill') i++;
tabPanel.setActiveTab(i);
} }
} }
,{ ,{

13
app/model/Service.js

@ -37,7 +37,18 @@ Ext.define('Rambox.model.Service', {
name: 'muted' name: 'muted'
,type: 'boolean' ,type: 'boolean'
,defaultValue: false ,defaultValue: false
},{ },
{
name: 'displayTabUnreadCounter',
type: 'boolean',
defaultValue: true
},
{
name: 'includeInGlobalUnreadCounter',
type: 'boolean',
defaultValue: true
},
{
name: 'trust' name: 'trust'
,type: 'boolean' ,type: 'boolean'
,defaultValue: false ,defaultValue: false

6
app/store/Services.js

@ -33,8 +33,10 @@ Ext.define('Rambox.store.Services', {
,icon: service.get('type') !== 'custom' ? 'resources/icons/'+service.get('logo') : ( service.get('logo') === '' ? 'resources/icons/custom.png' : service.get('logo')) ,icon: service.get('type') !== 'custom' ? 'resources/icons/'+service.get('logo') : ( service.get('logo') === '' ? 'resources/icons/custom.png' : service.get('logo'))
,src: service.get('url') ,src: service.get('url')
,type: service.get('type') ,type: service.get('type')
,muted: service.get('muted') ,muted: service.get('muted'),
,enabled: service.get('enabled') includeInGlobalUnreadCounter: service.get('includeInGlobalUnreadCounter'),
displayTabUnreadCounter: service.get('displayTabUnreadCounter'),
enabled: service.get('enabled')
,record: service ,record: service
,tabConfig: { ,tabConfig: {
service: service service: service

30
app/store/ServicesList.js

@ -95,7 +95,7 @@ Ext.define('Rambox.store.ServicesList', {
,url: 'https://web.telegram.org/' ,url: 'https://web.telegram.org/'
,type: 'messaging' ,type: 'messaging'
,titleBlink: true ,titleBlink: true
,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("im_dialog_badge badge"),t=0;for(i=0;i<e.length;i++)t+=parseInt(e[i].innerHTML.trim());updateBadge(t)}function updateBadge(e){document.title="("+e+") RamboxService"}setInterval(checkUnread,3000);' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("im_dialog_badge badge"),t=0;for(i=0;i<e.length;i++)if(!e[i].classList.contains("im_dialog_badge_muted")){t+=parseInt(e[i].innerHTML.trim())}}function updateBadge(e){document.title="("+e+") RamboxService"}setInterval(checkUnread,3000);'
}, },
{ {
id: 'wechat' id: 'wechat'
@ -459,7 +459,7 @@ Ext.define('Rambox.store.ServicesList', {
,type: 'email' ,type: 'email'
}, },
{ {
id: ' irccloud' id: 'irccloud'
,logo: 'irccloud.png' ,logo: 'irccloud.png'
,name: 'IRCCloud' ,name: 'IRCCloud'
,description: 'IRCCloud is a modern IRC client that keeps you connected, with none of the baggage.' ,description: 'IRCCloud is a modern IRC client that keeps you connected, with none of the baggage.'
@ -662,14 +662,22 @@ Ext.define('Rambox.store.ServicesList', {
,type: 'messaging' ,type: 'messaging'
}, },
{ {
id: 'xing', id: 'xing'
logo: 'xing.png', ,logo: 'xing.png'
name: 'XING', ,name: 'XING'
description: 'Career-oriented social networking', ,description: 'Career-oriented social networking'
url: 'https://www.xing.com/messages/conversations', ,url: 'https://www.xing.com/messages/conversations'
type: 'messaging', ,type: 'messaging'
js_unread: '(function() { let originalTitle = document.title; function checkUnread() { let count = null; let notificationElement = document.querySelector(\'[data-update="unread_conversations"]\'); if (notificationElement && notificationElement.style.display !== \'none\') { count = parseInt(notificationElement.textContent.trim(), 10); } updateBadge(count); } function updateBadge(count) { if (count && count >= 1) { rambox.setUnreadCount(count); } else { rambox.clearUnreadCount(); } } setInterval(checkUnread, 3000); checkUnread(); })();', ,js_unread: '(function() { let originalTitle = document.title; function checkUnread() { let count = null; let notificationElement = document.querySelector(\'[data-update="unread_conversations"]\'); if (notificationElement && notificationElement.style.display !== \'none\') { count = parseInt(notificationElement.textContent.trim(), 10); } updateBadge(count); } function updateBadge(count) { if (count && count >= 1) { rambox.setUnreadCount(count); } else { rambox.clearUnreadCount(); } } setInterval(checkUnread, 3000); checkUnread(); })();'
dont_update_unread_from_title: true ,dont_update_unread_from_title: true
},
{
id: 'Workplace'
,logo: 'workplace.png'
,name: 'Workplace by Facebook'
,description: 'Connect everyone in your company and turn ideas into action. Through group discussion, a personalised News Feed, and voice and video calling, work together and get more done. Workplace is an ad-free space, separate from your personal Facebook account.'
,url: 'https://___.facebook.com/'
,type: 'messaging'
} }
] ]
}); });

57
app/util/Notifier.js

@ -0,0 +1,57 @@
/**
* Singleton class for notification dispatching.
*/
Ext.define('Rambox.util.Notifier', {
singleton: true,
constructor: function(config) {
config = config || {};
/**
* Returns the notification text depending on the service type.
*
* @param view
* @param count
* @return {*}
*/
function getNotificationText(view, count) {
var text;
switch (Ext.getStore('ServicesList').getById(view.type).get('type')) {
case 'messaging':
text = 'You have ' + Ext.util.Format.plural(count, 'new message', 'new messages') + '.';
break;
case 'email':
text = 'You have ' + Ext.util.Format.plural(count, 'new email', 'new emails') + '.';
break;
default:
text = 'You have ' + Ext.util.Format.plural(count, 'new activity', 'new activities') + '.';
break;
}
return text;
}
/**
* Dispatches a notification for a specific service.
*
* @param view The view of the service
* @param {number} count The unread count
*/
this.dispatchNotification = function(view, count) {
var text = getNotificationText(view, count);
var notification = new Notification(view.record.get('name'), {
body: text,
icon: view.tab.icon,
silent: view.record.get('muted')
});
notification.onclick = function() {
require('electron').remote.getCurrentWindow().show();
Ext.cq1('app-main').setActiveTab(view);
};
}
}
});

75
app/util/UnreadCounter.js

@ -0,0 +1,75 @@
/**
* Singleton class to handle the global unread counter.
*/
Ext.define('Rambox.util.UnreadCounter', {
singleton: true,
constructor: function(config) {
config = config || {};
/**
* Map for storing the global unread count.
* service id -> unread count
*
* @type {Map}
*/
var unreadCountByService = new Map();
/**
* Holds the global unread count for internal usage.
*
* @type {number}
*/
var totalUnreadCount = 0;
/**
* Sets the application's unread count to tracked unread count.
*/
function updateAppUnreadCounter() {
Rambox.app.setTotalNotifications(totalUnreadCount);
}
/**
* Returns the global unread count.
*
* @return {number}
*/
this.getTotalUnreadCount = function() {
return totalUnreadCount;
};
/**
* Sets the global unread count for a specific service.
*
* @param {*} id Id of the service to set the global unread count for.
* @param {number} unreadCount The global unread count for the service.
*/
this.setUnreadCountForService = function(id, unreadCount) {
unreadCount = parseInt(unreadCount, 10);
if (unreadCountByService.has(id)) {
totalUnreadCount -= unreadCountByService.get(id);
}
totalUnreadCount += unreadCount;
unreadCountByService.set(id, unreadCount);
updateAppUnreadCounter();
};
/**
* Clears the global unread count for a specific service.
*
* @param {*} id Id of the service to clear the global unread count for.
*/
this.clearUnreadCountForService = function(id) {
if (unreadCountByService.has(id)) {
totalUnreadCount -= unreadCountByService.get(id);
}
unreadCountByService['delete'](id);
updateAppUnreadCounter();
}
}
});

118
app/ux/WebView.js

@ -6,14 +6,17 @@ Ext.define('Rambox.ux.WebView',{
,xtype: 'webview' ,xtype: 'webview'
,requires: [ ,requires: [
'Rambox.util.Format' 'Rambox.util.Format',
] 'Rambox.util.Notifier',
'Rambox.util.UnreadCounter'
],
// private // private
,zoomLevel: 0 zoomLevel: 0,
currentUnreadCount: 0,
// CONFIG // CONFIG
,hideMode: 'offsets' hideMode: 'offsets'
,initComponent: function(config) { ,initComponent: function(config) {
var me = this; var me = this;
@ -44,8 +47,7 @@ Ext.define('Rambox.ux.WebView',{
,muted: me.record.get('muted') ,muted: me.record.get('muted')
,tabConfig: { ,tabConfig: {
listeners: { listeners: {
badgetextchange: me.onBadgeTextChange afterrender : function( btn ) {
,afterrender : function( btn ) {
btn.el.on('contextmenu', function(e) { btn.el.on('contextmenu', function(e) {
btn.showMenu('contextmenu'); btn.showMenu('contextmenu');
e.stopEvent(); e.stopEvent();
@ -169,42 +171,6 @@ Ext.define('Rambox.ux.WebView',{
return cfg; return cfg;
} }
,onBadgeTextChange: function( tab, badgeText, oldBadgeText ) {
var me = this;
if ( oldBadgeText === null ) oldBadgeText = 0;
var actualNotifications = Rambox.app.getTotalNotifications();
oldBadgeText = Rambox.util.Format.stripNumber(oldBadgeText);
badgeText = Rambox.util.Format.stripNumber(badgeText);
Rambox.app.setTotalNotifications(actualNotifications - oldBadgeText + badgeText);
// Some services dont have Desktop Notifications, so we add that functionality =)
if ( Ext.getStore('ServicesList').getById(me.type).get('manual_notifications') && oldBadgeText < badgeText && me.record.get('notifications') && !JSON.parse(localStorage.getItem('dontDisturb')) ) {
var text;
switch ( Ext.getStore('ServicesList').getById(me.type).get('type') ) {
case 'messaging':
text = 'You have ' + Ext.util.Format.plural(badgeText, 'new message', 'new messages') + '.';
break;
case 'email':
text = 'You have ' + Ext.util.Format.plural(badgeText, 'new email', 'new emails') + '.';
break;
default:
text = 'You have ' + Ext.util.Format.plural(badgeText, 'new activity', 'new activities') + '.';
break;
}
var not = new Notification(me.record.get('name'), {
body: text
,icon: tab.icon
,silent: me.record.get('muted')
});
not.onclick = function() {
require('electron').remote.getCurrentWindow().show();
Ext.cq1('app-main').setActiveTab(me);
};
}
}
,onAfterRender: function() { ,onAfterRender: function() {
var me = this; var me = this;
@ -342,21 +308,78 @@ Ext.define('Rambox.ux.WebView',{
count = count === '•' ? count : Ext.isArray(count.match(/\d+/g)) ? count.match(/\d+/g).join("") : count.match(/\d+/g); // Some services have special characters. Example: (•) count = count === '•' ? count : Ext.isArray(count.match(/\d+/g)) ? count.match(/\d+/g).join("") : count.match(/\d+/g); // Some services have special characters. Example: (•)
count = count === null ? '0' : count; count = count === null ? '0' : count;
me.tab.setBadgeText(Rambox.util.Format.formatNumber(count)); me.setUnreadCount(count);
}); });
} }
webview.addEventListener('did-get-redirect-request', function( e ) { webview.addEventListener('did-get-redirect-request', function( e ) {
if ( e.isMainFrame ) webview.loadURL(e.newURL); if ( e.isMainFrame ) webview.loadURL(e.newURL);
}); });
} },
,reloadService: function(btn) { setUnreadCount: function(newUnreadCount) {
var me = this;
if (me.record.get('includeInGlobalUnreadCounter') === true) {
Rambox.util.UnreadCounter.setUnreadCountForService(me.record.get('id'), newUnreadCount);
} else {
Rambox.util.UnreadCounter.clearUnreadCountForService(me.record.get('id'));
}
me.setTabBadgeText(Rambox.util.Format.formatNumber(newUnreadCount));
/**
* Dispatch manual notification if
* service doesn't have notifications, so Rambox does them
* count increased
* not in dnd mode
* notifications enabled
*/
if (Ext.getStore('ServicesList').getById(me.type).get('manual_notifications') &&
me.currentUnreadCount < newUnreadCount &&
me.record.get('notifications') &&
!JSON.parse(localStorage.getItem('dontDisturb'))) {
Rambox.util.Notifier.dispatchNotification(me, newUnreadCount);
}
me.currentUnreadCount = newUnreadCount;
},
refreshUnreadCount: function() {
this.setUnreadCount(this.currentUnreadCount);
},
/**
* Sets the tab badge text depending on the service config param "displayTabUnreadCounter".
*
* @param {string} badgeText
*/
setTabBadgeText: function(badgeText) {
var me = this;
if (me.record.get('displayTabUnreadCounter') === true) {
me.tab.setBadgeText(badgeText);
} else {
me.tab.setBadgeText('');
}
},
/**
* Clears the unread counter for this view:
* clears the badge text
* clears the global unread counter
*/
clearUnreadCounter: function() {
var me = this;
me.tab.setBadgeText('');
Rambox.util.UnreadCounter.clearUnreadCountForService(me.record.get('id'));
},
reloadService: function(btn) {
var me = this; var me = this;
var webview = me.down('component').el.dom; var webview = me.down('component').el.dom;
if ( me.record.get('enabled') ) { if ( me.record.get('enabled') ) {
me.tab.setBadgeText(''); me.clearUnreadCounter();
webview.loadURL(me.src); webview.loadURL(me.src);
} }
} }
@ -402,7 +425,8 @@ Ext.define('Rambox.ux.WebView',{
,setEnabled: function(enabled) { ,setEnabled: function(enabled) {
var me = this; var me = this;
me.tab.setBadgeText(''); me.clearUnreadCounter();
me.removeAll(); me.removeAll();
me.add(me.webViewConstructor(enabled)); me.add(me.webViewConstructor(enabled));
if ( enabled ) { if ( enabled ) {

27
app/view/add/Add.js

@ -162,8 +162,31 @@ Ext.define('Rambox.view.add.Add',{
,inputValue: true ,inputValue: true
} }
] ]
} },
,{ {
xtype: 'fieldset',
title: 'Unread counter',
margin: '10 0 0 0',
items: [
{
xtype: 'checkbox',
boxLabel: 'Display tab unread counter',
name: 'displayTabUnreadCounter',
checked: me.edit ? me.record.get('displayTabUnreadCounter') : true,
uncheckedValue: false,
inputValue: true
},
{
xtype: 'checkbox',
boxLabel: 'Include in global unread counter',
name: 'includeInGlobalUnreadCounter',
checked: me.edit ? me.record.get('includeInGlobalUnreadCounter') : true,
uncheckedValue: false,
inputValue: true
}
]
},
{
xtype: 'fieldset' xtype: 'fieldset'
,title: 'Advanced' ,title: 'Advanced'
,margin: '10 0 0 0' ,margin: '10 0 0 0'

46
app/view/add/AddController.js

@ -1,8 +1,12 @@
Ext.define('Rambox.view.add.AddController', { Ext.define('Rambox.view.add.AddController', {
extend: 'Ext.app.ViewController' extend: 'Ext.app.ViewController',
,alias: 'controller.add-add' alias: 'controller.add-add',
,doCancel: function( btn ) { requires: [
'Rambox.util.UnreadCounter'
],
doCancel: function( btn ) {
var me = this; var me = this;
me.getView().close(); me.getView().close();
@ -29,37 +33,44 @@ Ext.define('Rambox.view.add.AddController', {
,url: formValues.url ,url: formValues.url
,align: formValues.align ,align: formValues.align
,notifications: formValues.notifications ,notifications: formValues.notifications
,muted: formValues.muted ,muted: formValues.muted,
,trust: formValues.trust displayTabUnreadCounter: formValues.displayTabUnreadCounter,
includeInGlobalUnreadCounter: formValues.includeInGlobalUnreadCounter,
trust: formValues.trust
,js_unread: formValues.js_unread ,js_unread: formValues.js_unread
}); });
var view = Ext.getCmp('tab_'+win.record.get('id'));
// Change the title of the Tab // Change the title of the Tab
Ext.getCmp('tab_'+win.record.get('id')).setTitle(formValues.serviceName); view.setTitle(formValues.serviceName);
// Change sound of the Tab // Change sound of the Tab
Ext.getCmp('tab_'+win.record.get('id')).setAudioMuted(formValues.muted); view.setAudioMuted(formValues.muted);
// Change notifications of the Tab // Change notifications of the Tab
Ext.getCmp('tab_'+win.record.get('id')).setNotifications(formValues.notifications); view.setNotifications(formValues.notifications);
// Change the icon of the Tab // Change the icon of the Tab
if ( win.record.get('type') === 'custom' && oldData.logo !== formValues.logo ) Ext.getCmp('tab_'+win.record.get('id')).setConfig('icon', formValues.logo === '' ? 'resources/icons/custom.png' : formValues.logo); if ( win.record.get('type') === 'custom' && oldData.logo !== formValues.logo ) Ext.getCmp('tab_'+win.record.get('id')).setConfig('icon', formValues.logo === '' ? 'resources/icons/custom.png' : formValues.logo);
// Change the URL of the Tab // Change the URL of the Tab
if ( oldData.url !== formValues.url ) Ext.getCmp('tab_'+win.record.get('id')).setURL(formValues.url); if ( oldData.url !== formValues.url ) view.setURL(formValues.url);
// Change the align of the Tab // Change the align of the Tab
if ( oldData.align !== formValues.align ) { if ( oldData.align !== formValues.align ) {
if ( formValues.align === 'left' ) { if ( formValues.align === 'left' ) {
Ext.cq1('app-main').moveBefore(Ext.getCmp('tab_'+win.record.get('id')), Ext.getCmp('tbfill')); Ext.cq1('app-main').moveBefore(view, Ext.getCmp('tbfill'));
} else { } else {
Ext.cq1('app-main').moveAfter(Ext.getCmp('tab_'+win.record.get('id')), Ext.getCmp('tbfill')); Ext.cq1('app-main').moveAfter(view, Ext.getCmp('tbfill'));
} }
} }
// Apply the JS Code of the Tab // Apply the JS Code of the Tab
if ( win.down('textarea').isDirty() ) { if ( win.down('textarea').isDirty() ) {
Ext.Msg.confirm('CUSTOM CODE', 'Rambox needs to reload the service to execute the new JavaScript code. Do you want to do it now?', function( btnId ) { Ext.Msg.confirm('CUSTOM CODE', 'Rambox needs to reload the service to execute the new JavaScript code. Do you want to do it now?', function( btnId ) {
if ( btnId === 'yes' ) Ext.getCmp('tab_'+win.record.get('id')).reloadService(); if ( btnId === 'yes' ) view.reloadService();
}); });
} }
Ext.getCmp('tab_'+win.record.get('id')).record = win.record; view.record = win.record;
Ext.getCmp('tab_'+win.record.get('id')).tabConfig.service = win.record; view.tabConfig.service = win.record;
view.refreshUnreadCount();
} else { } else {
// Format data // Format data
if ( win.record.get('url').indexOf('___') >= 0 ) { if ( win.record.get('url').indexOf('___') >= 0 ) {
@ -73,8 +84,10 @@ Ext.define('Rambox.view.add.AddController', {
,url: formValues.url ,url: formValues.url
,align: formValues.align ,align: formValues.align
,notifications: formValues.notifications ,notifications: formValues.notifications
,muted: formValues.muted ,muted: formValues.muted,
,trust: formValues.trust displayTabUnreadCounter: formValues.displayTabUnreadCounter,
includeInGlobalUnreadCounter: formValues.includeInGlobalUnreadCounter,
trust: formValues.trust
,js_unread: formValues.js_unread ,js_unread: formValues.js_unread
}); });
service.save(); service.save();
@ -121,5 +134,4 @@ Ext.define('Rambox.view.add.AddController', {
// Make focus to the name field // Make focus to the name field
win.down('textfield[name="serviceName"]').focus(true, 100); win.down('textfield[name="serviceName"]').focus(true, 100);
} }
}); });

33
app/view/preferences/Preferences.js

@ -67,17 +67,28 @@ Ext.define('Rambox.view.preferences.Preferences',{
,boxLabel: 'Show in Taskbar' ,boxLabel: 'Show in Taskbar'
,value: config.skip_taskbar ,value: config.skip_taskbar
,reference: 'skipTaskbar' ,reference: 'skipTaskbar'
,hidden: process.platform !== 'win32' ,hidden: process.platform === 'darwin'
} },
,{ {
xtype: 'checkbox' xtype: 'combo',
,name: 'keep_in_taskbar_on_close' name: 'window_close_behavior',
,boxLabel: 'Keep Rambox in the Taskbar when close it' fieldLabel: 'When closing the main window',
,value: config.keep_in_taskbar_on_close labelAlign: 'top',
,bind: { disabled: '{!skipTaskbar.checked}' } value: config.window_close_behavior,
,hidden: process.platform !== 'win32' displayField: 'label',
} valueField: 'value',
,{ editable: false,
store: Ext.create('Ext.data.Store', {
fields: ['value', 'label'],
data : [
{ 'value': 'keep_in_tray', 'label': 'Keep in tray' },
{ 'value': 'keep_in_tray_and_taskbar', 'label': 'Keep in tray and taskbar' },
{ 'value': 'quit', 'label': 'Quit' }
]
}),
hidden: process.platform === 'darwin'
},
{
xtype: 'checkbox' xtype: 'checkbox'
,name: 'always_on_top' ,name: 'always_on_top'
,boxLabel: 'Always on top' ,boxLabel: 'Always on top'

28
app/view/preferences/PreferencesController.js

@ -13,12 +13,28 @@ Ext.define('Rambox.view.preferences.PreferencesController', {
var values = me.getView().down('form').getForm().getFieldValues(); var values = me.getView().down('form').getForm().getFieldValues();
// Master Password // master password activated and only one of the fields "password" or "password confirmation" filled
if ( values.master_password && (Ext.isEmpty(values.master_password1) || Ext.isEmpty(values.master_password2)) ) return; if (values.master_password === true &&
if ( values.master_password && (values.master_password1 !== values.master_password2) ) return; (Ext.isEmpty(values.master_password1) === false && Ext.isEmpty(values.master_password2) === true ||
if ( values.master_password ) values.master_password = Rambox.util.MD5.encypt(values.master_password1); Ext.isEmpty(values.master_password1) === true && Ext.isEmpty(values.master_password2) === false)) return;
delete values.master_password1;
delete values.master_password2; // password and confirmation don't match
if (values.master_password === true && (values.master_password1 !== values.master_password2)) return;
// master password activated and changed
if (values.master_password === true &&
Ext.isEmpty(values.master_password1) === false &&
Ext.isEmpty(values.master_password2) === false) {
values.master_password = Rambox.util.MD5.encypt(values.master_password1);
delete values.master_password1;
delete values.master_password2;
}
// prevent overwriting password when unchanged
if (values.master_password === true) {
delete values.master_password;
}
// Proxy // Proxy
if ( values.proxy && (Ext.isEmpty(values.proxyHost) || Ext.isEmpty(values.proxyPort)) ) return; if ( values.proxy && (Ext.isEmpty(values.proxyHost) || Ext.isEmpty(values.proxyPort)) ) return;

23
electron/main.js

@ -23,10 +23,9 @@ const config = new Config({
always_on_top: false always_on_top: false
,hide_menu_bar: false ,hide_menu_bar: false
,skip_taskbar: true ,skip_taskbar: true
,auto_launch: !isDev ,auto_launch: !isDev,
// On Linux false because it's uncommon for apps on linux to stay in the taskbar on close window_close_behavior: 'keep_in_tray',
,keep_in_taskbar_on_close: process.platform !== 'linux' start_minimized: false
,start_minimized: false
,systemtray_indicator: true ,systemtray_indicator: true
,master_password: false ,master_password: false
,disable_gpu: process.platform === 'linux' ,disable_gpu: process.platform === 'linux'
@ -44,7 +43,7 @@ const config = new Config({
// Configure AutoLaunch // Configure AutoLaunch
const appLauncher = new AutoLaunch({ const appLauncher = new AutoLaunch({
name: 'Rambox' name: 'Rambox.app'
,isHiddenOnLaunch: config.get('start_minimized') ,isHiddenOnLaunch: config.get('start_minimized')
}); });
config.get('auto_launch') && !isDev ? appLauncher.enable() : appLauncher.disable(); config.get('auto_launch') && !isDev ? appLauncher.enable() : appLauncher.disable();
@ -199,11 +198,19 @@ function createWindow () {
app.hide(); app.hide();
break; break;
case 'linux': case 'linux':
config.get('keep_in_taskbar_on_close') ? mainWindow.hide() : app.quit();
break;
case 'win32': case 'win32':
default: default:
config.get('keep_in_taskbar_on_close') ? mainWindow.minimize() : mainWindow.hide(); switch (config.get('window_close_behavior')) {
case 'keep_in_tray':
mainWindow.hide();
break;
case 'keep_in_tray_and_taskbar':
mainWindow.minimize();
break;
case 'quit':
app.quit();
break;
}
break; break;
} }
} }

34
overrides/layout/container/boxOverflow/Scroller.js

@ -0,0 +1,34 @@
/**
* Per default scrolling the tab bar moves the tabs 20 pixels.
* To improve the usability of the tab bar this value is increased for Rambox.
* Also animations are enabled, so the user understands what's going on.
*/
Ext.define('Rambox.overrides.layout.container.boxOverflow.Scroller', {
override: 'Ext.layout.container.boxOverflow.Scroller',
scrollIncrement: 250,
wheelIncrement: 50,
animateScroll: true,
scrollDuration: 250,
/**
* In difference to the overridden function this one enables scroll animations.
*
* @private
* Scrolls to the left by the configured amount
*/
scrollLeft: function() {
this.scrollBy(-this.scrollIncrement);
},
/**
* In difference to the overridden function this one enables scroll animations.
*
* @private
* Scrolls to the right by the configured amount
*/
scrollRight: function() {
this.scrollBy(this.scrollIncrement);
}
});

BIN
resources/icons/workplace.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Loading…
Cancel
Save