From 02243805815b02d44adc41e211f05fafb3b1b684 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Wed, 20 Dec 2017 18:31:16 -0500 Subject: [PATCH] 2017-12-20 Fred Gleason * Cleaned up 'log in use" messages in rdlogedit(1) and rdclilogedit(1). --- ChangeLog | 3 +++ rdlogedit/edit_log.cpp | 10 ++++++---- utils/rdclilogedit/rdclilogedit.cpp | 10 +++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50b285a4..192f35fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16530,3 +16530,6 @@ * Added a 'LOGS.LOCK_GUID' field to the database. * Incremented the database version to 274. * Added a 'LockLog' call to the Web API. +2017-12-20 Fred Gleason + * Cleaned up 'log in use" messages in rdlogedit(1) and + rdclilogedit(1). diff --git a/rdlogedit/edit_log.cpp b/rdlogedit/edit_log.cpp index 3f1c5aa0..13f05a4d 100644 --- a/rdlogedit/edit_log.cpp +++ b/rdlogedit/edit_log.cpp @@ -649,10 +649,12 @@ int EditLog::exec() QHostAddress addr; if(!edit_log_lock->tryLock(&username,&stationname,&addr)) { - QMessageBox::warning(this,"RDLogEdit - "+tr("Log Locked"), - tr("Log already being edited by")+" "+ - username+"@"+stationname+" ["+ - addr.toString()+"]."); + QString msg=tr("Log already being edited by")+" "+username+"@"+stationname; + if(stationname!=addr.toString()) { + msg+=" ["+addr.toString()+"]"; + } + msg+="."; + QMessageBox::warning(this,"RDLogEdit - "+tr("Log Locked"),msg); return false; } diff --git a/utils/rdclilogedit/rdclilogedit.cpp b/utils/rdclilogedit/rdclilogedit.cpp index d81912fc..22e3061a 100644 --- a/utils/rdclilogedit/rdclilogedit.cpp +++ b/utils/rdclilogedit/rdclilogedit.cpp @@ -153,11 +153,11 @@ bool MainObject::TryLock(RDLogLock *lock,const QString &logname) ret=lock->tryLock(&username,&stationname,&addr); if(!ret) { - fprintf(stderr,"log \"%s\" in use by %s@%s [%s]\n", - (const char *)logname, - (const char *)username, - (const char *)stationname, - (const char *)addr.toString()); + QString msg="log \""+logname+"\" in use by "+username+"@"+stationname; + if(stationname!=addr.toString()) { + msg+=" ["+addr.toString()+"]"; + } + fprintf(stderr,"%s\n",(const char *)msg); } return ret; }