Exemple #1
0
 void APIBinding::_GetInstalledComponentsImpl(
     KComponentType type, const ValueList& args, KValueRef result)
 {
     bool force = args.GetBool(0, false);
     vector<SharedComponent>& components = BootUtils::GetInstalledComponents(force);
     KListRef componentList = ComponentVectorToKList(components, type);
     result->SetList(componentList);
 }
	void HTTPClientBinding::Open(const ValueList& args, KValueRef result)
	{
		args.VerifyException("open", "ss?bss");

		this->method = args.GetString(0);
		this->url = args.GetString(1);
		this->SetString("url", this->url);

		// Validate the scheme
		const std::string scheme = Poco::URI(url).getScheme();
		if (scheme != "http" && scheme != "https")
		{
			logger->Error("%s scheme is not supported", scheme.c_str());
			result->SetBool(false);
			return;
		}

		if (this->method.empty())
		{
			this->method = Poco::Net::HTTPRequest::HTTP_GET;
		}

		if (args.size() >= 3)
		{
			this->async = args.GetBool(2);
		}

		if (args.size() >= 4)
		{
			this->basicCredentials.setUsername(args.GetString(3));
			this->basicCredentials.setPassword(args.GetString(4));
		}

		// Get on*** handler functions
		this->ondatastream = this->GetMethod("ondatastream");
		this->onreadystate = this->GetMethod("onreadystatechange");
		this->onsendstream = this->GetMethod("onsendstream");
		this->onload = this->GetMethod("onload");

		this->ChangeState(1); // opened
		result->SetBool(true);
	}
void MenuItem::_SetAutoCheck(const ValueList& args, KValueRef result)
{
    args.VerifyException("setAutoCheck", "b");
    this->autoCheck = args.GetBool(0);
}
void MenuItem::_SetState(const ValueList& args, KValueRef result)
{
    args.VerifyException("setState", "b");
    this->SetState(args.GetBool(0));
}
	void HTTPCookie::SetSecure(const ValueList& args, KValueRef result)
	{
		args.VerifyException("setSecure", "b");
		this->cookie.setSecure(args.GetBool(0));
	}
	void HTTPCookie::SetHTTPOnly(const ValueList& args, KValueRef result)
	{
		args.VerifyException("setHTTPOnly", "b");
		this->cookie.setHttpOnly(args.GetBool(0));
	}