author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 19 Aug 2010 17:48:04 -0700 | |
changeset 470 | d4809db37847 |
parent 444 | org.symbian.tools.wrttools.previewer/preview/script/helper.js@6eb42310f8b5 |
child 485 | df4f55e8569e |
permissions | -rw-r--r-- |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
function EmulatorHelper() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
this.path = document.location.pathname; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
this.errorDailog = null; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
this.prefDailog = null; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
this.inspectorDailog = null; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
this.intervalId = null; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
this.infoPlistCounter = false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
this.IconFileCounter = false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
EmulatorHelper.prototype.loadScript = function(path) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
var head = document.getElementsByTagName("head")[0] |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
|| document.documentElement; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
var script = document.createElement("script"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
script.type = "text/javascript"; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
script.src = src; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
head.appendChild(script); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
19 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
20 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
21 |
EmulatorHelper.prototype.loadPreferences = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
22 |
if (/dreamweaver/i.test(navigator.userAgent)) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
23 |
$("#dwDeviceHelp")[0].className = ''; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
// $("#resSupportLink")[0].className = 'hide'; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
25 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
26 |
// Selecting Resoltion |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
27 |
var resOptions = $("#resOptions")[0]; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
28 |
for ( var i = 0; i < NOKIA.resolution.length; i++) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
if (NOKIA.resolution[i] == NOKIA.currentDevice) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
resOptions.options[i].selected = true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
31 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
32 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
34 |
|
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
35 |
NOKIA.version = "1.1"; |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
37 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
38 |
EmulatorHelper.prototype.getInfo = function(url, callback) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
var xhr = this.ajax(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
42 |
if ((/AppleWebKit/i.test(navigator.userAgent))) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
43 |
xhr.open("GET", url, false); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
44 |
else |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
45 |
xhr.open("GET", url, true); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
46 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
47 |
xhr.onreadystatechange = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
48 |
// readyState = 4 ; "complete" |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
49 |
if (xhr.readyState == 4) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
// status = 200 ; "ok" |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
51 |
if ((xhr.status == 200) || (!xhr.status)) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
52 |
callback(true, xhr); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
53 |
} else { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
54 |
callback(false, xhr); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
55 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
56 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
57 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
58 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
xhr.send(null); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
60 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
61 |
if (e.name == 'NS_ERROR_FILE_NOT_FOUND') { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
62 |
callback(false, xhr); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
63 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
64 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
65 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
66 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
67 |
EmulatorHelper.prototype.getInfoCallback = function(flag, xhr) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
68 |
// If Info.plis NOT FOUND / FAILED LOAD |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
69 |
// an ERROR!, unable to proceed further |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
70 |
// STOP there |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
71 |
if (!flag) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
72 |
if (!NOKIA.helper.infoPlistCounter) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
73 |
NOKIA.helper.infoPlistCounter = true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
74 |
NOKIA.helper.getInfo('info.plist', NOKIA.helper.getInfoCallback); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
75 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
76 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
77 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
78 |
NOKIA.helper |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
79 |
.error('WRT Previewer: Initialization failed. Could not open Info.plist file.<br/>Please ensure <strong style="color:#efe352;">Info.plist</strong> file exists in the project root folder and that it is named properly.'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
80 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
81 |
} else { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
82 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
83 |
var xmlString = xhr.responseText; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
84 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
85 |
// do some cheating here |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
86 |
xmlString = xmlString.replace(/<!--(.|[\n\r])*?-->/gm, ""); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
87 |
xmlString = xmlString.replace(/<\s*true\s*\/>/gi, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
88 |
"<string>true</string>"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
89 |
xmlString = xmlString.replace(/<\s*false\s*\/>/gi, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
90 |
"<string>false</string>"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
91 |
xmlString = xmlString.replace(/[\n\r]/gi, ""); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
92 |
// return the JSON Object |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
93 |
NOKIA.helper.validate(xmlString); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
94 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
95 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
96 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
97 |
EmulatorHelper.prototype.getIconCallback = function(flag, xhr) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
98 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
99 |
if (!flag) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
100 |
if (!NOKIA.helper.IconFileCounter) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
101 |
NOKIA.helper.IconFileCounter = true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
102 |
NOKIA.helper.getInfo('icon.png', NOKIA.helper.getIconCallback); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
103 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
104 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
105 |
} else |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
106 |
NOKIA.emulator.iconFile = (NOKIA.helper.IconFileCounter) ? "icon.png" |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
107 |
: "Icon.png"; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
108 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
109 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
110 |
EmulatorHelper.prototype.validate = function(xmlObject) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
111 |
var values = xmlObject |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
112 |
.match(/.*<plist.*?(<dict.*?>\s*(<key[^>]*?>[^<]*?<\/key>\s*<string[^>]*?>[^<]*?<\/string>)*\s*<\/dict>)\s*<\/plist>/)[1]; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
113 |
if (values == null || values == undefined) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
114 |
NOKIA.helper.error('Corrupted Info.plist file'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
115 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
116 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
117 |
values = values.replace(/<dict.*?(<key.*?>\s*.*\s*<\/string>)\s*<\/dict>/, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
118 |
"{ $1 }"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
119 |
values = values |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
120 |
.replace( |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
121 |
/\s*<key.*?>\s*(.*?)\s*<\/key>\s*<string.*?>\s*(.*?)\s*<\/string>\s*/g, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
122 |
"\"$1\" : \"$2\", "); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
123 |
values = values.replace(/"\s*?,\s*?}/g, "\" }"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
124 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
125 |
NOKIA.emulator.plist = JSON.parse(values); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
126 |
} catch (exception) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
127 |
NOKIA.helper.error('Corrupted Info.plist file'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
128 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
129 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
130 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
131 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
132 |
if (typeof NOKIA.emulator.plist.DisplayName != 'undefined') { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
133 |
document.title = NOKIA.emulator.plist.DisplayName + ' - ' |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
134 |
+ document.title; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
135 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
136 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
137 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
138 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
139 |
// Add UI-Event listeners |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
140 |
NOKIA.helper.addListeners(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
141 |
NOKIA.layout.init(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
142 |
NOKIA.emulator.render(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
143 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
144 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
145 |
EmulatorHelper.prototype.ajax = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
146 |
// xmlHttpRequest object |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
147 |
var request = null; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
148 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
149 |
// branch for native XMLHttpRequest object |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
150 |
if (window.XMLHttpRequest && !(window.ActiveXObject)) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
151 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
152 |
request = new XMLHttpRequest(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
153 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
154 |
// attach the Bypass code, if the browser is firefox |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
155 |
if (netscape.security.PrivilegeManager.enablePrivilege) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
156 |
// duplicate the function |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
157 |
request._open = request.open; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
158 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
159 |
// redefine the function definition |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
160 |
request.open = function(method, url, flag) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
161 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
162 |
// Enable Universal Browser Read |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
163 |
netscape.security.PrivilegeManager |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
164 |
.enablePrivilege("UniversalBrowserRead"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
165 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
166 |
// call the native XmlHttpRequest.open method |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
167 |
this._open(method, url, flag); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
168 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
169 |
// call the native XmlHttpRequest.open method |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
170 |
this._open(method, url, flag); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
171 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
172 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
173 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
174 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
175 |
// eatup all exceptions |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
176 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
177 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
178 |
request = null; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
179 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
180 |
// branch for IE/Windows ActiveX version |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
181 |
} else if (window.ActiveXObject) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
182 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
183 |
request = new ActiveXObject("Msxml2.XMLHTTP"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
184 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
185 |
try { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
186 |
request = new ActiveXObject("Microsoft.XMLHTTP"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
187 |
} catch (e) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
188 |
alert('Failed to create XmlHttprequest'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
189 |
return null; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
190 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
191 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
192 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
193 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
194 |
return (request); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
195 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
196 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
197 |
EmulatorHelper.prototype.error = function(msg) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
198 |
if (NOKIA.menu.enable_log) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
199 |
NOKIA.layout.log("log", msg); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
200 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
201 |
$("#Dialog").html(msg); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
202 |
$("#Dialog").dialog('open'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
203 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
204 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
205 |
EmulatorHelper.prototype.setPreference = function(name, value) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
206 |
if (NOKIA.emulator.prefs[name] != value) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
207 |
NOKIA.emulator.prefs[name] = value; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
208 |
$.post("preview/preferences.js", JSON.stringify( { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
209 |
"key" : name, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
210 |
"value" : value |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
211 |
}), undefined, "json"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
212 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
213 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
214 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
215 |
EmulatorHelper.prototype.getPreference = function(name) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
216 |
return NOKIA.emulator.prefs[name]; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
217 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
218 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
219 |
EmulatorHelper.prototype.addListeners = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
220 |
NOKIA.helper.loadPreferences(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
221 |
/* |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
222 |
* Render Emulator for Interaction |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
223 |
*/ |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
224 |
NOKIA.helper.inspectorDailog = $("#InspectorTab").dialog( { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
225 |
width : 370, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
226 |
minWidth : 300, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
227 |
minHeight : 200, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
228 |
height : 250, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
229 |
autoOpen : false, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
230 |
position : top, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
231 |
title : ' ', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
232 |
buttons : { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
233 |
"Close" : function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
234 |
$("#InspectorTab").dialog('close'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
235 |
}, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
236 |
"Disconnect Debugger" : function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
237 |
$.ajax( { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
238 |
url : "__sym_command/terminateDebug" |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
239 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
240 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
241 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
242 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
243 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
244 |
$('#InspectorBtn').click(function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
245 |
$('#InspectorTab').dialog('open'); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
246 |
// Hack for Mac firefox |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
247 |
if (/Mac/i.test(navigator.userAgent)) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
248 |
$("#WidgetArea iframe").css( { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
249 |
overflow : 'hidden' |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
250 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
251 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
252 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
253 |
$('#resOptions').change( |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
254 |
function(ele) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
255 |
ele = ele.target || this; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
256 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
257 |
NOKIA.currentDevice = ele.options[ele.selectedIndex].text; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
258 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
259 |
// SAVE the device DATA |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
260 |
NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
261 |
NOKIA.currentDevice); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
262 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
263 |
NOKIA.emulator.render(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
264 |
NOKIA.helper.loadPreferences(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
265 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
266 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
267 |
$("#iframeMask").click(function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
268 |
$("#orientationIcon").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
269 |
$("#iframeMask").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
270 |
$("#loaderDiv").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
271 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
272 |
NOKIA.menu.is_dimmed = false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
273 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
274 |
$("#WidgetArea")[0].className = ''; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
275 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
276 |
NOKIA.menu.softkeys_visibility = true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
277 |
NOKIA.menu.showSoftKeys(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
278 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
279 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
280 |
// MenuItems DIV events |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
281 |
$("#MenuItemsArea").mouseover(function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
282 |
if (NOKIA.helper.intervalId) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
283 |
clearInterval(NOKIA.helper.intervalId); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
284 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
285 |
$("#MenuItemsArea").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
286 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
287 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
288 |
$("#MenuItemsArea").mouseout(function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
289 |
if (NOKIA.helper.intervalId) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
290 |
clearInterval(NOKIA.helper.intervalId); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
291 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
292 |
NOKIA.helper.intervalId = setTimeout(function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
293 |
NOKIA.menu.cancel(); |
404
5aff54f94943
increase Options timeout from half second to 10 seconds - bug 2778
Paul Beusterien <paulb@symbian.org>
parents:
403
diff
changeset
|
294 |
}, 10000); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
295 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
296 |
|
417
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
297 |
NOKIA.layout.currentTab = NOKIA.helper |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
298 |
.getPreference(EmulatorPreferences.SELECTED_TAB); |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
299 |
if (NOKIA.layout.currentTab == undefined) { |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
300 |
NOKIA.layout.currentTab = 0; |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
301 |
} |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
302 |
// Tabs |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
303 |
$('#tabs').tabs( |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
304 |
{ |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
305 |
select : function(event, ui) { |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
306 |
var selectedTab = ui.index; |
417
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
307 |
NOKIA.helper.setPreference( |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
308 |
EmulatorPreferences.SELECTED_TAB, selectedTab); |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
309 |
NOKIA.layout.currentTab = selectedTab; |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
310 |
if (selectedTab == 0) { |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
311 |
$('#Console-Notification').hide(); |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
312 |
} |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
313 |
}, |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
314 |
selected : NOKIA.layout.currentTab |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
315 |
}); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
316 |
$(".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *").removeClass( |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
317 |
"ui-corner-all ui-corner-top").addClass("ui-corner-bottom"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
318 |
|
417
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
319 |
$('#Console-Notification').click(function() { |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
320 |
$('#tabs').tabs( { |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
321 |
selected : 0 |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
322 |
}); |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
323 |
$(this).hide(); |
422
15592887bf5e
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
417
diff
changeset
|
324 |
window |
15592887bf5e
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
417
diff
changeset
|
325 |
.setTimeout( |
15592887bf5e
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
417
diff
changeset
|
326 |
function() { |
15592887bf5e
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
417
diff
changeset
|
327 |
$('#preview-ui-bottom-body')[0].scrollTop = $('#preview-ui-bottom-body')[0].scrollHeight; |
15592887bf5e
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
417
diff
changeset
|
328 |
}, 300); |
417
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
329 |
return NOKIA.layout._console_minimized; |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
330 |
}); |
412
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
331 |
$("#clockwise").button( { |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
332 |
icons : { |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
333 |
primary : "button-clockwise" |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
334 |
}, |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
335 |
text : null |
417
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
336 |
}).click(function() { |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
337 |
NOKIA.emulator.turn(1); |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
338 |
}); |
412
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
339 |
$("#cclockwise").button( { |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
340 |
icons : { |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
341 |
primary : "button-cclockwise" |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
342 |
}, |
72448215f517
Bug 2785 - Orientation and Resolution Controls Placements
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
411
diff
changeset
|
343 |
text : null |
417
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
344 |
}).click(function() { |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
345 |
NOKIA.emulator.turn(-1); |
dc5d845451fc
Bug 3063 - Provide a feedback when there is console output
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
412
diff
changeset
|
346 |
}); |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
347 |
$("#xleft").button( { |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
348 |
icons : { |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
349 |
primary : 'ui-icon-triangle-1-w' |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
350 |
}, |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
351 |
text : false |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
352 |
}); |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
353 |
$("#xright").button( { |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
354 |
icons : { |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
355 |
primary : 'ui-icon-triangle-1-e' |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
356 |
}, |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
357 |
text : false |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
358 |
}); |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
359 |
$("#yleft").button( { |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
360 |
icons : { |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
361 |
primary : 'ui-icon-triangle-1-w' |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
362 |
}, |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
363 |
text : false |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
364 |
}); |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
365 |
$("#yright").button( { |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
366 |
icons : { |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
367 |
primary : 'ui-icon-triangle-1-e' |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
368 |
}, |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
369 |
text : false |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
370 |
}); |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
371 |
$("#zleft").button( { |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
372 |
icons : { |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
373 |
primary : 'ui-icon-triangle-1-w' |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
374 |
}, |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
375 |
text : false |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
376 |
}); |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
377 |
$("#zright").button( { |
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
378 |
icons : { |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
379 |
primary : 'ui-icon-triangle-1-e' |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
380 |
}, |
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
381 |
text : false |
407
c7c8bde493b1
Orientation controls were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
404
diff
changeset
|
382 |
}); |
411
07412dc8e169
Bug 3090 - Store selected controls tabs between browser restarts
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
408
diff
changeset
|
383 |
|
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
384 |
/* |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
385 |
* Event triggering |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
386 |
*/ |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
387 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
388 |
// for battery |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
389 |
$("#event-battery").click(function(event) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
390 |
if (event.target.className == 'active') { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
391 |
$("#event-icons").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
392 |
$("#event-battery-info").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
393 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
394 |
/* |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
395 |
* $('#slider').slider('option', 'value', |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
396 |
* NOKIA.emulator.child._BRIDGE_REF.helper.getBatteryStrength()); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
397 |
* NOKIA.emulator.child._BRIDGE_REF.helper.getBatteryStrength() |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
398 |
* $('#slider').slider('option', 'value', 10); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
399 |
* $('#slider').slider(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
400 |
*/ |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
401 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
402 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
403 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
404 |
$("#event-battery-back").click(function(event) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
405 |
$("#event-icons").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
406 |
$("#event-battery-info").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
407 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
408 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
409 |
// for messaging |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
410 |
$("#event-messaging").click(function(event) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
411 |
if (event.target.className == 'active') { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
412 |
$("#event-icons").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
413 |
$("#event-messaging-info").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
414 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
415 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
416 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
417 |
$("#event-messaging-back").click(function(event) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
418 |
$("#event-icons").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
419 |
$("#event-messaging-info").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
420 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
421 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
422 |
// for memory |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
423 |
$("#event-memory").click(function(event) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
424 |
if (event.target.className == 'active') { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
425 |
$("#event-icons").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
426 |
$("#event-memory-info").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
427 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
428 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
429 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
430 |
$("#event-memory-back").click(function(event) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
431 |
$("#event-icons").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
432 |
$("#event-memory-info").hide(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
433 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
434 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
435 |
// Slider |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
436 |
$('#slider').slider( |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
437 |
{ |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
438 |
min : 0, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
439 |
max : 100, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
440 |
step : 1, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
441 |
value : 10, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
442 |
animate : true, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
443 |
slide : function(event, ui) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
444 |
$("#slider-value-panel > span").html( |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
445 |
ui.value.toString() + "%"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
446 |
}, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
447 |
change : function(event, ui) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
448 |
var chargeValue = ui.value; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
449 |
NOKIA.helper.trigger("power", "chargelevel", chargeValue); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
450 |
if (NOKIA.version == 'WRT 1.1') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
451 |
NOKIA.helper.triggerSapi("Service.SysInfo", |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
452 |
"Battery.BatteryStrength", { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
453 |
Status : chargeValue |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
454 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
455 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
456 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
457 |
$("#slider-value-panel > span").html("10%"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
458 |
|
444
6eb42310f8b5
Replace camera "screen" with more generic one.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
424
diff
changeset
|
459 |
$("#external-app-close").button().click(NOKIA.layout.closeApplication); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
460 |
// Bind Buttons to trigger values to WRT 1.0 / 1.1 bindings |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
461 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
462 |
$("#connect-charger").click(NOKIA.helper.triggerEvents); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
463 |
$("#disconnect-charger").click(NOKIA.helper.triggerEvents); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
464 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
465 |
$("#send-sms").click(NOKIA.helper.triggerEvents); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
466 |
$("#send-mms").click(NOKIA.helper.triggerEvents); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
467 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
468 |
$("#connect-memory-card").click(NOKIA.helper.triggerEvents); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
469 |
$("#disconnect-memory-card").click(NOKIA.helper.triggerEvents); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
470 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
471 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
472 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
473 |
EmulatorHelper.prototype.setHomeScreen = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
474 |
// HomeScreen Support |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
475 |
if (NOKIA.deviceList[NOKIA.currentDevice].homeScreenSupport) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
476 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
477 |
if (typeof NOKIA.emulator.plist.MiniViewEnabled != 'undefined') { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
478 |
if (NOKIA.emulator.plist.MiniViewEnabled != 'false') { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
479 |
$("#WidgetArea")[0].className = 'hs_' + NOKIA.mode; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
480 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
481 |
// menu handlining |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
482 |
NOKIA.menu.softkeys_visibility = false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
483 |
NOKIA.menu.cancel(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
484 |
NOKIA.menu.is_dimmed = true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
485 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
486 |
$("#loaderDiv").html("Click on widget for Return to Full view"); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
487 |
$("#loaderDiv")[0].className = 'green'; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
488 |
$("#loaderDiv").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
489 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
490 |
$("#iframeMask").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
491 |
$("#orientationIcon").show(); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
492 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
493 |
return true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
494 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
495 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
496 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
497 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
498 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
499 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
500 |
EmulatorHelper.prototype.getElementsLengthInObject = function(items) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
501 |
var count = 0; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
502 |
for ( var i in items) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
503 |
if (!items[i].isDimmed) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
504 |
count++; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
505 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
506 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
507 |
return count; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
508 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
509 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
510 |
EmulatorHelper.prototype.triggerEvents = function(event) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
511 |
if (typeof event.target.id == 'undefined') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
512 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
513 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
514 |
switch (event.target.id) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
515 |
// for battery |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
516 |
case 'connect-charger': |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
517 |
NOKIA.helper.trigger("power", "chargerconnected", 1); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
518 |
if (NOKIA.version == 'WRT 1.1') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
519 |
NOKIA.helper.triggerSapi("Service.SysInfo", |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
520 |
"Battery.ChargingStatus", { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
521 |
Status : 1 |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
522 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
523 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
524 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
525 |
case 'disconnect-charger': |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
526 |
NOKIA.helper.trigger("power", "chargerconnected", 0); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
527 |
if (NOKIA.version == 'WRT 1.1') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
528 |
NOKIA.helper.triggerSapi("Service.SysInfo", |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
529 |
"Battery.ChargingStatus", { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
530 |
Status : 0 |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
531 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
532 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
533 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
534 |
// for messaging |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
535 |
case 'send-sms': |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
536 |
if (NOKIA.version == 'WRT 1.1') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
537 |
NOKIA.helper.triggerSapi("Service.Messaging", "NewMessage", { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
538 |
MessageType : 'SMS' |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
539 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
540 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
541 |
case 'send-mms': |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
542 |
if (NOKIA.version == 'WRT 1.1') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
543 |
NOKIA.helper.triggerSapi("Service.Messaging", "NewMessage", { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
544 |
MessageType : 'MMS' |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
545 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
546 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
547 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
548 |
// for memory |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
549 |
case 'connect-memory-card': |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
550 |
if (NOKIA.version == 'WRT 1.1') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
551 |
NOKIA.helper.triggerSapi("Service.SysInfo", "Memory.MemoryCard", { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
552 |
Status : 1 |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
553 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
554 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
555 |
case 'disconnect-memory-card': |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
556 |
if (NOKIA.version == 'WRT 1.1') |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
557 |
NOKIA.helper.triggerSapi("Service.SysInfo", "Memory.MemoryCard", { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
558 |
Status : 0 |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
559 |
}); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
560 |
break; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
561 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
562 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
563 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
564 |
EmulatorHelper.prototype.triggerSapi = function(provider, eventType, data) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
565 |
NOKIA.emulator.child.device.implementation.triggerListener(provider, |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
566 |
eventType, data); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
567 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
568 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
569 |
EmulatorHelper.prototype.trigger = function(provider, eventType, data) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
570 |
NOKIA.emulator.child.widget.triggerListener(provider, eventType, data); |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
571 |
}; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
572 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
573 |
EmulatorHelper.prototype.checkDependencies = function() { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
574 |
|
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
575 |
for ( var key in NOKIA.scriptsLoaded) { |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
576 |
if (!NOKIA.scriptsLoaded[key]) |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
577 |
return false; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
578 |
} |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
579 |
|
424
ae2704ae87dc
Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
422
diff
changeset
|
580 |
NOKIA.menu.setInnerLsk(NOKIA.emulator.child.menu.show); |
ae2704ae87dc
Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
422
diff
changeset
|
581 |
NOKIA.menu.setInnerRsk(NOKIA.menu.exit); |
402
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
582 |
return true; |
f943a50b6689
Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
583 |
}; |