Bug 3192 - phonegap wizard: Contacts filter does not seem to work
authorEugene Ostroukhov <eugeneo@symbian.org>
Tue, 13 Jul 2010 14:25:10 -0700
changeset 442 980aaebb8022
parent 441 85f06000ab13
child 443 c5a1d477afa1
Bug 3192 - phonegap wizard: Contacts filter does not seem to work Bug 3184 - Reorganize new project wizard
org.symbian.tools.wrttools/libraries/phonegap.js
org.symbian.tools.wrttools/projecttemplates/phonegap.zip
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java
--- a/org.symbian.tools.wrttools/libraries/phonegap.js	Tue Jul 13 11:11:00 2010 -0700
+++ b/org.symbian.tools.wrttools/libraries/phonegap.js	Tue Jul 13 14:25:10 2010 -0700
@@ -1047,27 +1047,29 @@
 Contacts.prototype.success_callback = function(contacts_iterator) {
 	try {
 	var gapContacts = new Array();
-	contacts_iterator.reset();
-    var contact;
-	var i = 0;
-	var end = this.options.page * this.options.limit;
-	var start = end - this.options.limit;
-	while ((contact = contacts_iterator.getNext()) != undefined && i < end) {
-		try {
-			if (i >= start) {
-				var gapContact = new Contact();
-				gapContact.name.givenName = Contacts.GetValue(contact, "FirstName");
-				gapContact.name.familyName = Contacts.GetValue(contact, "LastName");
-				gapContact.name.formatted = gapContact.name.givenName + " " + gapContact.name.familyName;
-				gapContact.emails = Contacts.getEmailsList(contact);
-				gapContact.phones = Contacts.getPhonesList(contact);
-				gapContact.address = Contacts.getAddress(contact);
-				gapContact.id = Contacts.GetValue(contact, "id");
-				gapContacts.push(gapContact);
+	if (contacts_iterator) {
+		contacts_iterator.reset();
+		var contact;
+		var i = 0;
+		var end = this.options.page * this.options.limit;
+		var start = end - this.options.limit;
+		while ((contact = contacts_iterator.getNext()) != undefined && i < end) {
+			try {
+				if (i >= start) {
+					var gapContact = new Contact();
+					gapContact.name.givenName = Contacts.GetValue(contact, "FirstName");
+					gapContact.name.familyName = Contacts.GetValue(contact, "LastName");
+					gapContact.name.formatted = gapContact.name.givenName + " " + gapContact.name.familyName;
+					gapContact.emails = Contacts.getEmailsList(contact);
+					gapContact.phones = Contacts.getPhonesList(contact);
+					gapContact.address = Contacts.getAddress(contact);
+					gapContact.id = Contacts.GetValue(contact, "id");
+					gapContacts.push(gapContact);
+				}
+				i++;
+			} catch (e) {
+				alert("ContactsError (" + e.name + ": " + e.message + ")");
 			}
-			i++;
-		} catch (e) {
-			alert("ContactsError (" + e.name + ": " + e.message + ")");
 		}
 	}
 	this.contacts = gapContacts;
@@ -1144,6 +1146,7 @@
  * @param {Object|String} message Message or object to print to the console
  */
 DebugConsole.prototype.warn = function(message) {
+	console.log(message);
 };
 
 /**
@@ -1151,6 +1154,7 @@
  * @param {Object|String} message Message or object to print to the console
  */
 DebugConsole.prototype.error = function(message) {
+	console.log(message);
 };
 
 if (typeof window.debug == "undefined") window.debug = new DebugConsole();
@@ -1363,7 +1367,42 @@
 };
 
 if (typeof navigator.map == "undefined") navigator.map = new Map();
+function Network() {
+    /**
+     * The last known Network status.
+     */
+	this.lastReachability = null;
+};
 
+Network.prototype.isReachable = function(hostName, successCallback, options) {
+	var req = new XMLHttpRequest();  
+   	req.open('GET', hostName, true);  
+   	req.onreadystatechange = function (aEvt) {  
+     	if (req.readyState == 4) {  
+        	if(req.status == 200)  
+        		successCallback(NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK);
+         	else  
+          		successCallback(NetworkStatus.NOT_REACHABLE);
+ 		}  
+  	};  
+  	req.send(null);
+
+};
+
+/**
+ * This class contains information about any NetworkStatus.
+ * @constructor
+ */
+function NetworkStatus() {
+	this.code = null;
+	this.message = "";
+}
+
+NetworkStatus.NOT_REACHABLE = 0;
+NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK = 1;
+NetworkStatus.REACHABLE_VIA_WIFI_NETWORK = 2;
+
+if (typeof navigator.network == "undefined") navigator.network = new Network();
 /**
  * This class provides access to notifications on the device.
  */
Binary file org.symbian.tools.wrttools/projecttemplates/phonegap.zip has changed
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java	Tue Jul 13 11:11:00 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java	Tue Jul 13 14:25:10 2010 -0700
@@ -104,7 +104,7 @@
         context.createText(root, WizardContext.WIDGET_ID, "applicatoin identifier", bindingContext, null,
                 new RegexpValidator("[\\w]*(\\.\\w[\\w]*)*", "{0} is not a valid applicatoin ID", true));
         context.createLabel(root, "");
-        context.createLabel(root, "This id should be unique for succesful installation of application on the device");
+        context.createLabel(root, "This id should be unique for successful installation of application on the device");
 
         context.createLabel(root, "");
         context.createLabel(root, "");