default partial alphanumeric_keys
xkb_symbols "common" {
    include "nokia_vndr/rx-51-h(common_keys)"
    include "nokia_vndr/rx-51-h(modifiers)"

    // This section should not be included by any other section.
    // It's referenced only once by rule file to allow multiple layout configurations.

    // More than one layout at the same time could be set for instance as follows:
    // setxkbmap -rules evdev \
    //           -model nokiarx51 \
    //           -option grp:ctrl_shift_toggle \
    //           -layout us,cz \
    //           -variant ",qwerty"

    // Notice the similarity:
    //   "pc+us+cz(qwerty):2+grp:XYZ" vs.
    //   "nokia_vndr/rx-51(common)+nokia_vndr/rx-51(us)+nokia_vndr/rx-51(cz_qwerty):2+grp:XYZ"
    // where XYZ is one of xkb_symbols section usually located in file symbols/group.

    // Bear in mind that option XYZ could replace current keys configuration!!!

    // For instance using symbols/group(ctrl_shift_toggle) redefines LCTL and LFSH keys
    // which may disallow opening of virtual symbol table (Multi_key).
    // Fortunately the Multi_key is defined in 3rd and 4th level a ctrl_shift_toggle
    // redefines first two levels only. But RX-51 has not right Ctrl nor Shift therefore
    // pressing Ctrl+Shift will switch to previous layout, not to the next one.

    // For RX-51 device there is a lot of restrictions if more than one layout is
    // is configured at the same time because some modifiers and special cases are
    // handled by hildon layer (especially with eight-level layout):
    //  - settings may be done from terminal only (GUI doesn't and won't support it)
    //  - virtual symbol table is not updated according to current layout
    //  - for unknown reasons the eight-level layout (nordic,ru) works properly
    //    only if it's configured as first layout (e.g. "ru,us,cz" not "us,cz,ru")
    //    otherwise it's not possible to access levels 5-8
    //  - Ctrl+Space related problems:
    //     - If eight-level layout is used as first layout one of eight-level layouts has to
    //       be also chosen in GUI - otherwise the Ctrl+Space "switch" is disabled
    //     - Ctrl+Space has no effect if only four-level layouts are chosen
    //       (don't forget the layout configured in GUI - despite of it's not reachable)
    //     - a few keys in 2nd layer could be mixed with other layouts when Ctrl+Space is "turned on" (why?)
    //       in case eight- and four-level layouts are configured simultaneously
    //     - Ctrl+Space is "turned on" by default and has to be "turned off" for four-level layouts
    //       in case eight- and four-level layouts are configured simultaneously
    //     - four-level layout on first place doesn't work at all when Ctrl+Space is "turned on"
    //       in case the 2nd, 3rd or 4th layout is eight-level layout
};

////////////////////////////////////////////////////////////////////////////////

partial alphanumeric_keys
xkb_symbols "us" {
    include "nokia_vndr/rx-51-h(english_base)"
    include "nokia_vndr/rx-51-h(arrows_4btns)"

    name[Group1] = "U.S. English";
};



partial hidden alphanumeric_keys
xkb_symbols "he" {

    key.type[Group1] = "FOUR_LEVEL";
    // 1. row
    key <AD01>	{ [ hebrew_taw, F1, 1 ] };
    key <AD02>	{ [ hebrew_finalzade, F2, 2 ] };
    key <AD03>	{ [ hebrew_qoph, F3, 3 ] };
    key <AD04>	{ [ hebrew_resh, F4, 4 ] };
    key <AD05>	{ [ hebrew_aleph, F5, 5 ] };
    key <AD06>	{ [ hebrew_tet, F6, 6 ] };
    key <AD07>	{ [ hebrew_waw, F7, 7 ] };
    key <AD08>	{ [ hebrew_finalnun, F8, 8 ] };
    key <AD09>	{ [ hebrew_finalmem, F9, 9 ] };
    key <AD10>	{ [ hebrew_pe, F10, 0 ] };
    key <AB08>	{ [ period, F11, F12 ] };

    // 2. row
    key <AC01>	{ [ hebrew_shin, grave, asterisk	] };
    key <AC02>	{ [ hebrew_dalet, percent, plus		] };
    key <AC03>	{ [ hebrew_gimel, asciicircum, numbersign 	] };
    key <AC04>	{ [ hebrew_kaph, less, minus		] };
    key <AC05>	{ [ hebrew_ayin, greater, underscore	] };
    key <AC06>	{ [ hebrew_yod, bracketleft, parenleft	] };
    key <AC07>	{ [ hebrew_chet, bracketright, parenright	] };
    key <AC08>	{ [ hebrew_lamed, braceleft, ampersand	] };
    key <AC09>	{ [ hebrew_finalkaph, braceright, exclam	] };
    key <AB09>	{ [ hebrew_finalpe, colon, question	] };

    // 3. row
    key <AB01>	{ [ hebrew_zain, z, asciitilde	] };
    key <AB02>	{ [ hebrew_samech, semicolon, dollar		] };
    key <AB03>	{ [ hebrew_bet, comma, bar		] };
    key <AB04>	{ [ hebrew_he, braceleft, slash		] };
    key <AB05>	{ [ hebrew_nun, braceright, backslash	] };
    key <AB06>	{ [ hebrew_mem, bracketleft, quotedbl	] };
    key <AB07>	{ [ hebrew_zade, bracketright, apostrophe	] };
    key <SPCE>	{ [ space, space, at, at	] };
};

