From 73e4309c1fc1a934c875461d55df23f38ccc096f Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Tue, 26 Jul 2016 10:55:51 -0300 Subject: [PATCH] Shortcuts for Dont Disturb and Lock F1 and F2 --- app/Application.js | 21 +++++++++++++++++++++ app/view/main/Main.js | 6 ++++-- app/view/main/MainController.js | 8 ++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/Application.js b/app/Application.js index 1603ba12..6795a9f0 100644 --- a/app/Application.js +++ b/app/Application.js @@ -100,6 +100,27 @@ Ext.define('Rambox.Application', { Ext.cq1('app-main').setActiveTab(key - 48); } } + ,{ + key: Ext.event.Event.F1 + ,ctrl: false + ,alt: false + ,shift: false + ,handler: function(key) { + var btn = Ext.getCmp('disturbBtn'); + btn.toggle(); + Ext.cq1('app-main').getController().dontDisturb(btn); + } + } + ,{ + key: Ext.event.Event.F2 + ,ctrl: false + ,alt: false + ,shift: false + ,handler: function(key) { + var btn = Ext.getCmp('lockRamboxBtn'); + Ext.cq1('app-main').getController().lockRambox(btn); + } + } ] }); diff --git a/app/view/main/Main.js b/app/view/main/Main.js index c655ef03..51124b16 100644 --- a/app/view/main/Main.js +++ b/app/view/main/Main.js @@ -215,16 +215,18 @@ Ext.define('Rambox.view.main.Main', { { glyph: 'xf1f7@FontAwesome' ,text: 'Don\'t Disturb: OFF' - ,tooltip: 'Disable notifications and sounds in all services. Perfect to be concentrated and focused.' + ,tooltip: 'Disable notifications and sounds in all services. Perfect to be concentrated and focused.
Shortcut key: F1' ,enableToggle: true ,handler: 'dontDisturb' ,reference: 'disturbBtn' + ,id: 'disturbBtn' } ,{ glyph: 'xf023@FontAwesome' ,text: 'Lock Rambox' - ,tooltip: 'Lock this app if you will be away for a period of time.' + ,tooltip: 'Lock this app if you will be away for a period of time.
Shortcut key: F2' ,handler: 'lockRambox' + ,id: 'lockRamboxBtn' } ,'->' ,{ diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index b9531abb..901877e1 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -749,6 +749,14 @@ Ext.define('Rambox.view.main.MainController', { }); btn.setText('Don\'t Disturb: ' + ( btn.pressed ? 'ON' : 'OFF' )); + + Ext.toast({ + html: btn.pressed ? 'ENABLED' : 'DISABLED' + ,title: 'Don\'t Disturb' + ,width: 200 + ,align: 't' + ,closable: false + }); } ,lockRambox: function(btn) {