summaryrefslogtreecommitdiff
path: root/plugins/keyboard_shortcuts
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/keyboard_shortcuts')
-rw-r--r--plugins/keyboard_shortcuts/keyboard_shortcuts.css23
-rw-r--r--plugins/keyboard_shortcuts/keyboard_shortcuts.js139
-rw-r--r--plugins/keyboard_shortcuts/keyboard_shortcuts.php130
-rw-r--r--plugins/keyboard_shortcuts/localization/cs_CZ.inc24
-rw-r--r--plugins/keyboard_shortcuts/localization/de_DE.inc10
-rw-r--r--plugins/keyboard_shortcuts/localization/en_US.inc11
-rw-r--r--plugins/keyboard_shortcuts/localization/fr_FR.inc11
-rw-r--r--plugins/keyboard_shortcuts/localization/nl_NL.inc11
-rw-r--r--plugins/keyboard_shortcuts/localization/pl_PL.inc11
-rw-r--r--plugins/keyboard_shortcuts/localization/ru_RU.inc11
-rw-r--r--plugins/keyboard_shortcuts/localization/sv_SE.inc10
-rw-r--r--plugins/keyboard_shortcuts/localization/zh_TW.inc11
-rw-r--r--plugins/keyboard_shortcuts/package.xml18
-rw-r--r--plugins/keyboard_shortcuts/skins/classic/images/keyboard.pngbin0 -> 4157 bytes
-rw-r--r--plugins/keyboard_shortcuts/skins/larry/images/keyboard.pngbin0 -> 4157 bytes
15 files changed, 420 insertions, 0 deletions
diff --git a/plugins/keyboard_shortcuts/keyboard_shortcuts.css b/plugins/keyboard_shortcuts/keyboard_shortcuts.css
new file mode 100644
index 000000000..cf29e6628
--- /dev/null
+++ b/plugins/keyboard_shortcuts/keyboard_shortcuts.css
@@ -0,0 +1,23 @@
+#keyboard_shortcuts_help {
+ display: none;
+}
+
+#keyboard_shortcuts_help div {
+ float: left;
+ width: 350px;
+}
+
+#keyboard_shortcuts_help div div.shortcut_key {
+ width: 30px;
+ float: left;
+ font-weight: bold;
+ text-align: center;
+}
+
+#keyboard_shortcuts_title {
+ margin-left: 12px;
+}
+
+#keyboard_shortcuts_link {
+ width: 31px !important;
+} \ No newline at end of file
diff --git a/plugins/keyboard_shortcuts/keyboard_shortcuts.js b/plugins/keyboard_shortcuts/keyboard_shortcuts.js
new file mode 100644
index 000000000..440c543e6
--- /dev/null
+++ b/plugins/keyboard_shortcuts/keyboard_shortcuts.js
@@ -0,0 +1,139 @@
+function keyboard_shortcuts_show_help() {
+ $('#keyboard_shortcuts_help').dialog('open');
+}
+
+$(function() {
+ rcmail.env.keyboard_shortcuts = true;
+
+ // initialize a dialog window
+ $('#keyboard_shortcuts_help').dialog({
+ autoOpen: false,
+ draggable: true,
+ modal: false,
+ resizable: false,
+ width: 750,
+ title: rcmail.gettext("keyboard_shortcuts.keyboard_shortcuts")
+ });
+
+ // if we're in an input or textarea form, skip this plugin
+ $('input,textarea').focus(function (e) {
+ rcmail.env.keyboard_shortcuts = false;
+ });
+
+ // if we move out of an input or textarea form, enable this plugin
+ $('input,textarea').blur(function (e) {
+ rcmail.env.keyboard_shortcuts = true;
+ });
+
+ // fire up the keypress event listener
+ $(document).keypress(function (e) {
+ key_pressed(e);
+ });
+
+
+ function key_pressed (e) {
+ if (!rcmail.env.keyboard_shortcuts || rcmail.env.action == 'compose' || rcmail.env.task == 'login' || e.ctrlKey || e.metaKey)
+ return true;
+
+ if (rcmail.env.action == '') { // list mailbox
+
+ if(rcmail.env.ks_functions[e.which]) {
+ this[rcmail.env.ks_functions[e.which]]();
+ return false;
+ }
+
+ switch (e.which) {
+ case 63: // ? = help
+ //keyboard_shortcuts_show_help();
+ var ks_function = rcmail.env.ks_functions[e.which];
+ this[ks_function]();
+
+ return false;
+ case 65: // A = mark all as read
+ rcmail.command('select-all');
+ rcmail.command('mark', 'read');
+ return false;
+ case 67: // C = collapse-all
+ rcmail.command('collapse-all');
+ return false;
+ case 69: // E = expand-all
+ rcmail.command('expand-all');
+ return false;
+ case 82: // R = reply-all
+ if (rcmail.message_list.selection.length == 1)
+ rcmail.command('reply-all');
+ return false;
+ case 85: // U = expand-unread
+ rcmail.command('expand-unread');
+ return false;
+ case 97: // a = select all
+ rcmail.command('select-all');
+ return false;
+ case 99: // c = compose
+ rcmail.command('compose');
+ return false;
+ case 100: // d = delete
+ rcmail.command('delete', '', rcmail);
+ return false;
+ case 102: // f = forward
+ if (rcmail.message_list.selection.length == 1)
+ rcmail.command('forward');
+ return false;
+ case 106: // j = previous page (similar to Gmail)
+ rcmail.command('previouspage');
+ return false;
+ case 107: // k = next page (similar to Gmail)
+ rcmail.command('nextpage');
+ return false;
+ case 112: // p = print
+ if (rcmail.message_list.selection.length == 1)
+ rcmail.command('print');
+ return false;
+ case 114: // r = reply
+ if (rcmail.message_list.selection.length == 1)
+ rcmail.command('reply');
+ return false;
+ case 115: // s = search
+ $('#quicksearchbox').focus();
+ $('#quicksearchbox').select();
+ return false;
+ case 117: // u = update (check for mail)
+ rcmail.command('checkmail');
+ return false;
+ }
+ } else if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') {
+ switch (e.which) {
+ case 82: // R = reply-all
+ rcmail.command('reply-all');
+ return false;
+ case 99: // c = compose
+ rcmail.command('compose');
+ return false;
+ case 100: // d = delete
+ rcmail.command('delete');
+ return false;
+ case 102: // f = forward
+ rcmail.command('forward');
+ return false;
+ case 106: // j = previous message (similar to Gmail)
+ rcmail.command('previousmessage');
+ return false;
+ case 107: // k = next message (similar to Gmail)
+ rcmail.command('nextmessage');
+ return false;
+ case 112: // p = print
+ rcmail.command('print');
+ return false;
+ case 114: // r = reply
+ rcmail.command('reply');
+ return false;
+
+ }
+ }
+ }
+});
+
+// support functions for each function we support
+function ks_help() {
+ keyboard_shortcuts_show_help();
+}
diff --git a/plugins/keyboard_shortcuts/keyboard_shortcuts.php b/plugins/keyboard_shortcuts/keyboard_shortcuts.php
new file mode 100644
index 000000000..3599c7b2f
--- /dev/null
+++ b/plugins/keyboard_shortcuts/keyboard_shortcuts.php
@@ -0,0 +1,130 @@
+<?php
+/**
+ * keyboard_shortcuts
+ *
+ * Enables some common tasks to be executed with keyboard shortcuts
+ *
+ * @version 1.4 - 07.07.2010
+ * @author Patrik Kullman / Roland 'rosali' Liebl / Cor Bosman <roundcube@wa.ter.net>
+ * @licence GNU GPL
+ *
+ **/
+ /** *
+ **/
+
+/**
+ * Shortcuts, list view:
+ * ?: Show shortcut help
+ * a: Select all visible messages
+ * A: Mark all as read (as Google Reader)
+ * c: Compose new message
+ * d: Delete message
+ * f: Forward message
+ * j: Go to previous page of messages (as Gmail)
+ * k: Go to next page of messages (as Gmail)
+ * p: Print message
+ * r: Reply to message
+ * R: Reply to all of message
+ * s: Jump to quicksearch
+ * u: Check for new mail (update)
+ *
+ * Shortcuts, threads view:
+ * E: Expand all
+ * C: Collapse all
+ * U: Expand Unread
+ *
+ * Shortcuts, mail view:
+ * d: Delete message
+ * f: Forward message
+ * j: Go to previous message (as Gmail)
+ * k: Go to next message (as Gmail)
+ * p: Print message
+ * r: Reply to message
+ * R: Reply to all of message
+ */
+
+class keyboard_shortcuts extends rcube_plugin
+{
+ public $task = 'mail';
+
+ function init()
+ {
+ // only init in authenticated state and if newuserdialog is finished
+ // do not init on compose (css incompatibility with compose_addressbook plugin
+ $rcmail = rcmail::get_instance();
+ $this->require_plugin('jqueryui');
+
+ if($_SESSION['username'] && empty($_SESSION['plugin.newuserdialog']) && $rcmail->action != 'compose'){
+ $this->include_stylesheet('keyboard_shortcuts.css');
+ $this->include_script('keyboard_shortcuts.js');
+ $this->add_hook('template_container', array($this, 'html_output'));
+ $this->add_texts('localization', true);
+ }
+ }
+
+ function html_output($p) {
+ if ($p['name'] == "listcontrols") {
+ $rcmail = rcmail::get_instance();
+ $skin = $rcmail->config->get('skin');
+
+ if(!file_exists('plugins/keyboard_shortcuts/skins/' . $skin . '/images/keyboard.png')){
+ $skin = "default";
+ }
+
+ $this->load_config();
+ $keyboard_shortcuts = $rcmail->config->get('keyboard_shortcuts_extras', array());
+
+ $c = "";
+ $c .= '<span id="keyboard_shortcuts_title">' . $this->gettext("title") . ":&nbsp;</span><a id='keyboard_shortcuts_link' href='#' class='button' title='".$this->gettext("show_keyboard_shortcuts")."' onclick='return keyboard_shortcuts_show_help()'><img align='top' src='plugins/keyboard_shortcuts/skins/".$skin."/images/keyboard.png' alt='".$this->gettext("keyboard_shortcuts")." ".$this->gettext("show")."' /></a>\n";
+ $c .= "<div id='keyboard_shortcuts_help'>";
+ $c .= "<div><h4>".$this->gettext("mailboxview")."</h4>";
+ $c .= "<div class='shortcut_key'>?</div> ".$this->gettext('help')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>a</div> ".$this->gettext('selectallvisiblemessages')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>A</div> ".$this->gettext('markallvisiblemessagesasread')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>c</div> ".$this->gettext('compose')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>d</div> ".$this->gettext('deletemessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>f</div> ".$this->gettext('forwardmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>j</div> ".$this->gettext('previouspage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>k</div> ".$this->gettext('nextpage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>p</div> ".$this->gettext('printmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>r</div> ".$this->gettext('replytomessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>R</div> ".$this->gettext('replytoallmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>s</div> ".$this->gettext('quicksearch')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>u</div> ".$this->gettext('checkmail')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'> </div> <br class='clear' />";
+ $c .= "</div>";
+
+ if(!is_object($rcmail->imap)){
+ $rcmail->imap_connect();
+ }
+ $threading_supported = $rcmail->imap->get_capability('thread=references')
+ || $rcmail->imap->get_capability('thread=orderedsubject')
+ || $rcmail->imap->get_capability('thread=refs');
+
+ if ($threading_supported) {
+ $c .= "<div><h4>".$this->gettext("threads")."</h4>";
+ $c .= "<div class='shortcut_key'>E</div> ".$this->gettext('expand-all')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>C</div> ".$this->gettext('collapse-all')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>U</div> ".$this->gettext('expand-unread')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'> </div> <br class='clear' />";
+ $c .= "</div>";
+ }
+ $c .= "<div><h4>".$this->gettext("messagesdisplaying")."</h4>";
+ $c .= "<div class='shortcut_key'>d</div> ".$this->gettext('deletemessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>c</div> ".$this->gettext('compose')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>f</div> ".$this->gettext('forwardmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>j</div> ".$this->gettext('previousmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>k</div> ".$this->gettext('nextmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>p</div> ".$this->gettext('printmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>r</div> ".$this->gettext('replytomessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'>R</div> ".$this->gettext('replytoallmessage')."<br class='clear' />";
+ $c .= "<div class='shortcut_key'> </div> <br class='clear' />";
+ $c .= "</div></div>";
+
+ $rcmail->output->set_env('ks_functions', array('63' => 'ks_help'));
+
+ $p['content'] = $c . $p['content'];
+ }
+ return $p;
+ }
+}
diff --git a/plugins/keyboard_shortcuts/localization/cs_CZ.inc b/plugins/keyboard_shortcuts/localization/cs_CZ.inc
new file mode 100644
index 000000000..edaa05d96
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/cs_CZ.inc
@@ -0,0 +1,24 @@
+<?php
+
+/*
++-----------------------------------------------------------------------+
+| language/cs_CZ/labels.inc |
+| |
+| Language file of the RoundCube Webmail client |
+| Copyright (C) 2008-2009, RoundQube Dev. - Switzerland |
+| Licensed under the GNU GPL |
+| |
++-----------------------------------------------------------------------+
+| Author: Ales Pospichal <ales@pospichalales.info> |
++-----------------------------------------------------------------------+
+
+*/
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Klávesnicové zkratky';
+$labels['show_keyboard_shortcuts'] = 'Zobrazit klávesnicové zkratky';
+$labels['help'] = 'Nápověda';
+$labels['selectallvisiblemessages'] = 'Vybrat všechny viditelné zprávy';
+$labels['markallvisiblemessagesasread'] = 'Označit všechny viditelné zprávy jako přečtené';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/de_DE.inc b/plugins/keyboard_shortcuts/localization/de_DE.inc
new file mode 100644
index 000000000..c7c489514
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/de_DE.inc
@@ -0,0 +1,10 @@
+<?php
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Tastatur Shortcuts';
+$labels['show_keyboard_shortcuts'] = 'Anzeigen Tastatur Shortcuts';
+$labels['help'] = 'Hilfe';
+$labels['selectallvisiblemessages'] = 'Alle Nachrichten auswählen';
+$labels['markallvisiblemessagesasread'] = 'Alle Nachrichten als gelesen markieren';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/en_US.inc b/plugins/keyboard_shortcuts/localization/en_US.inc
new file mode 100644
index 000000000..fcd549f88
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/en_US.inc
@@ -0,0 +1,11 @@
+<?php
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Keyboard shortcuts';
+$labels['show_keyboard_shortcuts'] = 'Show keyboard shortcuts';
+$labels['help'] = 'Help';
+$labels['selectallvisiblemessages'] = 'Select all visible messages';
+$labels['markallvisiblemessagesasread'] = 'Mark all visible messages as read';
+$labels['title'] = 'Shortcuts';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/fr_FR.inc b/plugins/keyboard_shortcuts/localization/fr_FR.inc
new file mode 100644
index 000000000..4ffe7878f
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/fr_FR.inc
@@ -0,0 +1,11 @@
+<?php
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Raccourcis clavier';
+$labels['show_keyboard_shortcuts'] = 'Voir les raccourcis clavier';
+$labels['help'] = 'Aide';
+$labels['selectallvisiblemessages'] = 'Sélectionner tous les messages visibles';
+$labels['markallvisiblemessagesasread'] = 'Marquer tous les messages visibles comme lus';
+$labels['title'] = 'Raccourcis';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/nl_NL.inc b/plugins/keyboard_shortcuts/localization/nl_NL.inc
new file mode 100644
index 000000000..718a1be7f
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/nl_NL.inc
@@ -0,0 +1,11 @@
+<?php
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Sneltoetsen';
+$labels['show_keyboard_shortcuts'] = 'Show sneltoetsen';
+$labels['help'] = 'Help';
+$labels['selectallvisiblemessages'] = 'Selecteer alle berichten op deze pagina';
+$labels['markallvisiblemessagesasread'] = 'Markeer alle berichten op deze pagina als gelezen';
+$labels['title'] = 'Sneltoetsen';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/pl_PL.inc b/plugins/keyboard_shortcuts/localization/pl_PL.inc
new file mode 100644
index 000000000..eafbe7ab8
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/pl_PL.inc
@@ -0,0 +1,11 @@
+<?php
+/* Author: DZIOBAK */
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Skróty klawiszowe';
+$labels['show_keyboard_shortcuts'] = 'Pokaż skróty klawiszowe';
+$labels['help'] = 'Pomoc';
+$labels['selectallvisiblemessages'] = 'Zaznacz wszystkie widoczne wiadomości';
+$labels['markallvisiblemessagesasread'] = 'Zaznacz wszystkie widoczne wiadomości jako przeczytane';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/ru_RU.inc b/plugins/keyboard_shortcuts/localization/ru_RU.inc
new file mode 100644
index 000000000..45f70d84f
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/ru_RU.inc
@@ -0,0 +1,11 @@
+<?php
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Горячие клавиши';
+$labels['show_keyboard_shortcuts'] = 'Показать Горячие клавиши';
+$labels['help'] = 'Помощь';
+$labels['selectallvisiblemessages'] = 'Выделить все видимые сообщения';
+$labels['markallvisiblemessagesasread'] = 'Пометить все видимые сообщения как прочитанные';
+$labels['title'] = 'Горячие клавиши';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/sv_SE.inc b/plugins/keyboard_shortcuts/localization/sv_SE.inc
new file mode 100644
index 000000000..e858e1221
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/sv_SE.inc
@@ -0,0 +1,10 @@
+<?php
+
+$labels = array();
+$labels['keyboard_shortcuts'] = 'Kortkommandon';
+$labels['show_keyboard_shortcuts'] = 'Visa kortkommandon';
+$labels['help'] = 'Hj&auml;lp';
+$labels['selectallvisiblemessages'] = 'Markera alla synliga meddelanden';
+$labels['markallvisiblemessagesasread'] = 'Markera alla synliga meddelanden som l&auml;sta';
+
+?>
diff --git a/plugins/keyboard_shortcuts/localization/zh_TW.inc b/plugins/keyboard_shortcuts/localization/zh_TW.inc
new file mode 100644
index 000000000..a198dea38
--- /dev/null
+++ b/plugins/keyboard_shortcuts/localization/zh_TW.inc
@@ -0,0 +1,11 @@
+<?php
+
+$labels = array();
+$labels['keyboard_shortcuts'] = '快速鍵';
+$labels['show_keyboard_shortcuts'] = '顯示快速鍵';
+$labels['help'] = '說明';
+$labels['selectallvisiblemessages'] = '選擇所有此頁的訊息';
+$labels['markallvisiblemessagesasread'] = '標示所有此頁訊息以閱讀';
+$labels['title'] = '快速鍵';
+
+?>
diff --git a/plugins/keyboard_shortcuts/package.xml b/plugins/keyboard_shortcuts/package.xml
new file mode 100644
index 000000000..aa39b0dd9
--- /dev/null
+++ b/plugins/keyboard_shortcuts/package.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.0" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+ http://pear.php.net/dtd/tasks-1.0.xsd
+ http://pear.php.net/dtd/package-2.0
+ http://pear.php.net/dtd/package-2.0.xsd">
+ <name>keyboard_shortcuts</name>
+ <lead>
+ <name>Cor Bosman</name>
+ <user>cor</user>
+ <email>cor@roundcu.be</email>
+ <active>yes</active>
+ </lead>
+ <uri>https://github.com/corbosman/keyboard_shortcuts</uri>
+ <version>
+ <release>2.0.2</release>
+ </version>
+ <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
+</package>
diff --git a/plugins/keyboard_shortcuts/skins/classic/images/keyboard.png b/plugins/keyboard_shortcuts/skins/classic/images/keyboard.png
new file mode 100644
index 000000000..5719b76b2
--- /dev/null
+++ b/plugins/keyboard_shortcuts/skins/classic/images/keyboard.png
Binary files differ
diff --git a/plugins/keyboard_shortcuts/skins/larry/images/keyboard.png b/plugins/keyboard_shortcuts/skins/larry/images/keyboard.png
new file mode 100644
index 000000000..5719b76b2
--- /dev/null
+++ b/plugins/keyboard_shortcuts/skins/larry/images/keyboard.png
Binary files differ