diff --git a/ChangeLog b/ChangeLog index cd4222a8..dde66ff2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16537,3 +16537,5 @@ * Added log locking logic to the 'SaveLog' Web API call. 2017-12-21 Fred Gleason * Added log locking logic to rdlogmanager(1). +2017-12-22 Fred Gleason + * Added a lock check for before deleting logs in rdlogedit(1). diff --git a/rdlogedit/rdlogedit.cpp b/rdlogedit/rdlogedit.cpp index 765e5090..3df0537d 100644 --- a/rdlogedit/rdlogedit.cpp +++ b/rdlogedit/rdlogedit.cpp @@ -40,25 +40,25 @@ #include #include +#include #include +#include +#include +#include #include +#include +#include +#include +#include #include #include -#include -//#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include "edit_log.h" +#include "globals.h" +#include "rdlogedit.h" #ifndef WIN32 -#include +#include "voice_tracker.h" #endif // WIN32 // @@ -531,17 +531,33 @@ void MainWidget::deleteData() } for(unsigned i=0;itext(1)); - if(log->remove(rdstation_conf,rduser,log_config)) { - delete items.at(i); + QString username; + QString stationname; + QHostAddress addr; + RDLogLock *log_lock=new RDLogLock(items.at(i)->text(1),rduser, + rdstation_conf,this); + if(log_lock->tryLock(&username,&stationname,&addr)) { + RDLog *log=new RDLog(items.at(i)->text(1)); + if(log->remove(rdstation_conf,rduser,log_config)) { + delete items.at(i); + } + else { + QMessageBox::warning(this,"RDLogEdit - "+tr("Error"), + tr("Unable to delete log")+" \""+ + items.at(i)->text(1)+"\", "+ + tr("audio deletion error!")); + } + delete log; } else { - QMessageBox::warning(this,"RDLogEdit - "+tr("Error"), - tr("Unable to delete log")+" \""+ - items.at(i)->text(1)+"\", "+ - tr("audio deletion error!")); + QString msg=tr("Log")+" "+items.at(i)->text(1)+"\" "+ + tr("is in use by")+" "+username+"@"+stationname; + if(stationname!=addr.toString()) { + msg+=" ["+addr.toString()+"]"; + } + QMessageBox::warning(this,"RDLogEdit - "+tr("Error"),msg); } - delete log; + delete log_lock; } } } diff --git a/rdlogedit/rdlogedit_cs.ts b/rdlogedit/rdlogedit_cs.ts index eb763303..2c521683 100644 --- a/rdlogedit/rdlogedit_cs.ts +++ b/rdlogedit/rdlogedit_cs.ts @@ -939,6 +939,14 @@ Vyhledejte svého správce systému kvůli aktualizaci! Windows + + Log + + + + is in use by + + RenderDialog diff --git a/rdlogedit/rdlogedit_de.ts b/rdlogedit/rdlogedit_de.ts index bfd9df1a..1e5048a5 100644 --- a/rdlogedit/rdlogedit_de.ts +++ b/rdlogedit/rdlogedit_de.ts @@ -938,6 +938,14 @@ See your system administrator for an update! Windows + + Log + + + + is in use by + + RenderDialog diff --git a/rdlogedit/rdlogedit_es.ts b/rdlogedit/rdlogedit_es.ts index d52f7ec6..f67ceb66 100644 --- a/rdlogedit/rdlogedit_es.ts +++ b/rdlogedit/rdlogedit_es.ts @@ -935,6 +935,14 @@ See your system administrator for an update! Windows + + Log + + + + is in use by + + RenderDialog diff --git a/rdlogedit/rdlogedit_fr.ts b/rdlogedit/rdlogedit_fr.ts index 6ff799e4..c172d309 100644 --- a/rdlogedit/rdlogedit_fr.ts +++ b/rdlogedit/rdlogedit_fr.ts @@ -851,6 +851,14 @@ See your system administrator for an update! Windows + + Log + + + + is in use by + + RenderDialog diff --git a/rdlogedit/rdlogedit_nb.ts b/rdlogedit/rdlogedit_nb.ts index d6640b3f..77780d34 100644 --- a/rdlogedit/rdlogedit_nb.ts +++ b/rdlogedit/rdlogedit_nb.ts @@ -956,6 +956,14 @@ See your system administrator for an update! Windows + + Log + + + + is in use by + + RenderDialog diff --git a/rdlogedit/rdlogedit_nn.ts b/rdlogedit/rdlogedit_nn.ts index d6640b3f..77780d34 100644 --- a/rdlogedit/rdlogedit_nn.ts +++ b/rdlogedit/rdlogedit_nn.ts @@ -956,6 +956,14 @@ See your system administrator for an update! Windows + + Log + + + + is in use by + + RenderDialog diff --git a/rdlogedit/rdlogedit_pt_BR.ts b/rdlogedit/rdlogedit_pt_BR.ts index 01916016..ffff457b 100644 --- a/rdlogedit/rdlogedit_pt_BR.ts +++ b/rdlogedit/rdlogedit_pt_BR.ts @@ -935,6 +935,14 @@ See your system administrator for an update! Windows + + Log + + + + is in use by + + RenderDialog