mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-11 15:16:07 +01:00
2020-02-02 Fred Gleason <fredg@paravelsystems.com>
* Added a 'STATIONS.BROWSER_PATH' field to the database. * Incremented the database version to 314. * Added a 'Web Browser' control to the 'Edit Host' dialog in rdadmin(1). * Added a MusicBrainz record lookup button to the full disc ripper in rdlibrary(1). * Added a MusicBrainz record lookup button to the disc track ripper in rdlibrary(1).
This commit is contained in:
@@ -119,3 +119,44 @@ bool RDTextViewer(const QString &filename)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDWebBrowser(const QString &url)
|
||||
{
|
||||
QString editor=RD_LINUX_EDITOR;
|
||||
char cmd[PATH_MAX];
|
||||
char *args[64];
|
||||
|
||||
editor=rda->station()->browserPath();
|
||||
if(editor.isEmpty()) {
|
||||
QMessageBox::warning(NULL,"Error",
|
||||
"No web browser configured!");
|
||||
return false;
|
||||
}
|
||||
memset(args,0,sizeof(args));
|
||||
QStringList f0=editor.split(" ",QString::SkipEmptyParts);
|
||||
if(f0.size()>64) {
|
||||
QMessageBox::warning(NULL,"Error",
|
||||
"Too many arguments to web browser!");
|
||||
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(url.toUtf8().length()+1);
|
||||
strcpy(args[f0.size()],url.toUtf8());
|
||||
|
||||
args[f0.size()+1]=(char *)NULL;
|
||||
|
||||
if(fork()==0) {
|
||||
execvp(cmd,args);
|
||||
_exit(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user