Exemplo n.º 1
0
Gobby::OperationExportHtml::OperationExportHtml(
	Operations& operations, TextSessionView& view,
	const Glib::RefPtr<Gio::File>& file)
:
	Operation(operations), m_title(view.get_title()), m_file(file),
	m_xml(export_html(view)), m_index(0)
{
}
bool db_query_widget::init(const db_connection *cnn, const QString &SQL)
{
  pv_cnn = cnn;
  pv_SQL = SQL;

  pv_vlayout = new QVBoxLayout(this);
  lb_title = new QLabel(tr("SQL query widget - Connection: " ) + pv_cnn->get_cnn_name());
  pv_vlayout->addWidget(lb_title);
  pv_table = new QTableWidget(this);
  pv_vlayout->addWidget(pv_table);
  le_sql = new db_mem_lineedit;
  pv_vlayout->addWidget(le_sql);
  pv_hlayout = new QHBoxLayout(this);
  pv_vlayout->addLayout(pv_hlayout);
  pb_submit = new QPushButton(tr("&Submit"));
  pv_hlayout->addWidget(pb_submit);
  pb_html = new QPushButton(tr("&Export HTML"));
  pv_hlayout->addWidget(pb_html);
  pb_pdf = new QPushButton(tr("Export PDF"));
  pv_hlayout->addWidget(pb_pdf);
  lb_status = new QLabel(tr("Ready"));
  pv_vlayout->addWidget(lb_status);

  //pv_printer = new QPrinter;
  //pv_painter = new QPainter;

  pv_text_doc = new QTextDocument(this);
  te_text = new QTextEdit;
  //te_text->show();

  pv_table->setEditTriggers(QAbstractItemView::NoEditTriggers);

  pv_query = new QSqlQuery(pv_cnn->get_db());
  if(!pv_SQL.isEmpty()){
    new_query(pv_SQL);
  }

  //pv_label.init(cnn);

  connect(pb_submit, SIGNAL(clicked()),this, SLOT(submit_query()));
  connect(pb_html, SIGNAL(clicked()),this, SLOT(export_html()));
  connect(pb_pdf, SIGNAL(clicked()),this, SLOT(export_pdf()));
  return true;
}