void CameraInvocation::cameraCardDone(const CardDoneMessage& message) {
    // The camera card is now off screen so clear the visible flag.
    visible_ = false;

    QString reason = message.reason();
    Local<Object> options = options_->getValue()->ToObject();
    if (reason == "done") {
        // User closed the card without taking a picture or video.
        CallV8ObjectProperty(options, "cancel", 0, 0);
    } else if (reason == "close") {
        Local<Object> data = Object::New();
        QString errorMessage = message.data();
        if (!errorMessage.isEmpty()) {
            data->Set(String::NewSymbol("error"),
                      String::New(errorMessage.toUtf8().constData()));
        }
        Handle<Value> argv[1] = { data };
        CallV8ObjectProperty(options, "error", 1, argv);
    } else if (reason == "save") {
        TitaniumRuntime* runtime = TitaniumRuntime::instance();
        TiBlobObject* blob = TiBlobObject::createBlob(runtime->objectFactory());
        Handle<Object> blobProxy = runtime->rootObject()->createProxyObject();
        blob->setValue(blobProxy);
        TiObject::setTiObjectToJsObject(blobProxy, blob);

        QString mediaFile = message.data();
        blob->setData(mediaFile);

        Local<Object> data = Object::New();
        data->Set(String::NewSymbol("media"), blobProxy);
        Handle<Value> argv[1] = { data };
        CallV8ObjectProperty(options, "success", 1, argv);
    }
}
/**
 * the Card couldn't be processed successfully
 * so we're sending with reason cancel
 * and add data to describe why
 */
void ApplicationUI::cardCanceled(const QString data) {
	qDebug() << "cardDone: assemble message";
	// Assemble message
	CardDoneMessage message;
	message.setData(data);
	message.setDataType("text/plain");
	message.setReason("cancel");
	// Send message
	qDebug() << "cardDone: sending message via IvokeManager data: "
			<< message.data() << " reason: " << message.reason();
	mInvokeManager->sendCardDone(message);

}
/**
 * the Card was processed with success
 */
void ApplicationUI::cardDone() {
	qDebug() << "cardDone: assemble message";
	// Assemble message
	CardDoneMessage message;
	message.setData(tr(":)"));
	message.setDataType("text/plain");
	message.setReason("save");
	// Send message
	qDebug() << "cardDone: sending message via IvokeManager data: "
			<< message.data() << " reason: " << message.reason();
	mInvokeManager->sendCardDone(message);

}