incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [3/3] bada commit: fixing callbacks
Date Wed, 11 Apr 2012 22:30:59 GMT
fixing callbacks


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/commit/9ca9d919
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/tree/9ca9d919
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/diff/9ca9d919

Branch: refs/heads/master
Commit: 9ca9d919c912ee04fb5e07c8dd07ba7a99af8714
Parents: 5b5363d
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Wed Apr 11 15:22:37 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Wed Apr 11 15:22:37 2012 -0700

----------------------------------------------------------------------
 src/Accelerometer.cpp |    6 +++---
 src/Compass.cpp       |    6 +++---
 src/Contacts.cpp      |   12 ++++++------
 src/Cordova.cpp       |    2 +-
 src/GeoLocation.cpp   |   12 ++++++------
 src/Kamera.cpp        |    8 ++++----
 src/Network.cpp       |    4 ++--
 src/Notification.cpp  |   20 ++++++++++----------
 src/WebForm.cpp       |   12 ++++++------
 9 files changed, 41 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/Accelerometer.cpp
----------------------------------------------------------------------
diff --git a/src/Accelerometer.cpp b/src/Accelerometer.cpp
index 448fb8a..257ce8e 100755
--- a/src/Accelerometer.cpp
+++ b/src/Accelerometer.cpp
@@ -60,7 +60,7 @@ Accelerometer::StartSensor(void) {
 	} else {
 		AppLogException("Acceleration sensor is not available");
 		String res;
-		res.Format(256, L"PhoneGap.callbacks['%S'].fail({message:'Acceleration sensor is not available',code:'001'});");
+		res.Format(256, L"Cordova.callbacks['%S'].fail({message:'Acceleration sensor is not available',code:'001'});");
 		pWeb->EvaluateJavascriptN(res);
 		return false;
 	}
