Index: apps/action.h
===================================================================
--- apps/action.h.orig
+++ apps/action.h
@@ -128,6 +128,7 @@ enum {
     ACTION_TREE_PGRIGHT,/* optional */
     ACTION_TREE_STOP,
     ACTION_TREE_WPS,
+    ACTION_TREE_INSERT,
     
     /* radio */
     ACTION_FM_MENU,
Index: apps/onplay.c
===================================================================
--- apps/onplay.c.orig
+++ apps/onplay.c
@@ -59,6 +59,7 @@
 #include "main_menu.h"
 #include "sound_menu.h"
 #include "database.h"
+#include "filetree.h"
 #if CONFIG_CODEC == SWCODEC
 #include "eq_menu.h"
 #endif
@@ -1008,3 +1009,41 @@ int onplay(char* file, int attr, int fro
 
     return onplay_result;
 }
+/*one click insert modification*/
+
+int onplay_one_click(char* file, int attr, int from){
+    int ret=1;
+    context=from;
+    selected_file = file;
+    selected_file_attr = attr;
+	bool empty_playlist=true;
+	
+	if (audio_status() & AUDIO_STATUS_PLAY)
+	{
+		// MWE if playlist is empty PLAYLIST_INSERT_FIRST is doing
+		// the wrong thing in id3 mode -(
+		empty_playlist=false;
+	}
+		
+    if(global_settings.click_insert==0)
+		return ret;		
+		
+    if(global_settings.click_insert==1)
+        add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT, false);
+	else if(global_settings.click_insert==2)
+		add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT_FIRST, false);
+    else if(global_settings.click_insert==3)
+        add_to_playlist(PLAYLIST_INSERT_LAST, false);
+    else if(global_settings.click_insert==4)
+        add_to_playlist(PLAYLIST_INSERT_SHUFFLED, false);
+    else if(global_settings.click_insert==5)	
+		add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT, true);
+	else if(global_settings.click_insert==6)
+		add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT_FIRST, true);
+	else if(global_settings.click_insert==7)
+		add_to_playlist(PLAYLIST_INSERT_LAST, true);
+	else if(global_settings.click_insert==8)
+		add_to_playlist(PLAYLIST_INSERT_SHUFFLED, true);
+    return onplay_result;
+}
+
Index: apps/onplay.h
===================================================================
--- apps/onplay.h.orig
+++ apps/onplay.h
@@ -20,6 +20,7 @@
 #define _ONPLAY_H_
 
 int onplay(char* file, int attr, int from_screen);
+int onplay_one_click(char* file, int attr, int from);
 
 enum {
     ONPLAY_OK,
Index: apps/playlist_menu.c
===================================================================
--- apps/playlist_menu.c.orig
+++ apps/playlist_menu.c
@@ -50,6 +50,25 @@ static bool recurse_directory(void)
                        NULL );
 }
 
+static bool click_insert(void)
+{
+    static const struct opt_items names[] = {
+        { STR(LANG_CLICK_DEFAULT)},
+		{ STR(LANG_INSERT)},
+		{ STR(LANG_INSERT_FIRST)},
+		{ STR(LANG_INSERT_LAST)},
+		{ STR(LANG_INSERT_SHUFFLED)},
+		{ STR(LANG_QUEUE) },
+		{ STR(LANG_QUEUE_FIRST) },
+		{ STR(LANG_QUEUE_LAST) },
+		{ STR(LANG_QUEUE_SHUFFLED) },
+    };
+
+    return set_option( str(LANG_CLICK_INSERT),
+                       &global_settings.click_insert, INT, names, 9,
+                       NULL );
+}
+
 static bool warnon_option(void)
 {
     return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU),
@@ -68,6 +87,7 @@ bool playlist_menu(void)
         { ID2P(LANG_CATALOG),                    catalog_view_playlists },
         { ID2P(LANG_RECURSE_DIRECTORY),          recurse_directory      },
         { ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU), warnon_option          },
+        { ID2P(LANG_CLICK_INSERT),               click_insert           },
     };
 
     m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
Index: apps/settings.c
===================================================================
--- apps/settings.c.orig
+++ apps/settings.c
@@ -695,6 +695,7 @@ static const struct bit_entry hd_bits[] 
  #endif
 
  	{1, S_O(backlight_timeout_plugin), false, "backlight timeout plugin", off_on },
+	{4, S_O(click_insert), 0, "click insert setting", "original,insert,insert next,insert last,insert shuffled,queue,queue next,queue last,queue shuffled"}, /* 0..9 */ 
 
     /* If values are just added to the end, no need to bump the version. */
     /* new stuff to be added at the end */
Index: apps/settings.h
===================================================================
--- apps/settings.h.orig
+++ apps/settings.h
@@ -433,6 +433,9 @@ struct user_settings
 #ifdef HAVE_REMOTE_LCD
     unsigned char rwps_file[MAX_FILENAME+1];  /* last remote-wps */
 #endif
+    int click_insert;       /*setting for click behaviour in file tree: 
+                              0:insert, 1:insert last,2:queue,
+                              3:queue last,4:insert shuffled*/
 #ifdef HAVE_BACKLIGHT_BRIGHTNESS 
     int brightness;         /* iriver h300: backlight PWM value: 2..15
                                 (0 and 1 are black) */
Index: apps/tree.c
===================================================================
--- apps/tree.c.orig
+++ apps/tree.c
@@ -707,6 +707,61 @@ static bool dirbrowse(void)
                 restore = true;
                 break;
 
