mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-14 22:51:13 +02:00
2019-12-10 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDTextViewer()' function. * Added the ability to view a report at time of generation in rdlogmanager(1).
This commit is contained in:
@@ -81,3 +81,41 @@ bool RDTextFile(const QString &data,bool delete_on_exit)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDTextViewer(const QString &filename)
|
||||
{
|
||||
QString editor=RD_LINUX_EDITOR;
|
||||
char cmd[PATH_MAX];
|
||||
char *args[64];
|
||||
|
||||
if(!rda->station()->reportEditorPath().trimmed().isEmpty()) {
|
||||
editor=rda->station()->reportEditorPath();
|
||||
}
|
||||
memset(args,0,sizeof(args));
|
||||
QStringList f0=editor.split(" ",QString::SkipEmptyParts);
|
||||
if(f0.size()>64) {
|
||||
QMessageBox::warning(NULL,"File Error",
|
||||
"Too many arguments to report editor!");
|
||||
return false;
|
||||
}
|
||||
strncpy(cmd,f0.at(0).toUtf8(),PATH_MAX);
|
||||
QStringList f1=f0.at(0).split("/");
|
||||
args[0]=(char *)malloc(f1.back().toUtf8().size()+1);
|
||||
strcpy(args[0],f1.back().toUtf8());
|
||||
for(int i=1;i<f0.size();i++) {
|
||||
args[i]=(char *)malloc(f0.at(i).toUtf8().size()+1);
|
||||
strcpy(args[i],f0.at(i).toUtf8());
|
||||
}
|
||||
|
||||
args[f0.size()]=(char *)malloc(filename.toUtf8().length()+1);
|
||||
strcpy(args[f0.size()],filename.toUtf8());
|
||||
|
||||
args[f0.size()+1]=(char *)NULL;
|
||||
|
||||
if(fork()==0) {
|
||||
execvp(cmd,args);
|
||||
_exit(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <qstring.h>
|
||||
|
||||
bool RDTextFile(const QString &data,bool delete_on_exit=true);
|
||||
bool RDTextViewer(const QString &filename);
|
||||
|
||||
|
||||
#endif // RDTEXTFILE_H
|
||||
|
Reference in New Issue
Block a user