urlencode file name before executing ext app with url param

This commit is contained in:
dockes 2006-04-01 08:07:43 +00:00
parent 5513fb5dd8
commit 6bf34cbf92

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.15 2006-03-31 17:19:45 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.16 2006-04-01 08:07:43 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -419,6 +419,7 @@ void RclMain::startNativeViewer(int docnum)
} }
string fn = urltolocalpath(doc.url); string fn = urltolocalpath(doc.url);
string url = url_encode(doc.url, 7);
// Substitute %u (url) and %f (file name) inside prototype command // Substitute %u (url) and %f (file name) inside prototype command
string ncmd; string ncmd;
@ -432,7 +433,7 @@ void RclMain::startNativeViewer(int docnum)
if (*it1 == '%') if (*it1 == '%')
ncmd += '%'; ncmd += '%';
if (*it1 == 'u') if (*it1 == 'u')
ncmd += "'" + doc.url + "'"; ncmd += "'" + url + "'";
if (*it1 == 'f') if (*it1 == 'f')
ncmd += "'" + fn + "'"; ncmd += "'" + fn + "'";
} else { } else {
@ -443,10 +444,12 @@ void RclMain::startNativeViewer(int docnum)
ncmd += " &"; ncmd += " &";
QStatusBar *stb = statusBar(); QStatusBar *stb = statusBar();
if (stb) { if (stb) {
QString msg = tr("Executing: [") + ncmd.c_str() + "]"; string fcharset = rclconfig->getDefCharset(true);
string prcmd;
transcode(ncmd, prcmd, fcharset, "UTF-8");
QString msg = tr("Executing: [") +
QString::fromUtf8(prcmd.c_str()) + "]";
stb->message(msg, 5000); stb->message(msg, 5000);
stb->repaint(false);
XFlush(qt_xdisplay());
} }
m_history->enterDocument(fn, doc.ipath); m_history->enterDocument(fn, doc.ipath);
system(ncmd.c_str()); system(ncmd.c_str());