+            case ACTION_TREE_INSERT: /* button insert modification */
+                /* nothing to do if no files to display */
+                if ( numentries == 0 )
+                    break;
+
+                int onplay_result;
+				int attr = 0;
+#ifdef HAVE_TAGCACHE
+                if (id3db){
+			        if (tagtree_get_attr(&tc) == TREE_ATTR_MPA)
+					{
+						attr = TREE_ATTR_MPA;
+						tagtree_get_filename(&tc, buf, sizeof(buf));
+					}
+					else
+						attr = ATTR_DIRECTORY;
+                }
+                else  
+#endif		
+				{
+					attr = dircache[tc.selected_item].attr;
+					
+                    if (currdir[1])
+                        snprintf(buf, sizeof buf, "%s/%s",
+                        currdir, dircache[tc.selected_item].name);
+                    else
+                        snprintf(buf, sizeof buf, "/%s",
+                                 dircache[tc.selected_item].name);
+                }
+				if(global_settings.click_insert==0)
+#ifdef HAVE_TAGCACHE
+					onplay_result=id3db?tagtree_enter(&tc):ft_enter(&tc);
+#else
+					onplay_result=ft_enter(&tc);
+#endif
+				else 
+					onplay_result=onplay_one_click(buf, attr, curr_context);
+ 
+
+				switch (onplay_result)
+				{
+					 case ONPLAY_OK:
+						 restore = true;
+						 break;
+	
+					 case ONPLAY_RELOAD_DIR:
+						 reload_dir = true;
+						 break;
+	
+					 case ONPLAY_START_PLAY:
+						 start_wps = true;
+						 break;
+				}
+                break;
+
             case ACTION_STD_CANCEL:
                 if (*tc.dirfilter > NUM_FILTER_MODES && tc.dirlevel < 1) {
                     exit_func = true;
Index: apps/keymaps/keymap-h1x0_h3x0.c
===================================================================
--- apps/keymaps/keymap-h1x0_h3x0.c.orig
+++ apps/keymaps/keymap-h1x0_h3x0.c
@@ -109,6 +109,7 @@ const struct button_mapping button_conte
     { ACTION_TREE_STOP,   BUTTON_OFF,                   BUTTON_NONE },
     { ACTION_TREE_STOP,   BUTTON_OFF|BUTTON_REL,        BUTTON_OFF },
     { ACTION_TREE_STOP,   BUTTON_OFF|BUTTON_REPEAT,     BUTTON_NONE },
+    { ACTION_TREE_INSERT, BUTTON_SELECT|BUTTON_REL,     BUTTON_SELECT },
 
     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
 }; /* button_context_tree */
@@ -372,7 +373,8 @@ const struct button_mapping *button_cont
 
 
 const struct button_mapping button_context_tree_h100remote[]  = {
-    { ACTION_TREE_WPS,    BUTTON_RC_ON,                     BUTTON_NONE },   
+    { ACTION_TREE_WPS,    BUTTON_RC_ON,                     BUTTON_NONE }, 
+    { ACTION_TREE_INSERT, BUTTON_RC_REC,                    BUTTON_NONE },
 
     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST|CONTEXT_REMOTE)
 }; /* button_context_tree_h100remote */
@@ -380,6 +382,7 @@ const struct button_mapping button_conte
 const struct button_mapping button_context_tree_h300lcdremote[] = {
     { ACTION_TREE_STOP,     BUTTON_RC_STOP,                 BUTTON_NONE },
     { ACTION_TREE_WPS,      BUTTON_RC_ON,                   BUTTON_NONE },
+    { ACTION_TREE_INSERT,   BUTTON_RC_MENU|BUTTON_REL,    BUTTON_RC_MENU },
     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST|CONTEXT_REMOTE)
 };  /* button_context_tree_h300lcdremote */
                
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang.orig
+++ apps/lang/english.lang
@@ -324,6 +324,34 @@
   </voice>
 </phrase>
 <phrase>
+  id: LANG_CLICK_DEFAULT
+  desc: in click insert menu
+  user:
+  <source>
+    *: "Original Behaviour"
+  </source>
+  <dest>
+    *: "Original Behaviour"
+  </dest>
+  <voice>
+    *: ""
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_CLICK_INSERT
+  desc: in playlist menu
+  user:
+  <source>
+    *: "Click Insert Options"
+  </source>
+  <dest>
+    *: "Click Insert Options"
+  </dest>
+  <voice>
+    *: ""
+  </voice>
+</phrase>
+<phrase>
   id: LANG_PLUGINS
   desc: in the main menu
   user:
Index: apps/keymaps/keymap-x5.c
===================================================================
--- apps/keymaps/keymap-x5.c.orig
+++ apps/keymaps/keymap-x5.c
@@ -256,6 +256,7 @@ const struct button_mapping button_conte
     { ACTION_NONE,        BUTTON_PLAY,                BUTTON_NONE },
     { ACTION_TREE_WPS,    BUTTON_PLAY|BUTTON_REL,     BUTTON_PLAY },
     { ACTION_TREE_STOP,   BUTTON_PLAY|BUTTON_REPEAT,  BUTTON_PLAY },
+    { ACTION_TREE_INSERT, BUTTON_SELECT|BUTTON_REL,     BUTTON_SELECT },
 
     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
 }; /* button_context_tree */
