Exemplo n.º 1
0
bool SignatureDialog::show(XmlNode & sig, const QString & title, bool block)
{
  cf3_assert( sig.is_valid() );

  XmlNode node = sig.content->first_node();
  QString name;

  m_ok_clicked = false;

  this->setWindowTitle(title);

  m_data_layout->clear_options();

  for( ; node.is_valid() ; node.content = node.content->next_sibling())
  {
    m_data_layout->add_option( SignalOptions::xml_to_option(node) );

    name = node.content->first_attribute( Protocol::Tags::attr_key() )->value();

    m_nodes[name] = node;
  }

 if( m_data_layout->has_options() )
  {
   if(block)
   {
     m_is_blocking = true;
     this->exec();
   }
   else
   {
     m_is_blocking = false;
     this->setModal(true);
     this->setVisible(true);
   }
  }
  else
  {
    m_ok_clicked = true;
    emit finished(QDialog::Accepted);
  }

  return m_ok_clicked;
}
Exemplo n.º 2
0
  XmlNode Protocol::add_reply_frame ( XmlNode& node )
  {
    cf3_assert( node.is_valid() );
    cf3_assert( is_not_null(node.content->parent()) );

    rapidxml::xml_node<>* xml_node = node.content;

    XmlNode replynode = XmlNode(node.content->parent()).add_node( Tags::node_frame());

    replynode.set_attribute( "type", Tags::node_type_reply() );

    // reply with same target
    rapidxml::xml_attribute<>* target_att = xml_node->first_attribute("target");
    std::string target = is_not_null(target_att) ? target_att->value() : "";
    replynode.set_attribute("target", target);

    // the sender becomes the receiver
    rapidxml::xml_attribute<>* sender_att = xml_node->first_attribute("sender");
    std::string receiver = is_not_null(sender_att) ? sender_att->value() : "";
    replynode.set_attribute("receiver", receiver);

    // same transaction type
    rapidxml::xml_attribute<>* trans_att = xml_node->first_attribute("transaction");
    std::string trans = is_not_null(trans_att) ? trans_att->value() : "auto";
    replynode.set_attribute("transaction", trans);

    // copy uuids, if any
    rapidxml::xml_attribute<>*  client_uuid_att = xml_node->first_attribute( Tags::attr_clientid() );
    rapidxml::xml_attribute<>*  frame_uuid_att = xml_node->first_attribute( Tags::attr_frameid() );

    if( is_not_null(client_uuid_att) )
      replynode.set_attribute(Tags::attr_clientid(), client_uuid_att->value());

    if( is_not_null(frame_uuid_att) )
      replynode.set_attribute(Tags::attr_frameid(), frame_uuid_att->value() );

    return replynode;
//    return XmlNode();
  }
Exemplo n.º 3
0
  XmlNode  Protocol::first_frame_node ( const XmlNode& node )
  {
    cf3_assert( node.is_valid() );

    return XmlNode( node.content->first_node( Protocol::Tags::node_frame() ));
  }