Browse Source

Fixed shortcuts for Ctrl + Tab and Ctrl + Shift + Tab, and added Ctrl + PG_UP and DOWN

pull/367/head
Ramiro Saenz 9 years ago
parent
commit
515736ecc2
  1. 43
      app/Application.js

43
app/Application.js

@ -42,9 +42,10 @@ Ext.define('Rambox.Application', {
,handler: function(key) { ,handler: function(key) {
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());
if ( tabPanel.items.items[activeIndex + 1] && tabPanel.items.items[activeIndex + 1].id === 'tbfill' ) activeIndex++; var i = activeIndex + 1;
if ( !tabPanel.items.items[activeIndex + 1] ) activeIndex = -1; if ( i >= tabPanel.items.items.length - 1 ) i = 0;
tabPanel.setActiveTab( activeIndex + 1 ); while ( tabPanel.items.items[i].id === 'tbfill' ) i++;
tabPanel.setActiveTab( i );
} }
} }
,{ ,{
@ -55,10 +56,38 @@ Ext.define('Rambox.Application', {
,handler: function(key) { ,handler: function(key) {
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());
if ( tabPanel.items.items[activeIndex - 1] && tabPanel.items.items[activeIndex - 1].id === 'tbfill' ) activeIndex--; var i = activeIndex - 1;
if ( !tabPanel.items.items[activeIndex - 1] && tabPanel.items.items.length !== 2 ) activeIndex = tabPanel.items.items.length; if ( i < 0 ) i = tabPanel.items.items.length - 1;
if ( tabPanel.items.items.length === 2 ) activeIndex = 1; while ( tabPanel.items.items[i].id === 'tbfill' || i < 0 ) i--;
tabPanel.setActiveTab( activeIndex - 1 ); tabPanel.setActiveTab( i );
}
}
,{
key: Ext.event.Event.PAGE_DOWN
,ctrl: true
,alt: false
,shift: false
,handler: function(key) {
var tabPanel = Ext.cq1('app-main');
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex + 1;
if ( i >= tabPanel.items.items.length - 1 ) i = 0;
while ( tabPanel.items.items[i].id === 'tbfill' ) i++;
tabPanel.setActiveTab( i );
}
}
,{
key: Ext.event.Event.PAGE_UP
,ctrl: true
,alt: false
,shift: false
,handler: function(key) {
var tabPanel = Ext.cq1('app-main');
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex - 1;
if ( i < 0 ) i = tabPanel.items.items.length - 1;
while ( tabPanel.items.items[i].id === 'tbfill' ) i--;
tabPanel.setActiveTab( i );
} }
} }
,{ ,{

Loading…
Cancel
Save