changeset 92:0359e47f38c9

TabCalendarBoard: Added CTRL+S keybind for manual saving
author Fox
date Sun, 19 Feb 2023 09:09:53 +0100
parents 4979d5820624
children 1df77c040218
files src/junotu/TabCalendarBoard.java
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/junotu/TabCalendarBoard.java	Sun Feb 19 02:39:21 2023 +0100
+++ b/src/junotu/TabCalendarBoard.java	Sun Feb 19 09:09:53 2023 +0100
@@ -71,6 +71,7 @@
     final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
     final static SimpleDateFormat DEBUG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
+    public final String KEY_ACTION_COMMIT          = "commit";
     public final String KEY_ACTION_CARD_UP         = "card_up";
     public final String KEY_ACTION_CARD_DOWN       = "card_down";
     public final String KEY_ACTION_CARD_FULL_UP    = "card_full_up";
@@ -583,6 +584,8 @@
 	options.addActionListener(this);
 	menu_onlyFilled.addActionListener(this);
 
+	registerKeyboardAction( this, KEY_ACTION_COMMIT, KeyStroke.getKeyStroke( KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK ), WHEN_IN_FOCUSED_WINDOW );
+
 	back.setToolTipText("Go back to where the calendar board was accessed from.");
 	options.setToolTipText("Show calendar options.");
 	menu_onlyFilled.setToolTipText("If checked, days with no cards will be hidden.");
@@ -821,7 +824,16 @@
     public void actionPerformed( ActionEvent e )
     {
 	Object source = e.getSource();
-	if( source == back ) {
+	if( source == this ){
+	    switch( e.getActionCommand() ) {
+		
+	    case KEY_ACTION_COMMIT: {
+		boardSave();
+		return;
+	    }
+		
+	    }
+	} else if( source == back ) {
 	    buttonClickedBack();
 	    return;
 	} else if( source == options ) {