mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-12 07:35:55 +01:00
2016-07-21 Fred Gleason <fredg@paravelsystems.com>
* Added a 'setautorefresh' command to rdclilogedit(1). * Added a 'setdesc' command to rdclilogedit(1). * Added a 'setenddate' command to rdclilogedit(1). * Added a 'setpurgedate' command to rdclilogedit(1). * Added a 'setservice' command to rdclilogedit(1). * Added a 'setstartdate' command to rdclilogedit(1).
This commit is contained in:
@@ -15362,3 +15362,10 @@
|
|||||||
* Added a 'new' command to rdclilogedit(1).
|
* Added a 'new' command to rdclilogedit(1).
|
||||||
2016-07-21 Fred Gleason <fredg@paravelsystems.com>
|
2016-07-21 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Added a 'header' command to rdclilogedit(1).
|
* Added a 'header' command to rdclilogedit(1).
|
||||||
|
2016-07-21 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added a 'setautorefresh' command to rdclilogedit(1).
|
||||||
|
* Added a 'setdesc' command to rdclilogedit(1).
|
||||||
|
* Added a 'setenddate' command to rdclilogedit(1).
|
||||||
|
* Added a 'setpurgedate' command to rdclilogedit(1).
|
||||||
|
* Added a 'setservice' command to rdclilogedit(1).
|
||||||
|
* Added a 'setstartdate' command to rdclilogedit(1).
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
if(cmds.size()==1) {
|
if(cmds.size()==1) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("The following commands are available:\n");
|
printf("The following commands are available:\n");
|
||||||
printf("?, addcart, addchain, addmarker, addtrack, bye, exit, help, list, listlogs,\n");
|
printf("?, addcart, addchain, addmarker, addtrack, bye, exit, header, help, list,\n");
|
||||||
printf("load, new, quit, remove, save, saveas, setcart, setcomment, setlabel, settime\n");
|
printf("listlogs, listservices, load, new, quit, remove, save, saveas, setautorefresh,\n");
|
||||||
printf("settrans, unload\n");
|
printf("setcart, setcomment, setdesc, setenddate, setlabel, setpurgedate, setservice,\n");
|
||||||
|
printf("setstartdate, settime, settrans, unload\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Enter \"? <cmd-name>\" for specific help.\n");
|
printf("Enter \"? <cmd-name>\" for specific help.\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -85,6 +86,14 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
if(verb=="header") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" header\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Print the log's header data.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
if(verb=="listlogs") {
|
if(verb=="listlogs") {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" listlogs\n");
|
printf(" listlogs\n");
|
||||||
@@ -93,6 +102,14 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
if(verb=="listservices") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" listservices\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Print the list of Rivendell services.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
if(verb=="load") {
|
if(verb=="load") {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" load <log-name>\n");
|
printf(" load <log-name>\n");
|
||||||
@@ -133,6 +150,14 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
if(verb=="setautorefresh") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" setautorefresh yes|no\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Set the Auto Refresh flag on the log.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
if(verb=="setcart") {
|
if(verb=="setcart") {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" setcart <line> <cart-num>\n");
|
printf(" setcart <line> <cart-num>\n");
|
||||||
@@ -149,6 +174,23 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
if(verb=="setdesc") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" setdesc <str>\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Set the log Description to <str>.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
if(verb=="setenddate") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" setenddate [<date>]\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Set the End Date of the log to <date> (YYYY-MM-DD format).\n");
|
||||||
|
printf("To clear the End Date, leave <date> blank.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
if(verb=="setlabel") {
|
if(verb=="setlabel") {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" setlabel <line> <str>\n");
|
printf(" setlabel <line> <str>\n");
|
||||||
@@ -157,6 +199,33 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
if(verb=="setpurgedate") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" setpurgedate [<date>]\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Set the Purge Date of the log to <date> (YYYY-MM-DD format).\n");
|
||||||
|
printf("To clear the Purge Date, leave <date> blank.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
if(verb=="setservice") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" setservice <str>\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Set the log's owning Service to <str>.\n");
|
||||||
|
printf("(For a list of valid Service names, do \"listservices\").\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
if(verb=="setstartdate") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" setstartdate [<date>]\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Set the Start Date of the log to <date> (YYYY-MM-DD format).\n");
|
||||||
|
printf("To clear the Start Date, leave <date> blank.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
if(verb=="settime") {
|
if(verb=="settime") {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" settime <line> hard|none <time>\n");
|
printf(" settime <line> hard|none <time>\n");
|
||||||
|
|||||||
@@ -88,38 +88,47 @@ void MainObject::Addtrack(int line)
|
|||||||
|
|
||||||
void MainObject::Header() const
|
void MainObject::Header() const
|
||||||
{
|
{
|
||||||
printf(" Description: %s\n",(const char *)edit_log->description());
|
printf(" Description: %s\n",(const char *)edit_description);
|
||||||
printf(" Service: %s\n",(const char *)edit_log->service());
|
printf(" Service: %s\n",(const char *)edit_service);
|
||||||
if(edit_log->autoRefresh()) {
|
if(edit_auto_refresh) {
|
||||||
printf("Auto Refresh: Yes\n");
|
printf("Auto Refresh: Yes\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("Auto Refresh: No\n");
|
printf("Auto Refresh: No\n");
|
||||||
}
|
}
|
||||||
if(edit_log->startDate().isNull()) {
|
if(edit_start_date.isNull()) {
|
||||||
printf(" Start Date: None\n");
|
printf(" Start Date: None\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(" Start Date: %s\n",
|
printf(" Start Date: %s\n",
|
||||||
(const char *)edit_log->startDate().toString("yyyy-MM-dd"));
|
(const char *)edit_start_date.toString("yyyy-MM-dd"));
|
||||||
}
|
}
|
||||||
if(edit_log->endDate().isNull()) {
|
if(edit_end_date.isNull()) {
|
||||||
printf(" End Date: None\n");
|
printf(" End Date: None\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(" End Date: %s\n",
|
printf(" End Date: %s\n",
|
||||||
(const char *)edit_log->endDate().toString("yyyy-MM-dd"));
|
(const char *)edit_end_date.toString("yyyy-MM-dd"));
|
||||||
}
|
}
|
||||||
if(edit_log->purgeDate().isNull()) {
|
if(edit_purge_date.isNull()) {
|
||||||
printf(" Purge Date: None\n");
|
printf(" Purge Date: None\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(" Purge Date: %s\n",
|
printf(" Purge Date: %s\n",
|
||||||
(const char *)edit_log->purgeDate().toString("yyyy-MM-dd"));
|
(const char *)edit_purge_date.toString("yyyy-MM-dd"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::List()
|
||||||
|
{
|
||||||
|
for(int i=0;i<edit_log_event->size();i++) {
|
||||||
|
printf("%4d %s\n",i,(const char *)ListLine(edit_log_event,i));
|
||||||
|
}
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::ListLogs() const
|
void MainObject::ListLogs() const
|
||||||
{
|
{
|
||||||
QString sql;
|
QString sql;
|
||||||
@@ -134,6 +143,20 @@ void MainObject::ListLogs() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Listservices() const
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
|
||||||
|
sql=QString("select NAME from SERVICES order by NAME");
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
while(q->next()) {
|
||||||
|
printf("%s\n",(const char *)q->value(0).toString());
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::Load(const QString &logname)
|
void MainObject::Load(const QString &logname)
|
||||||
{
|
{
|
||||||
if(edit_log!=NULL) {
|
if(edit_log!=NULL) {
|
||||||
@@ -148,6 +171,12 @@ void MainObject::Load(const QString &logname)
|
|||||||
if(edit_log->exists()) {
|
if(edit_log->exists()) {
|
||||||
edit_log_event=new RDLogEvent(RDLog::tableName(logname));
|
edit_log_event=new RDLogEvent(RDLog::tableName(logname));
|
||||||
edit_log_event->load();
|
edit_log_event->load();
|
||||||
|
edit_description=edit_log->description();
|
||||||
|
edit_service=edit_log->service();
|
||||||
|
edit_start_date=edit_log->startDate();
|
||||||
|
edit_end_date=edit_log->endDate();
|
||||||
|
edit_purge_date=edit_log->purgeDate();
|
||||||
|
edit_auto_refresh=edit_log->autoRefresh();
|
||||||
edit_modified=false;
|
edit_modified=false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -158,15 +187,6 @@ void MainObject::Load(const QString &logname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::List()
|
|
||||||
{
|
|
||||||
for(int i=0;i<edit_log_event->size();i++) {
|
|
||||||
printf("%4d %s\n",i,(const char *)ListLine(edit_log_event,i));
|
|
||||||
}
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString MainObject::ListLine(RDLogEvent *evt,int line) const
|
QString MainObject::ListLine(RDLogEvent *evt,int line) const
|
||||||
{
|
{
|
||||||
QString ret="";
|
QString ret="";
|
||||||
@@ -247,6 +267,9 @@ QString MainObject::ListLine(RDLogEvent *evt,int line) const
|
|||||||
|
|
||||||
void MainObject::New(const QString &logname)
|
void MainObject::New(const QString &logname)
|
||||||
{
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
|
||||||
if(edit_log!=NULL) {
|
if(edit_log!=NULL) {
|
||||||
delete edit_log;
|
delete edit_log;
|
||||||
}
|
}
|
||||||
@@ -256,6 +279,17 @@ void MainObject::New(const QString &logname)
|
|||||||
edit_log=new RDLog(logname);
|
edit_log=new RDLog(logname);
|
||||||
if(!edit_log->exists()) {
|
if(!edit_log->exists()) {
|
||||||
edit_log_event=new RDLogEvent(RDLog::tableName(logname));
|
edit_log_event=new RDLogEvent(RDLog::tableName(logname));
|
||||||
|
edit_description=logname+" log";
|
||||||
|
sql=QString("select NAME from SERVICES");
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
if(q->first()) {
|
||||||
|
edit_service=q->value(0).toString();
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
edit_start_date=QDate();
|
||||||
|
edit_end_date=QDate();
|
||||||
|
edit_purge_date=QDate();
|
||||||
|
edit_auto_refresh=false;
|
||||||
edit_new_log=true;
|
edit_new_log=true;
|
||||||
edit_modified=false;
|
edit_modified=false;
|
||||||
}
|
}
|
||||||
@@ -279,6 +313,12 @@ void MainObject::Save()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
edit_log_event->save();
|
edit_log_event->save();
|
||||||
|
edit_log->setDescription(edit_description);
|
||||||
|
edit_log->setStartDate(edit_start_date);
|
||||||
|
edit_log->setEndDate(edit_end_date);
|
||||||
|
edit_log->setPurgeDate(edit_purge_date);
|
||||||
|
edit_log->setAutoRefresh(edit_auto_refresh);
|
||||||
|
edit_log->setService(edit_service);
|
||||||
edit_log->
|
edit_log->
|
||||||
setModifiedDatetime(QDateTime(QDate::currentDate(),QTime::currentTime()));
|
setModifiedDatetime(QDateTime(QDate::currentDate(),QTime::currentTime()));
|
||||||
edit_modified=false;
|
edit_modified=false;
|
||||||
@@ -293,33 +333,19 @@ void MainObject::Saveas(const QString &logname)
|
|||||||
|
|
||||||
RDLog *log=new RDLog(logname);
|
RDLog *log=new RDLog(logname);
|
||||||
if(!log->exists()) {
|
if(!log->exists()) {
|
||||||
if(edit_log->exists()) {
|
sql=QString("insert into LOGS set ")+
|
||||||
sql=QString("insert into LOGS set ")+
|
"NAME=\""+RDEscapeString(logname)+"\","+
|
||||||
"NAME=\""+RDEscapeString(logname)+"\","+
|
"TYPE=0,"+
|
||||||
"TYPE=0,"+
|
"DESCRIPTION=\""+RDEscapeString(edit_description)+"\","+
|
||||||
"DESCRIPTION=\""+"Copy of "+RDEscapeString(edit_log->name())+"\","+
|
"ORIGIN_USER=\""+RDEscapeString(edit_user->name())+"\","+
|
||||||
"ORIGIN_USER=\""+RDEscapeString(edit_user->name())+"\","+
|
"ORIGIN_DATETIME=now(),"+
|
||||||
"ORIGIN_DATETIME=now(),"+
|
"LINK_DATETIME=now(),"+
|
||||||
"LINK_DATETIME=now(),"+
|
"MODIFIED_DATETIME=now(),"+
|
||||||
"MODIFIED_DATETIME=now(),"+
|
"START_DATE="+RDCheckDateTime(edit_start_date,"yyyy-MM-dd")+","+
|
||||||
"SERVICE=\""+edit_log->service()+"\"";
|
"END_DATE="+RDCheckDateTime(edit_end_date,"yyyy-MM-dd")+","+
|
||||||
}
|
"PURGE_DATE="+RDCheckDateTime(edit_purge_date,"yyyy-MM-dd")+","+
|
||||||
else {
|
"AUTO_REFRESH=\""+RDYesNo(edit_auto_refresh)+"\","+
|
||||||
sql=QString("select NAME from SERVICES");
|
"SERVICE=\""+RDEscapeString(edit_service)+"\"";
|
||||||
q=new RDSqlQuery(sql);
|
|
||||||
if(q->first()) {
|
|
||||||
sql=QString("insert into LOGS set ")+
|
|
||||||
"NAME=\""+RDEscapeString(logname)+"\","+
|
|
||||||
"TYPE=0,"+
|
|
||||||
"DESCRIPTION=\""+RDEscapeString(logname+" log")+"\","+
|
|
||||||
"ORIGIN_USER=\""+RDEscapeString(edit_user->name())+"\","+
|
|
||||||
"ORIGIN_DATETIME=now(),"+
|
|
||||||
"LINK_DATETIME=now(),"+
|
|
||||||
"MODIFIED_DATETIME=now(),"+
|
|
||||||
"SERVICE=\""+RDEscapeString(q->value(0).toString())+"\"";
|
|
||||||
}
|
|
||||||
delete q;
|
|
||||||
}
|
|
||||||
q=new RDSqlQuery(sql);
|
q=new RDSqlQuery(sql);
|
||||||
delete q;
|
delete q;
|
||||||
RDCreateLogTable(RDLog::tableName(logname));
|
RDCreateLogTable(RDLog::tableName(logname));
|
||||||
@@ -337,6 +363,13 @@ void MainObject::Saveas(const QString &logname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Setautorefresh(bool state)
|
||||||
|
{
|
||||||
|
edit_auto_refresh=state;
|
||||||
|
edit_modified=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::Setcart(int line,unsigned cartnum)
|
void MainObject::Setcart(int line,unsigned cartnum)
|
||||||
{
|
{
|
||||||
RDLogLine *logline=edit_log_event->logLine(line);
|
RDLogLine *logline=edit_log_event->logLine(line);
|
||||||
@@ -377,6 +410,20 @@ void MainObject::Setcomment(int line,const QString &str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Setdesc(const QString &str)
|
||||||
|
{
|
||||||
|
edit_description=str;
|
||||||
|
edit_modified=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Setenddate(const QDate &date)
|
||||||
|
{
|
||||||
|
edit_end_date=date;
|
||||||
|
edit_modified=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::Setlabel(int line,const QString &str)
|
void MainObject::Setlabel(int line,const QString &str)
|
||||||
{
|
{
|
||||||
RDLogLine *logline=edit_log_event->logLine(line);
|
RDLogLine *logline=edit_log_event->logLine(line);
|
||||||
@@ -397,6 +444,28 @@ void MainObject::Setlabel(int line,const QString &str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Setpurgedate(const QDate &date)
|
||||||
|
{
|
||||||
|
edit_purge_date=date;
|
||||||
|
edit_modified=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Setservice(const QString &str)
|
||||||
|
{
|
||||||
|
RDLog *log=new RDLog(str);
|
||||||
|
if(log->exists()) {
|
||||||
|
edit_service=str;
|
||||||
|
edit_modified=true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setservice: no such service\n");
|
||||||
|
fprintf(stderr,"(Do \"listservices\" for a list\n");
|
||||||
|
}
|
||||||
|
delete log;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::Settime(int line,RDLogLine::TimeType type,const QTime &time)
|
void MainObject::Settime(int line,RDLogLine::TimeType type,const QTime &time)
|
||||||
{
|
{
|
||||||
edit_log_event->logLine(line)->setTimeType(type);
|
edit_log_event->logLine(line)->setTimeType(type);
|
||||||
@@ -413,6 +482,13 @@ void MainObject::Settrans(int line,RDLogLine::TransType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Setstartdate(const QDate &date)
|
||||||
|
{
|
||||||
|
edit_start_date=date;
|
||||||
|
edit_modified=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::Unload()
|
void MainObject::Unload()
|
||||||
{
|
{
|
||||||
if(edit_log!=NULL) {
|
if(edit_log!=NULL) {
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ void MainObject::DispatchCommand(QString cmd)
|
|||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(verb=="listservices") {
|
||||||
|
Listservices();
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
if(verb=="load") {
|
if(verb=="load") {
|
||||||
if(overwrite) {
|
if(overwrite) {
|
||||||
if(cmds.size()==2) {
|
if(cmds.size()==2) {
|
||||||
@@ -249,6 +254,33 @@ void MainObject::DispatchCommand(QString cmd)
|
|||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(verb=="setautorefresh") {
|
||||||
|
if(edit_user->arrangeLog()) {
|
||||||
|
if(cmds.size()==2) {
|
||||||
|
QString arg=cmds[1].lower();
|
||||||
|
if((arg=="yes")||(arg=="true")||(arg=="y")) {
|
||||||
|
Setautorefresh(true);
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
if((arg=="no")||(arg=="false")||(arg=="n")) {
|
||||||
|
Setautorefresh(false);
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
if(!processed) {
|
||||||
|
fprintf(stderr,"setautorefresh: invalid command argument\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setautorefresh: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"setautorefresh: insufficient privileges [Rearrange Log Items]\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
if(verb=="setcart") {
|
if(verb=="setcart") {
|
||||||
if(edit_user->arrangeLog()) {
|
if(edit_user->arrangeLog()) {
|
||||||
if(cmds.size()==3) {
|
if(cmds.size()==3) {
|
||||||
@@ -301,6 +333,50 @@ void MainObject::DispatchCommand(QString cmd)
|
|||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(verb=="setdesc") {
|
||||||
|
if(edit_user->arrangeLog()) {
|
||||||
|
if(cmds.size()>=2) {
|
||||||
|
cmds.erase(cmds.begin());
|
||||||
|
Setdesc(cmds.join(" "));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setdesc: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"setdesc: insufficient privileges [Rearrange Log Items]\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(verb=="setenddate") {
|
||||||
|
if(edit_user->arrangeLog()) {
|
||||||
|
if(cmds.size()==1) {
|
||||||
|
Setenddate(QDate());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(cmds.size()==2) {
|
||||||
|
QDate date=QDate::fromString(cmds[1],Qt::ISODate);
|
||||||
|
if(date.isValid()) {
|
||||||
|
Setenddate(date);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setenddate: invalid date format\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setenddate: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"setenddate: insufficient privileges [Rearrange Log Items]\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
if(verb=="setlabel") {
|
if(verb=="setlabel") {
|
||||||
if(edit_user->arrangeLog()) {
|
if(edit_user->arrangeLog()) {
|
||||||
if(cmds.size()==3) {
|
if(cmds.size()==3) {
|
||||||
@@ -323,6 +399,76 @@ void MainObject::DispatchCommand(QString cmd)
|
|||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(verb=="setpurgedate") {
|
||||||
|
if(edit_user->arrangeLog()) {
|
||||||
|
if(cmds.size()==1) {
|
||||||
|
Setpurgedate(QDate());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(cmds.size()==2) {
|
||||||
|
QDate date=QDate::fromString(cmds[1],Qt::ISODate);
|
||||||
|
if(date.isValid()) {
|
||||||
|
Setpurgedate(date);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setpurgedate: invalid date format\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setpurgedate: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"setpurgedate: insufficient privileges [Rearrange Log Items]\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(verb=="setservice") {
|
||||||
|
if(edit_user->arrangeLog()) {
|
||||||
|
if(cmds.size()==2) {
|
||||||
|
Setservice(cmds[1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setservice: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"setservice: insufficient privileges [Rearrange Log Items]\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(verb=="setstartdate") {
|
||||||
|
if(edit_user->arrangeLog()) {
|
||||||
|
if(cmds.size()==1) {
|
||||||
|
Setstartdate(QDate());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(cmds.size()==2) {
|
||||||
|
QDate date=QDate::fromString(cmds[1],Qt::ISODate);
|
||||||
|
if(date.isValid()) {
|
||||||
|
Setstartdate(date);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setstartdate: invalid date format\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"setstartdate: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"setstartdate: insufficient privileges [Rearrange Log Items]\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
if(verb=="settime") {
|
if(verb=="settime") {
|
||||||
if(edit_user->arrangeLog()) {
|
if(edit_user->arrangeLog()) {
|
||||||
if(cmds.size()>=3) {
|
if(cmds.size()>=3) {
|
||||||
|
|||||||
@@ -50,16 +50,23 @@ class MainObject : public QObject
|
|||||||
void Addtrack(int line);
|
void Addtrack(int line);
|
||||||
void Header() const;
|
void Header() const;
|
||||||
void Help(const QStringList &cmds) const;
|
void Help(const QStringList &cmds) const;
|
||||||
void ListLogs() const;
|
|
||||||
void Load(const QString &logname);
|
|
||||||
void List();
|
void List();
|
||||||
|
void ListLogs() const;
|
||||||
|
void Listservices() const;
|
||||||
|
void Load(const QString &logname);
|
||||||
void New(const QString &logname);
|
void New(const QString &logname);
|
||||||
void Remove(int line);
|
void Remove(int line);
|
||||||
void Save();
|
void Save();
|
||||||
void Saveas(const QString &logname);
|
void Saveas(const QString &logname);
|
||||||
|
void Setautorefresh(bool state);
|
||||||
void Setcart(int line,unsigned cartnum);
|
void Setcart(int line,unsigned cartnum);
|
||||||
void Setcomment(int line,const QString &str);
|
void Setcomment(int line,const QString &str);
|
||||||
|
void Setdesc(const QString &str);
|
||||||
|
void Setenddate(const QDate &date);
|
||||||
void Setlabel(int line,const QString &str);
|
void Setlabel(int line,const QString &str);
|
||||||
|
void Setpurgedate(const QDate &date);
|
||||||
|
void Setservice(const QString &str);
|
||||||
|
void Setstartdate(const QDate &date);
|
||||||
void Settime(int line,RDLogLine::TimeType type,const QTime &time=QTime());
|
void Settime(int line,RDLogLine::TimeType type,const QTime &time=QTime());
|
||||||
void Settrans(int line,RDLogLine::TransType type);
|
void Settrans(int line,RDLogLine::TransType type);
|
||||||
void Unload();
|
void Unload();
|
||||||
@@ -72,6 +79,12 @@ class MainObject : public QObject
|
|||||||
bool edit_new_log;
|
bool edit_new_log;
|
||||||
RDLog *edit_log;
|
RDLog *edit_log;
|
||||||
RDLogEvent *edit_log_event;
|
RDLogEvent *edit_log_event;
|
||||||
|
QString edit_description;
|
||||||
|
QString edit_service;
|
||||||
|
QDate edit_start_date;
|
||||||
|
QDate edit_end_date;
|
||||||
|
QDate edit_purge_date;
|
||||||
|
bool edit_auto_refresh;
|
||||||
RDUser *edit_user;
|
RDUser *edit_user;
|
||||||
RDRipc *edit_ripc;
|
RDRipc *edit_ripc;
|
||||||
RDAirPlayConf *edit_airplay_conf;
|
RDAirPlayConf *edit_airplay_conf;
|
||||||
|
|||||||
Reference in New Issue
Block a user