I've tried to look at how menu is populated in browser app and found something useful.
Here is patch for enabling orientation menu item in browser (tested on 5.1.2):
Code:
--- /var/local/waf/browser/js/menuItems.js.orig
+++ /var/local/waf/browser/js/menuItems.js
@@ -89,7 +89,13 @@
// add dynamic items - TODO: Add lock rotation if ever re-implemented
items.splice(0, 0, createWireless());
items.splice(2, 0, createArticle());
+ items.splice(2, 0, createRotation());
+ var orientationItem = createOrientation();
+ if (orientationItem) {
+ items.splice(2, 0, orientationItem);
+ }
+
return items;
};
@@ -124,6 +130,32 @@
bapp.dialog.hide();
}
};
+ };
+
+ var createOrientation = function () {
+ if (settings && settings.orientation && settings.orientation == 'auto') {
+ return null;
+ }
+
+ var label,
+ state = bapp.getOrient();
+
+ if (state == 'portrait') {
+ label = 'Landscape Mode';
+ state = 'landscape';
+ }
+ else if (state == 'landscape') {
+ label = 'Portrait Mode';
+ state = 'portrait';
+ }
+
+ return {
+ label: label,
+ action: function () {
+ bapp.setOrientation(state);
+ bapp.dialog.hide();
+ }
+ };
};
/**
After patching there will be one or two new items in browser menu:
- Lock Rotation / Unlock Rotation
- Portrait Mode / Landscape Mode (it will appear only when rotation is locked by previous menu item!)
Adding of Lock/Unlock Rotation menu item wasn't required in strict sense, but I just wanted to keep original logic.
bapp.setOrientation function (which in fact calls
kindle.dev.setOrientation) supports following argument values:
- auto
- portrait
- portraitUp
- portraitDown
- landscape
- landscapeLeft
- landscapeRight
So, browser can be oriented in any way (if someone will write a little bit of additional code).
I'm not providing detailed instruction on how to make needed changes, because it's a bit "dangerous". It will not crash or brick KT, but could stop future firmware updates to proceed. But, I believe, other forum users willl provide user-friendly instructions. Anyway, make backups of changed files before applying of changes!
(Also these new menu items aren't localized. It could be easily done, though: add new strings at
/var/local/waf/browser/locales/<locale>/js/strings.js and then use
bapp.strings.<your string> in place of menu label value.)
UPD: oh, credits for discovering
kindle.dev.setOrientation and all of it's argument values should go to
silver18.
UPD2: on boot (i.e. after reboot) all changes made in files of
/var/local/waf and it's sub-direcories will be lost, because upstart job
/etc/init/appmgrd.conf will uncoditionally copy there files from
/opt/var/local/waf. So, it means that (as simple, but not only solution) changes must be applied to file in
/opt/var/local/waf too.