View used to show audit logs. More...
#include <Database.h>


Public Slots | |
| void | pipe_queryResult (QSqlQuery *result) |
| void | updateModel () |
Public Member Functions | |
| DatabaseAuditLogView (QWidget *parent=0) | |
Static Public Member Functions | |
| static const QString | staticWindowTitle () |
View used to show audit logs.
| DatabaseAuditLogView::DatabaseAuditLogView | ( | QWidget * | parent = 0 |
) |
: QWidget(parent), baseQuery("SELECT * FROM vew_audits WHERE audi_timestamp >= '%1' AND audi_timestamp <= '%2' ") { setObjectName("DatabaseAuditLogView"); setWindowTitle(staticWindowTitle()); logView = new QTableView(this); SqlQueryModel *model = new SqlQueryModel(logView); // set dependencies (best would be to query the DB for audited tables, or implement the notify system) foreach (QString tableName , Database::staticCon().tables(QSql::Tables)) if (tableName.contains(GlobalConst::SMARTLET_SCHEMA)) model->setDependency(tableName.remove(GlobalConst::SMARTLET_SCHEMA + ".")); qDebug() << model->dependencies(); logView->setModel(model); QGridLayout *l = new QGridLayout(); l->addWidget(logView, 0, 0, 1, 1); setLayout(l); connect(TimeConstraint::instance(), SIGNAL(signalOnTimeConstraintChange(TimeConstraint::ConstraintType,QDateTime)), this, SLOT(updateModel())); updateModel(); }
| void DatabaseAuditLogView::pipe_queryResult | ( | QSqlQuery * | result | ) | [slot] |
{
Q_ASSERT(logView);
QSqlQueryModel *model = dynamic_cast<QSqlQueryModel*>(logView->model());
Q_ASSERT(model);
if (result->isActive())
model->setQuery(*result);
else {
model->clear();
}
logView->setEnabled(result->isActive());
}
| const QString DatabaseAuditLogView::staticWindowTitle | ( | ) | [static] |
Referenced by DatabaseAuditLogView().
{
return "Smartlet audit log";
}
| void DatabaseAuditLogView::updateModel | ( | ) | [slot] |
Referenced by DatabaseAuditLogView().
{
logView->setEnabled(false);
QString beginTime = TimeConstraint::instance()->getTimeConstraint(TimeConstraint::TypeBeginTime).toString(Qt::ISODate);
QString endTime = TimeConstraint::instance()->getTimeConstraint(TimeConstraint::TypeEndTime).toString(Qt::ISODate);
Database::instance()->execThreaded(baseQuery.arg(beginTime, endTime), this);
}
1.7.1