本文整理汇总了C++中ekiga::Form::boolean方法的典型用法代码示例。如果您正苦于以下问题:C++ Form::boolean方法的具体用法?C++ Form::boolean怎么用?C++ Form::boolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ekiga::Form
的用法示例。
在下文中一共展示了Form::boolean方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disable
void
LM::Account::on_edit_form_submitted (bool submitted,
Ekiga::Form &result)
{
if (!submitted)
return;
disable (); // don't stay connected!
std::string name = result.text ("name");
std::string user = result.text ("user");
std::string server = result.text ("server");
std::string port = result.text ("port");
std::string resource = result.text ("resource");
std::string password = result.private_text ("password");
bool enable_on_startup = result.boolean ("enabled");
xmlSetProp (node, BAD_CAST "name", BAD_CAST name.c_str ());
xmlSetProp (node, BAD_CAST "user", BAD_CAST user.c_str ());
xmlSetProp (node, BAD_CAST "server", BAD_CAST server.c_str ());
xmlSetProp (node, BAD_CAST "port", BAD_CAST port.c_str ());
xmlSetProp (node, BAD_CAST "resource", BAD_CAST resource.c_str ());
xmlSetProp (node, BAD_CAST "password", BAD_CAST password.c_str ());
if (enable_on_startup) {
xmlSetProp (node, BAD_CAST "startup", BAD_CAST "true");
enable ();
} else {
xmlSetProp (node, BAD_CAST "startup", BAD_CAST "false");
updated ();
}
}
示例2: xmlSetProp
void
RL::Heap::on_edit_form_submitted (bool submitted,
Ekiga::Form& result)
{
if (!submitted)
return;
std::string name_str = result.text ("name");
std::string root_str = result.text ("root");
std::string user_str = result.text ("user");
std::string username_str = result.text ("username");
std::string password_str = result.private_text ("password");
bool writable = result.boolean ("writable");
if (writable)
xmlSetProp (node, BAD_CAST "writable", BAD_CAST "1");
else
xmlSetProp (node, BAD_CAST "writable", BAD_CAST "0");
robust_xmlNodeSetContent (node, &name, "name", name_str);
robust_xmlNodeSetContent (node, &root, "root", root_str);
robust_xmlNodeSetContent (node, &user, "user", user_str);
robust_xmlNodeSetContent (node, &username, "username", username_str);
robust_xmlNodeSetContent (node, &password, "password", password_str);
trigger_saving.emit ();
updated.emit ();
refresh ();
}
示例3: if
void Opal::Bank::on_new_account_form_submitted (Ekiga::Form &result,
Account::Type t)
{
try {
Ekiga::FormRequestSimple request;
std::string error;
std::string new_name = (t == Opal::Account::SIP || t == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
std::string new_host = (t == Opal::Account::SIP || t == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
std::string new_user = result.text ("user");
std::string new_authentication_user = (t == Opal::Account::SIP) ? result.text ("authentication_user") : new_user;
std::string new_password = result.private_text ("password");
bool new_enabled = result.boolean ("enabled");
unsigned new_timeout = atoi ((t == Opal::Account::SIP || t == Opal::Account::H323) ?
result.text ("timeout").c_str () : result.hidden ("timeout").c_str ());
result.visit (request);
if (new_name.empty ())
error = _("You did not supply a name for that account.");
else if (new_host.empty ())
error = _("You did not supply a host to register to.");
else if (new_user.empty ())
error = _("You did not supply a user name for that account.");
else if (new_timeout < 10)
error = _("The timeout should have a bigger value.");
if (!error.empty ()) {
request.error (error);
request.submitted.connect (sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted) ,t));
if (!questions.handle_request (&request)) {
#ifdef __GNUC__
std::cout << "Unhandled form request in "
<< __PRETTY_FUNCTION__ << std::endl;
#endif
}
}
else {
add (t, new_name, new_host, new_user, new_authentication_user, new_password, new_enabled, new_timeout);
save ();
}
} catch (Ekiga::Form::not_found) {
std::cerr << "Invalid result form" << std::endl;
}
}
示例4: if
void Opal::Bank::on_new_account_form_submitted (bool submitted,
Ekiga::Form &result,
Account::Type acc_type)
{
if (!submitted)
return;
boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new Ekiga::FormRequestSimple (boost::bind (&Opal::Bank::on_new_account_form_submitted, this, _1, _2, acc_type)));
std::string error;
std::string new_name = (acc_type == Opal::Account::SIP
|| acc_type == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
std::string new_host = (acc_type == Opal::Account::SIP
|| acc_type == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
std::string new_user = result.text ("user");
std::string new_authentication_user = (acc_type == Opal::Account::SIP) ? result.text ("authentication_user") : new_user;
std::string new_password = result.private_text ("password");
bool new_enabled = result.boolean ("enabled");
unsigned new_timeout = atoi ((acc_type == Opal::Account::SIP
|| acc_type == Opal::Account::H323) ?
result.text ("timeout").c_str () : result.hidden ("timeout").c_str ());
result.visit (*request);
if (new_name.empty ())
error = _("You did not supply a name for that account.");
else if (new_host.empty ())
error = _("You did not supply a host to register to.");
else if (new_user.empty ())
error = _("You did not supply a user name for that account.");
else if (new_timeout < 10)
error = _("The timeout should be at least 10 seconds.");
if (!error.empty ()) {
request->error (error);
questions (request);
}
else {
add (acc_type, new_name, new_host, new_user, new_authentication_user,
new_password, new_enabled, new_timeout);
save ();
}
}
示例5: add
bool
RL::Cluster::on_new_heap_form_submitted (bool submitted,
Ekiga::Form &result,
std::string &/*error*/)
{
if (!submitted)
return false;
const std::string name = result.text ("name");
const std::string uri = result.text ("uri");
const std::string username = result.text ("username");
const std::string password = result.text ("password");
const std::string user = result.text ("user");
bool writable = result.boolean ("writable");
add (name, uri, username, password, user, writable);
return true;
}
示例6: account
void
LM::Bank::on_new_account_form_submitted (bool submitted,
Ekiga::Form &result)
{
if (!submitted)
return;
std::string name = result.text ("name");
std::string user = result.text ("user");
std::string server = result.text ("server");
std::string resource = result.text ("resource");
std::string password = result.private_text ("password");
bool enable_on_startup = result.boolean ("enabled");
boost::shared_ptr<Account> account (new Account (details, dialect, cluster,
name, user, server, LM_CONNECTION_DEFAULT_PORT,
resource, password,
enable_on_startup));
xmlNodePtr root = xmlDocGetRootElement (doc);
xmlAddChild (root, account->get_node ());
save ();
add (account);
}
示例7: robust_xmlEscape
void
Local::Presentity::edit_presentity_form_submitted (bool submitted,
Ekiga::Form &result)
{
if (!submitted)
return;
const std::string new_name = result.text ("name");
const std::set<std::string> groups = get_groups ();
const std::set<std::string> new_groups = result.editable_set ("groups");
std::string new_uri = result.text ("uri");
const std::string uri = get_uri ();
bool preferred = result.boolean ("preferred");
std::set<xmlNodePtr> nodes_to_remove;
new_uri = canonize_uri (new_uri);
for (xmlNodePtr child = node->children ;
child != NULL ;
child = child->next) {
if (child->type == XML_ELEMENT_NODE
&& child->name != NULL) {
if (xmlStrEqual (BAD_CAST ("name"), child->name)) {
robust_xmlNodeSetContent (node, &child, "name", new_name);
}
}
}
if (uri != new_uri) {
boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
if (pcore) {
pcore->unfetch_presence (uri);
pcore->fetch_presence (new_uri);
}
presence = "unknown";
xmlSetProp (node, (const xmlChar*)"uri", (const xmlChar*)new_uri.c_str ());
}
// the first loop looks at groups we were in : are we still in ?
for (xmlNodePtr child = node->children ;
child != NULL ;
child = child->next) {
if (child->type == XML_ELEMENT_NODE
&& child->name != NULL) {
if (xmlStrEqual (BAD_CAST ("group"), child->name)) {
xmlChar* xml_str = xmlNodeGetContent (child);
if (xml_str != NULL) {
if (new_groups.find ((const char*) xml_str) == new_groups.end ()) {
nodes_to_remove.insert (child); // don't free what we loop on!
}
xmlFree (xml_str);
}
}
}
}
// ok, now we can clean up!
for (std::set<xmlNodePtr>::iterator iter = nodes_to_remove.begin ();
iter != nodes_to_remove.end ();
++iter) {
xmlUnlinkNode (*iter);
xmlFreeNode (*iter);
}
// the second loop looking for groups we weren't in but are now
for (std::set<std::string>::const_iterator iter = new_groups.begin ();
iter != new_groups.end ();
iter++) {
if (std::find (groups.begin (), groups.end (), *iter) == groups.end ()) {
xmlNewChild (node, NULL,
BAD_CAST "group",
BAD_CAST robust_xmlEscape (node->doc, *iter).c_str ());
}
}
if (preferred) {
xmlSetProp (node, BAD_CAST "preferred", BAD_CAST "true");
} else {
xmlSetProp (node, BAD_CAST "preferred", BAD_CAST "false");
}
updated ();
trigger_saving ();
}
示例8: strlen
int
OPENLDAP::BookFormInfo (Ekiga::Form &result,
struct BookInfo &bookinfo,
std::string &errmsg)
{
LDAPURLDesc *url_base = NULL, *url_host = NULL;
char *url_str;
std::string name = result.text ("name");
std::string uri = result.text ("uri");
std::string nameAttr = result.text ("nameAttr");
std::string callAttr = result.text ("callAttr");
std::string filter = result.text ("filter");
errmsg = "";
if (name.empty())
errmsg += _("Please provide a Book Name for this directory\n");
if (uri.empty())
errmsg += _("Please provide a Server URI\n");
if (nameAttr.empty())
errmsg += _("Please provide a DisplayName attribute\n");
if (callAttr.empty())
errmsg += _("Please provide a Call attribute\n");
if (ldap_url_parse (uri.c_str(), &url_host))
errmsg += _("Invalid Server URI\n");
if (!errmsg.empty()) {
return -1;
}
if (filter.empty())
filter = "(cn=$)";
bookinfo.name = name;
std::string base = result.text ("base");
std::string new_bits = "ldap:///?" +
result.text ("nameAttr") + "," +
result.text ("callAttr") + "?" +
result.single_choice ("scope") + "?" +
result.text ("filter");
bookinfo.authcID = result.text ("authcID");
bookinfo.password = result.text ("password");
bookinfo.starttls = result.boolean ("startTLS");
bookinfo.sasl = result.boolean ("sasl");
bookinfo.saslMech = result.single_choice ("saslMech");
if (bookinfo.sasl || bookinfo.starttls) {
new_bits += "?";
if (bookinfo.starttls)
new_bits += "StartTLS";
if (bookinfo.sasl) {
if (bookinfo.starttls)
new_bits += ",";
new_bits += "SASL";
if (!bookinfo.saslMech.empty())
new_bits += "=" + bookinfo.saslMech;
}
}
if (ldap_url_parse (new_bits.c_str(), &url_base))
errmsg += _("Invalid Server URI\n");
if (!errmsg.empty()) {
return -1;
}
url_host->lud_dn = ldap_strdup (base.c_str());
url_host->lud_attrs = url_base->lud_attrs;
url_host->lud_scope = url_base->lud_scope;
url_host->lud_filter = url_base->lud_filter;
if (!url_host->lud_exts) {
url_host->lud_exts = url_base->lud_exts;
url_base->lud_exts = NULL;
}
url_base->lud_attrs = NULL;
url_base->lud_filter = NULL;
ldap_free_urldesc (url_base);
bookinfo.urld = boost::shared_ptr<LDAPURLDesc> (url_host, ldap_url_desc_deleter ());
url_str = ldap_url_desc2str (url_host);
bookinfo.uri = std::string(url_str);
ldap_memfree (url_str);
{
size_t pos;
pos = bookinfo.uri.find ('/', strlen(url_host->lud_scheme) + 3);
if (pos != std::string::npos)
bookinfo.uri_host = bookinfo.uri.substr (0,pos);
else
bookinfo.uri_host = bookinfo.uri;
}
return 0;
}