2021-02-11 Fred Gleason <fredg@paravelsystems.com>

* Added 'RDSchedRulesModel'.
	* Added a pseudo-schema change to force checking of schedule code
	rules.
	* Incremented the database version to 348.
	* Added a check for scheduler code rules to rddbmgr(8).
	* Refactored the 'Scheduler Rules' dialog in rdlogmanager(1) to
	use the model based API.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-02-11 15:28:48 -05:00
parent 57922f947b
commit f1703ba647
34 changed files with 1181 additions and 419 deletions

View File

@@ -83,7 +83,7 @@ ListSchedCodes::ListSchedCodes(QWidget *parent)
// Schedule Codes List
//
list_schedcodes_view=new RDTableView(this);
list_schedcodes_model=new RDSchedCodeListModel(this);
list_schedcodes_model=new RDSchedCodeListModel(false,this);
list_schedcodes_model->setFont(defaultFont());
list_schedcodes_model->setPalette(palette());
list_schedcodes_view->setModel(list_schedcodes_model);
@@ -122,15 +122,20 @@ void ListSchedCodes::addData()
QString scode;
if(list_add_schedcode_dialog->exec(&scode)) {
QModelIndex index=list_schedcodes_model->addSchedCode(scode);
if(index.isValid()) {
list_schedcodes_view->selectRow(index.row());
if(list_edit_schedcode_dialog->exec(scode)) {
QModelIndex index=list_schedcodes_model->addSchedCode(scode);
if(index.isValid()) {
list_schedcodes_view->selectRow(index.row());
}
}
}
else {
QString sql=QString("delete from SCHED_CODES where ")+
"CODE=\""+RDEscapeString(scode)+"\"";
RDSqlQuery::apply(sql);
sql=QString("delete from RULE_LINES where ")+
"CODE=\""+RDEscapeString(scode)+"\"";
RDSqlQuery::apply(sql);
}
}
@@ -175,6 +180,10 @@ void ListSchedCodes::deleteData()
"SCHED_CODE=\""+RDEscapeString(codename)+"\"";
RDSqlQuery::apply(sql);
sql=QString("delete from RULE_LINES where ")+
"CODE=\""+RDEscapeString(codename)+"\"";
RDSqlQuery::apply(sql);
sql=QString("delete from SCHED_CODES where ")+
"CODE=\""+RDEscapeString(codename)+"\"";
RDSqlQuery::apply(sql);