2017-12-20 Fred Gleason <fredg@paravelsystems.com>

* Modified the behavior of the 'new' command in rdclilogedit(1) to
	match that of rdlogedit(1).
This commit is contained in:
Fred Gleason
2017-12-20 11:40:06 -05:00
parent 941aece664
commit 6b34f4d70e
4 changed files with 24 additions and 19 deletions

View File

@@ -16523,3 +16523,6 @@
* Added log locking logic to the voice tracker in rdlogedit(1). * Added log locking logic to the voice tracker in rdlogedit(1).
2017-12-20 Fred Gleason <fredg@paravelsystems.com> 2017-12-20 Fred Gleason <fredg@paravelsystems.com>
* Added log locking logic to rdclilogedit(1). * Added log locking logic to rdclilogedit(1).
2017-12-20 Fred Gleason <fredg@paravelsystems.com>
* Modified the behavior of the 'new' command in rdclilogedit(1) to
match that of rdlogedit(1).

View File

@@ -346,6 +346,9 @@ void MainObject::New(const QString &logname)
if(edit_log_event!=NULL) { if(edit_log_event!=NULL) {
delete edit_log_event; delete edit_log_event;
} }
if(edit_log_lock!=NULL) {
delete edit_log_lock;
}
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));
@@ -360,8 +363,14 @@ void MainObject::New(const QString &logname)
edit_end_date=QDate(); edit_end_date=QDate();
edit_purge_date=QDate(); edit_purge_date=QDate();
edit_auto_refresh=false; edit_auto_refresh=false;
edit_new_log=true; // edit_new_log=true;
edit_modified=false; edit_modified=false;
Saveas(edit_log->name());
edit_log_lock=new RDLogLock(edit_log->name(),edit_user,edit_station,this);
if(!TryLock(edit_log_lock,edit_log->name())) {
fprintf(stderr,"FATAL ERROR: unable to lock new log!\n");
exit(256);
}
} }
else { else {
fprintf(stderr,"new: log already exists\n"); fprintf(stderr,"new: log already exists\n");
@@ -378,21 +387,16 @@ void MainObject::Remove(int line)
void MainObject::Save() void MainObject::Save()
{ {
if(edit_new_log) { edit_log_event->save(edit_config);
Saveas(edit_log->name()); edit_log->setDescription(edit_description);
} edit_log->setStartDate(edit_start_date);
else { edit_log->setEndDate(edit_end_date);
edit_log_event->save(edit_config); edit_log->setPurgeDate(edit_purge_date);
edit_log->setDescription(edit_description); edit_log->setAutoRefresh(edit_auto_refresh);
edit_log->setStartDate(edit_start_date); edit_log->setService(edit_service);
edit_log->setEndDate(edit_end_date); edit_log->
edit_log->setPurgeDate(edit_purge_date); setModifiedDatetime(QDateTime(QDate::currentDate(),QTime::currentTime()));
edit_log->setAutoRefresh(edit_auto_refresh); edit_modified=false;
edit_log->setService(edit_service);
edit_log->
setModifiedDatetime(QDateTime(QDate::currentDate(),QTime::currentTime()));
edit_modified=false;
}
} }
@@ -424,7 +428,6 @@ void MainObject::Saveas(const QString &logname)
delete edit_log; delete edit_log;
edit_log=log; edit_log=log;
edit_modified=false; edit_modified=false;
edit_new_log=false;
} }
else { else {
fprintf(stderr,"saveas: log already exists\n"); fprintf(stderr,"saveas: log already exists\n");

View File

@@ -43,7 +43,6 @@ MainObject::MainObject(QObject *parent)
edit_log=NULL; edit_log=NULL;
edit_log_event=NULL; edit_log_event=NULL;
edit_modified=false; edit_modified=false;
edit_new_log=false;
edit_log_lock=NULL; edit_log_lock=NULL;
// //

View File

@@ -80,7 +80,7 @@ class MainObject : public QObject
bool edit_quiet_option; bool edit_quiet_option;
QString edit_accum; QString edit_accum;
bool edit_modified; bool edit_modified;
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_description;