@@ -90,7 +90,7 @@ Accelerometer::IsStarted() {
 void
 Accelerometer::GetLastAcceleration() {
 	String res;
-	res.Format(256, L"PhoneGap.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
+	res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
 	pWeb->EvaluateJavascriptN(res);
 
 	res.Clear();
@@ -109,7 +109,7 @@ Accelerometer::OnDataReceived(SensorType sensorType, SensorData& sensorData,
res
 	AppLogDebug("x: %f, y: %f, z: %f timestamp: %d", x, y, z, timestamp);
 
 	String res;
-	res.Format(256, L"PhoneGap.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
+	res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
 	pWeb->EvaluateJavascriptN(res);
 
 	res.Clear();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/Compass.cpp
----------------------------------------------------------------------
diff --git a/src/Compass.cpp b/src/Compass.cpp
index 773c7ef..ec35e93 100755
--- a/src/Compass.cpp
+++ b/src/Compass.cpp
@@ -64,7 +64,7 @@ Compass::StartSensor(void) {
 	} else {
 		AppLogException("Compass sensor is not available");
 		String res;
-		res.Format(256, L"PhoneGap.callbacks['%S'].fail({message:'Magnetic sensor is not available',code:'001'});",
callbackId.GetPointer());
+		res.Format(256, L"Cordova.callbacks['%S'].fail({message:'Magnetic sensor is not available',code:'001'});",
callbackId.GetPointer());
 		pWeb->EvaluateJavascriptN(res);
 		return false;
 	}
@@ -94,7 +94,7 @@ Compass::IsStarted() {
 void
 Compass::GetLastHeading() {
 	String res;
-	res.Format(256, L"PhoneGap.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
+	res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
 	pWeb->EvaluateJavascriptN(res);
 }
 
@@ -109,6 +109,6 @@ Compass::OnDataReceived(SensorType sensorType, SensorData& sensorData,
result r)
 	AppLogDebug("x: %f, y: %f, z: %f timestamp: %d", x, y, z, timestamp);
 
 	String res;
-	res.Format(256, L"PhoneGap.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
+	res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(),
x, y, z, timestamp);
 	pWeb->EvaluateJavascriptN(res);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/Contacts.cpp
----------------------------------------------------------------------
diff --git a/src/Contacts.cpp b/src/Contacts.cpp
index 7b16d94..baa7a97 100755
--- a/src/Contacts.cpp
+++ b/src/Contacts.cpp
@@ -409,11 +409,11 @@ Contacts::Create(const int cid) {
 
 	if(IsFailed(r)) {
 		AppLogException("Could not add contact");
-		eval.Format(128, L"PhoneGap.callbacks['%S'].fail({message:'%s',code:%d})", callbackId.GetPointer(),
r, GetErrorMessage(r));
+		eval.Format(128, L"Cordova.callbacks['%S'].fail({message:'%s',code:%d})", callbackId.GetPointer(),
r, GetErrorMessage(r));
 		pWeb->EvaluateJavascriptN(eval);
 	} else {
 		AppLogDebug("Contact Successfully Added");
-		eval.Format(128, L"PhoneGap.callbacks['%S'].success({message:'Contact added successfully'})",
callbackId.GetPointer());
+		eval.Format(128, L"Cordova.callbacks['%S'].success({message:'Contact added successfully'})",
callbackId.GetPointer());
 		AppLogDebug("%S", eval.GetPointer());
 		pWeb->EvaluateJavascriptN(eval);
 	}
@@ -544,10 +544,10 @@ Contacts::Find(const String& filter) {
 
 	delete value;
 	if(length > 0) {
-		eval.Format(128, L"PhoneGap.callbacks['%S'].success(navigator.service.contacts.results)",
callbackId.GetPointer());
+		eval.Format(128, L"Cordova.callbacks['%S'].success(navigator.service.contacts.results)",
callbackId.GetPointer());
 		pWeb->EvaluateJavascriptN(eval);
 	} else {
-		eval.Format(128, L"PhoneGap.callbacks['%S'].fail({message:'no contacts found',code:00})",
callbackId.GetPointer());
+		eval.Format(128, L"Cordova.callbacks['%S'].fail({message:'no contacts found',code:00})",
callbackId.GetPointer());
 		pWeb->EvaluateJavascriptN(eval);
 	}
 }
@@ -571,12 +571,12 @@ Contacts::Remove(const String& idStr) {
 		r = addressbook.RemoveContact(id);
 		if(IsFailed(r)) {
 			AppLogDebug("Contact Could not be removed %s %d", GetErrorMessage(r), r);
-			eval.Format(256, L"PhoneGap.callbacks['%S'].fail({message:'%s', code:ContactError.NOT_FOUND_ERROR})",
+			eval.Format(256, L"Cordova.callbacks['%S'].fail({message:'%s', code:ContactError.NOT_FOUND_ERROR})",
 															 callbackId.GetPointer(), GetErrorMessage(r));
 			pWeb->EvaluateJavascriptN(eval);
 		} else {
 			AppLogDebug("Contact %S removed", idStr.GetPointer());
-			eval.Format(256, L"PhoneGap.callbacks['%S'].success({message:'Contact with ID %d removed',
code:01})", callbackId.GetPointer(), id);
+			eval.Format(256, L"Cordova.callbacks['%S'].success({message:'Contact with ID %d removed',
code:01})", callbackId.GetPointer(), id);
 			pWeb->EvaluateJavascriptN(eval);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/Cordova.cpp
----------------------------------------------------------------------
diff --git a/src/Cordova.cpp b/src/Cordova.cpp
index d32a8f3..46e2d8d 100755
--- a/src/Cordova.cpp
+++ b/src/Cordova.cpp
@@ -1,5 +1,5 @@
 /**
- * Name        : PhoneGap
+ * Name        : Cordova
  * Version     : 
  * Vendor      : 
  * Description : 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/GeoLocation.cpp
----------------------------------------------------------------------
diff --git a/src/GeoLocation.cpp b/src/GeoLocation.cpp
index 54cadbe..8f94693 100755
--- a/src/GeoLocation.cpp
+++ b/src/GeoLocation.cpp
@@ -86,12 +86,12 @@ GeoLocation::GetLastKnownLocation() {
 		String coordinates;
 		coordinates.Format(256, L"new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude,
speed, accuracy, heading);
 		String res;
-		res.Format(512, L"PhoneGap.callbacks['%S'].success(new Position(%S,%d))", callbackId.GetPointer(),
coordinates.GetPointer(), timestamp);
+		res.Format(512, L"Cordova.callbacks['%S'].success(new Position(%S,%d))", callbackId.GetPointer(),
coordinates.GetPointer(), timestamp);
 		pWeb->EvaluateJavascriptN(res);
 	} else {
-		AppLogDebug("PhoneGap.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
+		AppLogDebug("Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
 		String res;
-		res.Format(256, L"PhoneGap.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
+		res.Format(256, L"Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
 		pWeb->EvaluateJavascriptN(res);
 	}
 }
@@ -111,12 +111,12 @@ GeoLocation::OnLocationUpdated(Location& location) {
 		String coordinates;
 		coordinates.Format(256, L"new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude,
speed, accuracy, heading);
 		String res;
-		res.Format(512, L"PhoneGap.callbacks['%S'].success(new Position(%S,%d))", callbackId.GetPointer(),
coordinates.GetPointer(), timestamp);
+		res.Format(512, L"Cordova.callbacks['%S'].success(new Position(%S,%d))", callbackId.GetPointer(),
coordinates.GetPointer(), timestamp);
 		pWeb->EvaluateJavascriptN(res);
 	} else {
-		AppLogDebug("PhoneGap.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
+		AppLogDebug("Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
 		String res;
-		res.Format(256, L"PhoneGap.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
+		res.Format(256, L"Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))",
callbackId.GetPointer());
 		pWeb->EvaluateJavascriptN(res);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/Kamera.cpp
----------------------------------------------------------------------
diff --git a/src/Kamera.cpp b/src/Kamera.cpp
index 8aaaf30..bba76c5 100755
--- a/src/Kamera.cpp
+++ b/src/Kamera.cpp
@@ -74,7 +74,7 @@ Kamera::OnAppControlCompleted (const String &appControlId, const String
&operati
 
 		if(IsFailed(r)) {
 			AppLogException("Could not copy picture");
-			eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Could not copy picture')", callbackId.GetPointer());
+			eval.Format(512, L"Cordova.callbacks['%S'].fail('Could not copy picture')", callbackId.GetPointer());
 			AppLogDebug("%S", eval.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 		}
@@ -82,7 +82,7 @@ Kamera::OnAppControlCompleted (const String &appControlId, const String
&operati
 //		Uri imageUri;
 //		imageUri.setUri(homeFilename);
 		eval.Clear();
-		eval.Format(512, L"PhoneGap.callbacks['%S'].success('file://%S')", callbackId.GetPointer(),
homeFilename.GetPointer());
+		eval.Format(512, L"Cordova.callbacks['%S'].success('file://%S')", callbackId.GetPointer(),
homeFilename.GetPointer());
 		AppLogDebug("%S", eval.GetPointer());
 		pWeb->EvaluateJavascriptN(eval);
 	  }
@@ -90,14 +90,14 @@ Kamera::OnAppControlCompleted (const String &appControlId, const String
&operati
 	  {
 		AppLog("Camera capture canceled.");
 		String eval;
-		eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture canceled')", callbackId.GetPointer());
+		eval.Format(512, L"Cordova.callbacks['%S'].fail('Camera capture canceled')", callbackId.GetPointer());
 		pWeb->EvaluateJavascriptN(eval);
 	  }
 	  else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_FAILED)))
 	  {
 		AppLog("Camera capture failed.");
 		String eval;
-		eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture failed')", callbackId.GetPointer());
+		eval.Format(512, L"Cordova.callbacks['%S'].fail('Camera capture failed')", callbackId.GetPointer());
 		pWeb->EvaluateJavascriptN(eval);
 	  }
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/Network.cpp
----------------------------------------------------------------------
diff --git a/src/Network.cpp b/src/Network.cpp
index e69d5bd..5b0f490 100755
--- a/src/Network.cpp
+++ b/src/Network.cpp
@@ -63,7 +63,7 @@ void
 Network::OnTransactionAborted (HttpSession &httpSession, HttpTransaction &httpTransaction,
result r) {
 	AppLogDebug("Transaction Aborted");
 	String res;
-	res.Format(128, L"PhoneGap.callbacks['%S'].fail({code:%d,message:'%s'});", callbackId.GetPointer(),
r, GetErrorMessage(r));
+	res.Format(128, L"Cordova.callbacks['%S'].fail({code:%d,message:'%s'});", callbackId.GetPointer(),
r, GetErrorMessage(r));
 	AppLogDebug("%S", res.GetPointer());
 	pWeb->EvaluateJavascriptN(res);
 }
@@ -100,7 +100,7 @@ Network::OnTransactionCompleted (HttpSession &httpSession, HttpTransaction
&http
 	AppLogDebug("%S", res.GetPointer());
 	pWeb->EvaluateJavascriptN(res);
 
-	res.Format(128, L"PhoneGap.callbacks['%S'].success(%d);", callbackId.GetPointer(), status);
+	res.Format(128, L"Cordova.callbacks['%S'].success(%d);", callbackId.GetPointer(), status);
 	AppLogDebug("%S", res.GetPointer());
 	pWeb->EvaluateJavascriptN(res);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/Notification.cpp
----------------------------------------------------------------------
diff --git a/src/Notification.cpp b/src/Notification.cpp
index e943516..ff04239 100755
--- a/src/Notification.cpp
+++ b/src/Notification.cpp
@@ -85,43 +85,43 @@ Notification::Dialog() {
 		messageBox.ShowAndWait(modalResult);
 		switch(modalResult) {
 		case MSGBOX_RESULT_CLOSE:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('Close')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('Close')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_OK:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('OK')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('OK')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_CANCEL:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('Cancel')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('Cancel')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_YES:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('Yes')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('Yes')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_NO:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('No')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('No')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_ABORT:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('Abort')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('Abort')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_TRY:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('Try')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('Try')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_RETRY:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('Retry')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('Retry')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_IGNORE:
-			eval.Format(128, L"PhoneGap.callbacks['%S'].success('Ignore')", callbackId.GetPointer());
+			eval.Format(128, L"Cordova.callbacks['%S'].success('Ignore')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		case MSGBOX_RESULT_CONTINUE:
-			eval.Format(64, L"PhoneGap.callbacks['%S'].success('Continue')", callbackId.GetPointer());
+			eval.Format(64, L"Cordova.callbacks['%S'].success('Continue')", callbackId.GetPointer());
 			pWeb->EvaluateJavascriptN(eval);
 			break;
 		}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/9ca9d919/src/WebForm.cpp
----------------------------------------------------------------------
diff --git a/src/WebForm.cpp b/src/WebForm.cpp
index 9885a8c..dca2161 100755
--- a/src/WebForm.cpp
+++ b/src/WebForm.cpp
@@ -109,7 +109,7 @@ WebForm::OnLoadingRequested (const Osp::Base::String& url, WebNavigationType
typ
 //		return true;
 		return false;
 	} else if(url.StartsWith("http://", 0) || url.StartsWith("https://", 0)) {
-		AppLogDebug("Non PhoneGap command. External URL. Launching WebBrowser");
+		AppLogDebug("Non Cordova command. External URL. Launching WebBrowser");
 		LaunchBrowser(url);
 		return false;
 	}
@@ -119,18 +119,18 @@ WebForm::OnLoadingRequested (const Osp::Base::String& url, WebNavigationType
typ
 
 void
 WebForm::OnLoadingCompleted() {
-	// Setting DeviceInfo to initialize PhoneGap (should be done only once) and firing onNativeReady
event
+	// Setting DeviceInfo to initialize Cordova (should be done only once) and firing onNativeReady
event
 	String* deviceInfo;
 	deviceInfo = __pWeb->EvaluateJavascriptN(L"window.device.uuid");
 	if(deviceInfo->IsEmpty()) {
 		device->SetDeviceInfo();
-		__pWeb->EvaluateJavascriptN("PhoneGap.onNativeReady.fire();");
+		__pWeb->EvaluateJavascriptN("Cordova.onNativeReady.fire();");
 	} else {
 		//AppLogDebug("DeviceInfo = %S;", deviceInfo->GetPointer());
 	}
 	delete deviceInfo;
 
-	// Analyzing PhoneGap command
+	// Analyzing Cordova command
 	if(__cordovaCommand) {
 		if(__cordovaCommand->StartsWith(L"gap://com.cordova.Geolocation", 0)) {
 			geolocation->Run(*__cordovaCommand);
@@ -157,12 +157,12 @@ WebForm::OnLoadingCompleted() {
 			camera->Run(*__cordovaCommand);
 		}
 		// Tell the JS code that we got this command, and we're ready for another
-		__pWeb->EvaluateJavascriptN(L"PhoneGap.queue.ready = true;");
+		__pWeb->EvaluateJavascriptN(L"Cordova.queue.ready = true;");
 		delete __cordovaCommand;
 		__cordovaCommand = null;
 	}
 	else {
-		AppLogDebug("Non PhoneGap command completed");
+		AppLogDebug("Non Cordova command completed");
 	}
 }
 


Mime
View raw message