xkb_symbols "il" {
    include "nokia_vndr/rx-51-h(he)"
};

partial hidden alphanumeric_keys
xkb_symbols "english_base" {

//    key.type[Group1] = "EIGHT_LEVEL_SEMIALPHABETIC";
    key.type[Group1] = "FOUR_LEVEL";
    // 1. row
    key <AD01>	{ [	q,		Q,		1,		1] };
    key <AD02>	{ [	w,		W,		2,		2] };
    key <AD03>	{ [	e,		E,		3,		3] };
    key <AD04>	{ [	r,		R,		4,		4] };
    key <AD05>	{ [	t,		T,		5,		5] };
    key <AD06>	{ [	y,		Y,		6,		6] };
    key <AD07>	{ [	u,		U,		7,		7] };
    key <AD08>	{ [	i,		I,		8,		8] };
    key <AD09>	{ [	o,		O,		9,		9] };
    key <AD10>	{ [	p,		P,		0,		0] };
    key <AB08>	{ [	comma,		semicolon,	equal,		equal] };

    // 2. row
    key <AC01>	{ [	a,		A,		asterisk,	grave] };
    key <AC02>	{ [	s,		S,		plus,		percent] };
    key <AC03>	{ [	d,		D,		numbersign,	asciicircum] };
    key <AC04>	{ [	f,		F,		minus,		less] };
    key <AC05>	{ [	g,		G,		underscore,	greater] };
    key <AC06>	{ [	h,		H,		parenleft,	parenleft] };
    key <AC07>	{ [	j,		J,		parenright,	parenright] };
    key <AC08>	{ [	k,		K,		ampersand,	ampersand] };
    key <AC09>	{ [	l,		L,		exclam,		exclam] };
    key <AB09>	{ [	period,		colon,		question,	question] };

    // 3. row
    key <AB01>	{ [	z,		Z,		asciitilde, 	asciitilde] };
    key <AB02>	{ [	x,		X,		dollar,		dollar] };
    key <AB03>	{ [	c,		C,		bar,		bar] };
    key <AB04>	{ [	v,		V,		slash,		slash] };
    key <AB05>	{ [	b,		B,		backslash,	backslash] };
    key <AB06>	{ [	n,		N,		quotedbl,	quotedbl] };
    key <AB07>	{ [	m,		M,		apostrophe,	apostrophe] };
    key <SPCE>	{ [	space,		space,		at,		at	] };
};

partial hidden alphanumeric_keys
xkb_symbols "common_keys" {
    // all other common keys

    key <BKSP>	{ 
                  type[Group1] = "FOUR_LEVEL", 
		  Symbols[Group1] = [	BackSpace,	ISO_Next_Group, Tab, Tab	]
    };
    key <TAB>	{ [	Tab		] };
    // broken UI spec.
    key <RTRN>	{ [	KP_Enter,	KP_Enter,	Escape,		Escape	] };

    key <KPEN>	{ [	Return		] };
    key <ESC>	{ [	Escape		] };

    key <FK01>	{ [	F1	] };
    key <FK02>	{ [	F2	] };
    key <FK03>	{ [	F3	] };
    key <FK04>	{ [	F4	] };
    key <FK05>	{ [	F5	] };
    key <FK06>	{ [	F6	] };

    // Swap +/- keys intentionally. The VOL+/VOL- keys are located physically
    // on left/right and up/down in landscape/portrait orientation. This does
    // not feel natural for the user and therefore we want the VOL+/VOL- keys
    // map to -/+.
    //
    // The only exception is an active call in portrait mode where we want to
    // use the real meanings of the keys. This special case and management of
    // +/- keys in general is handled in maemo-statusmenu-volume.
    key <FK07>	{ [	F8,	F8,	Multi_key, Multi_key	] };
    key <FK08>	{ [	F7, 	F7,	Multi_key, Multi_key	] };

    key <FK09>	{ [	F9	] };
    key <FK10>	{ [	F10	] };
    key <FK11>	{ [	F11	] };
};

partial hidden alphanumeric_keys modifier_keys
xkb_symbols "modifiers" {
    // Shift switches between current level and level+1
    key <LFSH>	{
	type[Group1] = "ONE_LEVEL",
	symbols[Group1] = [	Shift_L ]
    };
    modifier_map Shift { Shift_L };

    // Fn+Ctrl virtual symbol table (Multi_key)
    // Ctrl+Space switches between 1st and 5th level (hardcoded in hildon)
    key <LCTL>	{
	type[Group1] = "FOUR_LEVEL",
	symbols[Group1] = [	Control_L,	Control_L,	Control_L,	Control_L	]
//	symbols[Group1] = [	Control_L,	Control_L,	Multi_key,	Multi_key	]
    };
    modifier_map Control { Control_L };

    // Fn key (right alt) switches to 3rd level
//    include "level3(ralt_switch)"
key <RALT> {
    type[Group1]="TWO_LEVEL",
    symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift ]
    };
  modifier_map Mod5   { ISO_Level3_Shift };

};

partial hidden alphanumeric_keys
xkb_symbols "arrows_4btns" {
    // standard arrows mapping
    // normal 2nd level must not be enumerated to allow text selection with Shift key
    key <UP>	{ [	Up,		Up,		Prior,		Prior	] };
    key <LEFT>	{ [	Left,		Left,		Home,		Home	] };
    key <DOWN>	{ [	Down,		Down,		Next,		Next	] };
    key <RGHT>	{ [	Right,		Right,		End,		End	] };
};
