%
% anyremote configuration file for to make basic file operations with help of
% GUI of Android/J2ME client. (Server-mode)
%

% STATUS stable
% XTEST no
% SOUND no
% ENV no
% FBROWSER v.4i
% ALL_IN_ONE 
% MEDIACENTER files

GuiAppName=FileManager4
GuiAppBinary=true
GuiAppIcon=fileopen.png
GuiAppType=Custom
GuiAppProtocols=Server
GuiAppDesc=Simple file manager. Browsing directory structure with basic file operations.

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Include($(CfgDir)/Utils/aliases-server-fbrowser-v4i.cfg);\
	Set(parameter,debug,on);

(Connect)=\
    Make(var,fm_v4i_list_index,by_value,1);\
    Make(var,fm_v4i_layout_done,by_value,0);\
	Macro(FBROWSER_IC_INIT);\
    Make(mode,file_manager_v4i_init);
    
(Exit)=\
	Macro(FBROWSER_IC_EXIT);

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_general

%InCall($$)=\
%	Make(remote,off);

%EndCall($$)=\
%	Make(remote,on);

UPDATE_MENU=\
	Set(menu,replace,GoTo,File info,Copy,Move,Delete,Make Dir,View,Exec,Go Home);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

SET_INDEX=\
	Set(iconlist,select,$(fm_v4i_list_index));

[ModeEnd]

% -----------------------------------------------------------------------

[Mode]= file_manager_v4i_general_operation : file_manager_v4i_general

FMAN_IC_FILL_LIST2=\
	Set(iconlist,dir,SAME,$(fbrowser_dir2));

Go To($$)=\
	Make(var,tmpdir,by_value,$(Param));\
	Make(var,fbrowser_dir2,cd "$(fbrowser_dir2)";if [ -d "$(tmpdir)" ]; then cd "$(tmpdir)";fi;pwd);\
	Set(iconlist,replace,SAME,folder:..);\
	Macro(FMAN_IC_FILL_LIST2);

Back=\
	Make(mode,file_manager_v4i_init);

Back($$)=\
	Make(mode,file_manager_v4i_init);

[ModeEnd]

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_init : file_manager_v4i_general

(EnterMode)=\
    Set(popup,show,Please wait);\
    Macro(FM4I_SET_LAYOUT,echo $(fm_v4i_layout_done));\
	Macro(FBROWSER_IC_FILL_LIST);\
	Macro(UPDATE_MENU);

FM4I_SET_LAYOUT=\
	Set(layout,3x4);\
	Set(icons,File manager,\
		1,folder,2,fullscreen,3,default,\
		4,default,5,default,6,default,\
		7,default,8,default,9,default,\
		*,question,0,no,#,default);\
	Set(hints,\
		1,file browser,\
		*,help (press twice));\
	Set(title,Press 1 to enter file browser);\
	Set(status,);\
    Make(var,fm_v4i_layout_done,by_value,1);
	
STORE_INDEX=\
	Make(var,fm_v4i_list_index,by_value,$(Index));
	
Back($$)=\
	Set(list,close);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);
	
Back=\
	Set(text,close);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

GoTo($$)=\
	Macro(FBROWSER_IC_GO_TO);

Go Home($$)=\
	Macro(FBROWSER_IC_GO_HOME);

%Push($$) use from aliases-server-fbrowser-v4i.cfg

Cancel=Make(exit);

0=Make(exit);

1=Macro(FBROWSER_IC_FILL_LIST);\
	Macro(UPDATE_MENU);
	
2=Set(fullscreen,toggle);

* *=Set(text,replace,Help, Menu-driven basic\nfile operations.\n1 - enter file manager screen\n2 - toggle fullscreen);

% -----------------------------------------------------------------------

FM4I_DO_OPERATION=\
	Macro(STORE_INDEX);\
	Make(var,fm_v4i_file,by_value,$(Param));\
	Make(mode,file_manager_v4i_$(fm_v4i_operation));

Exec($$)=\
	Make(var,fm_v4i_operation,by_value,exec);\
	Macro(FM4I_DO_OPERATION);

Make Dir($$)=\
	Make(var,fm_v4i_operation,by_value,mkdir);\
	Macro(FM4I_DO_OPERATION);

File info($$)=\
	Make(var,fm_v4i_operation,by_value,info);\
	Macro(FM4I_DO_OPERATION);

View($$)=\
	Make(var,fm_v4i_operation,by_value,view);\
	Macro(FM4I_DO_OPERATION);
    
Copy($$)=\
	Make(var,fm_v4i_operation,by_value,copy);\
	Macro(FM4I_DO_OPERATION);

Move($$)=\
	Make(var,fm_v4i_operation,by_value,move);\
	Macro(FM4I_DO_OPERATION);

Delete($$)=\
	Macro(STORE_INDEX);\
	Make(var,dummy,cd "$(fbrowser_dir)";rm -rf "$(Param)";echo DONE;);\
	Macro(FBROWSER_IC_FILL_LIST);\
	Macro(SET_INDEX);

[ModeEnd]

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_exec : file_manager_v4i_general_operation

(EnterMode)=\
	Set(editfield,Enter parameters,Parameters,);

Ok($$)=\
	ExecAndSet(text,replace,Results,cd "$(fbrowser_dir)";"$(fbrowser_dir)"/$(fm_v4i_file) $(Param));
	
[ModeEnd]

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_mkdir : file_manager_v4i_general_operation

(EnterMode)=\
	Set(editfield,Enter name,New Directory,);

Ok($$)=\
	Make(var,dummy,cd "$(fbrowser_dir)";mkdir $(Param);echo DONE;);\
	Make(mode,file_manager_v4i_init);

[ModeEnd]

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_info : file_manager_v4i_general_operation

(EnterMode)=\
	ExecAndSet(text,replace,File info,file "$(fbrowser_dir)"/$(fm_v4i_file));\
	ExecAndSet(text,add,SAME,ls -l "$(fbrowser_dir)"/$(fm_v4i_file));

[ModeEnd]

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_view : file_manager_v4i_general_operation

(EnterMode)=\
	Set(text,file,File View,$(fbrowser_dir)/$(fm_v4i_file));
	
[ModeEnd]

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_copy : file_manager_v4i_general_operation

(EnterMode)=\
	Make(var,fbrowser_dir2,by_value,$(fbrowser_dir));\
	Set(iconlist,replace,Copy To,folder:..);\
	Macro(FMAN_IC_FILL_LIST2);\
	Set(menu,replace,Go To,Copy To);

Copy To($$)=\
	Make(var,dummy,cp "$(fbrowser_dir)"/$(fm_v4i_file) "$(fbrowser_dir2)"/$(Param);echo DONE;);\
	Make(mode,file_manager_v4i_init);

[ModeEnd]

% -----------------------------------------------------------------------

[Mode]=file_manager_v4i_move : file_manager_v4i_general_operation

(EnterMode)=\
	Make(var,fbrowser_dir2,by_value,$(fbrowser_dir));\
	Set(iconlist,replace,Move To,folder:..);\
	Macro(FMAN_IC_FILL_LIST2);\
	Set(menu,replace,Go To,Move To);

Move To($$)=\
	Make(var,dummy,mv "$(fbrowser_dir)"/$(fm_v4i_file) "$(fbrowser_dir2)"/$(Param);echo DONE;);\
	Make(mode,file_manager_v4i_init);

[ModeEnd]

[End]
