|
@@ -14,7 +14,8 @@
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
// along with wkhtmltopdf. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
-#include "commandlineparser_p.hh"
|
|
|
+#include "commandlineparser.hh"
|
|
|
+#include "arghandler.inl"
|
|
|
#include <QFile>
|
|
|
#include "pageconverter.hh"
|
|
|
#include <qglobal.h>
|
|
@@ -72,190 +73,7 @@
|
|
|
Implementation details for CommandLineParser
|
|
|
*/
|
|
|
|
|
|
-
|
|
|
-template <typename T> class DstArgHandler: public ArgHandler {
|
|
|
-public:
|
|
|
- T & dst;
|
|
|
- DstArgHandler(T & d): dst(d) {};
|
|
|
-
|
|
|
- T & realDst(CommandLineParserPrivate & cp, Page & ps) {
|
|
|
- //Very very ugly hack, when the setting is within the page settisgs offset
|
|
|
- //Dummy struct return its location within the supplied page settings
|
|
|
- //The dest is within the fake page offset struct
|
|
|
-
|
|
|
- char * d = reinterpret_cast<char *>(&dst);
|
|
|
- char * od = reinterpret_cast<char *>(&cp.od);
|
|
|
- if(od > d || d >= od + sizeof(Page)) return dst;
|
|
|
- return * reinterpret_cast<T*>(d - od + reinterpret_cast<char *>(&ps));
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-/*!
|
|
|
- Sets a variable to some constant
|
|
|
-*/
|
|
|
-template <typename T> class ConstSetter: public DstArgHandler<T> {
|
|
|
-public:
|
|
|
- typedef DstArgHandler<T> p_t;
|
|
|
- const T src;
|
|
|
- ConstSetter(T & arg, const T s): p_t(arg), src(s) {};
|
|
|
- bool operator() (const char **, CommandLineParserPrivate & cp, Page & ps) {
|
|
|
- p_t::realDst(cp,ps)=src;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- virtual QString getDesc() const {
|
|
|
- if (src != p_t::dst) return p_t::desc;
|
|
|
- return p_t::desc + " (default)";
|
|
|
- }
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-struct StringPairCreator {
|
|
|
- typedef QPair<QString, QString> T;
|
|
|
- inline T operator()(const QString & key, const QString & value) const {
|
|
|
- return T(key, value);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-template <bool file>
|
|
|
-struct PostItemCreator {
|
|
|
- typedef PostItem T;
|
|
|
- inline T operator()(const QString & key, const QString & value) const {
|
|
|
- T p;
|
|
|
- p.name = key;
|
|
|
- p.value = value;
|
|
|
- p.file = file;
|
|
|
- return p;
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-struct StringListSetter: public DstArgHandler<QList<QString> > {
|
|
|
- typedef DstArgHandler<QList<QString> > p_t;
|
|
|
- StringListSetter(QList<QString> & a, QString valueName) : p_t (a) {
|
|
|
- p_t::argn.push_back(valueName);
|
|
|
- }
|
|
|
- virtual bool operator() (const char ** args, CommandLineParserPrivate & cp, Page & ps) {
|
|
|
- p_t::realDst(cp, ps).append( args[0] );
|
|
|
- return true;
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-/*!
|
|
|
- Putting values into a map
|
|
|
-*/
|
|
|
-template <typename T=StringPairCreator>
|
|
|
-struct MapSetter: public DstArgHandler< QList< typename T::T > > {
|
|
|
- typedef DstArgHandler< QList< typename T::T > > p_t;
|
|
|
- MapSetter(QList<typename T::T > & a, QString keyName, QString valueName) : p_t(a) {
|
|
|
- p_t::argn.push_back(keyName);
|
|
|
- p_t::argn.push_back(valueName);
|
|
|
- }
|
|
|
- virtual bool operator() (const char ** args, CommandLineParserPrivate & cp, Page & ps) {
|
|
|
- p_t::realDst(cp, ps).append( T()(args[0], args[1]) );
|
|
|
- return true;
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-/*!
|
|
|
- SomeSetter template method base
|
|
|
-*/
|
|
|
-template <typename TT>
|
|
|
-struct SomeSetterTM {
|
|
|
- typedef TT T;
|
|
|
- //T strToT(const char * val, bool & ok);
|
|
|
- static QString TToStr(const T &, bool & ok) {ok=false; return "";}
|
|
|
-};
|
|
|
-
|
|
|
-/*!
|
|
|
- TemplateMethod class used to set a single variable of some type TT::T
|
|
|
-*/
|
|
|
-template <typename TT>
|
|
|
-struct SomeSetter: public DstArgHandler< typename TT::T > {
|
|
|
- typedef DstArgHandler< typename TT::T > p_t;
|
|
|
- typedef typename TT::T T;
|
|
|
- bool hasDef;
|
|
|
-
|
|
|
- SomeSetter(T & a, QString an, bool def=true): p_t(a), hasDef(def) {
|
|
|
- p_t::argn.push_back(an);
|
|
|
- }
|
|
|
-
|
|
|
- bool operator() (const char ** vals, CommandLineParserPrivate & cp, Page & ps) {
|
|
|
- bool ok;
|
|
|
- p_t::realDst(cp, ps) = TT::strToT(vals[0], ok);
|
|
|
- return ok;
|
|
|
- }
|
|
|
-
|
|
|
- virtual QString getDesc() const {
|
|
|
- if (!hasDef) return p_t::desc;
|
|
|
- bool ok;
|
|
|
- QString x = TT::TToStr(p_t::dst, ok);
|
|
|
- if (!ok) return p_t::desc;
|
|
|
- return p_t::desc + " (default " + x + ")";
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-struct IntTM: public SomeSetterTM<int> {
|
|
|
- static int strToT(const char * val, bool & ok) {
|
|
|
- return QString(val).toInt(&ok);
|
|
|
- }
|
|
|
- static QString TToStr(const int & t, bool & ok) {
|
|
|
- ok=(t!=-1);
|
|
|
- return QString::number(t);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-/*!
|
|
|
- Argument handler setting an int variable
|
|
|
-*/
|
|
|
-typedef SomeSetter<IntTM> IntSetter;
|
|
|
-
|
|
|
-struct FloatTM: public SomeSetterTM<float> {
|
|
|
- static float strToT(const char * val, bool & ok) {
|
|
|
- return QString(val).toFloat(&ok);
|
|
|
- }
|
|
|
- static QString TToStr(const float & t, bool & ok) {
|
|
|
- ok=(t!=-1);
|
|
|
- return QString::number(t);
|
|
|
- }
|
|
|
-};
|
|
|
-/*!
|
|
|
- Argument handler setting an float variable
|
|
|
-*/
|
|
|
-typedef SomeSetter<FloatTM> FloatSetter;
|
|
|
-
|
|
|
-struct StrTM: public SomeSetterTM<const char *> {
|
|
|
- static const char * strToT(const char * val, bool & ok) {
|
|
|
- ok=true;
|
|
|
- return val;
|
|
|
- }
|
|
|
- static QString TToStr(const char * t, bool & ok) {
|
|
|
- ok = (t[0] != '\0');
|
|
|
- return QString(t);
|
|
|
- }
|
|
|
-};
|
|
|
-/*!
|
|
|
- Argument handler setting a string variable
|
|
|
-*/
|
|
|
-typedef SomeSetter<StrTM> StrSetter;
|
|
|
-
|
|
|
-struct QStrTM: public SomeSetterTM<QString> {
|
|
|
- static QString strToT(const char * val, bool & ok) {
|
|
|
- ok=true;
|
|
|
- return QString::fromLocal8Bit(val);
|
|
|
- }
|
|
|
- static QString TToStr(const QString & t, bool & ok) {
|
|
|
- ok=!t.isEmpty();
|
|
|
- return t;
|
|
|
- }
|
|
|
-};
|
|
|
-/*!
|
|
|
- Argument handler setting a string variable
|
|
|
-*/
|
|
|
-typedef SomeSetter<QStrTM> QStrSetter;
|
|
|
+using namespace wkhtmltopdf::settings;
|
|
|
|
|
|
struct UnitRealTM: public SomeSetterTM<UnitReal> {
|
|
|
static UnitReal strToT(const char * val, bool &ok) {
|
|
@@ -284,16 +102,6 @@ struct PageSizeTM: public SomeSetterTM<QPrinter::PageSize> {
|
|
|
*/
|
|
|
typedef SomeSetter<PageSizeTM> PageSizeSetter;
|
|
|
|
|
|
-struct ProxyTM: public SomeSetterTM<Proxy> {
|
|
|
- static Proxy strToT(const char * val, bool &ok) {
|
|
|
- return strToProxy(val, &ok);
|
|
|
- }
|
|
|
-};
|
|
|
-/*!
|
|
|
- Argument handler setting a proxy variable
|
|
|
- */
|
|
|
-typedef SomeSetter<ProxyTM> ProxySetter;
|
|
|
-
|
|
|
struct OrientationTM: public SomeSetterTM<QPrinter::Orientation> {
|
|
|
static QPrinter::Orientation strToT(const char * val, bool &ok) {
|
|
|
return strToOrientation(val, &ok);
|
|
@@ -308,48 +116,8 @@ struct OrientationTM: public SomeSetterTM<QPrinter::Orientation> {
|
|
|
*/
|
|
|
typedef SomeSetter<OrientationTM> OrientationSetter;
|
|
|
|
|
|
-
|
|
|
-struct LoadErrorHandlingTM: public SomeSetterTM<Page::LoadErrorHandling> {
|
|
|
- static Page::LoadErrorHandling strToT(const char * val, bool &ok) {
|
|
|
- return strToLoadErrorHandling(val, &ok);
|
|
|
- }
|
|
|
- static QString TToStr(const Page::LoadErrorHandling & o, bool & ok) {
|
|
|
- ok=true;
|
|
|
- return loadErrorHandlingToStr(o);
|
|
|
- }
|
|
|
-};
|
|
|
-typedef SomeSetter<LoadErrorHandlingTM> LoadErrorHandlingSetting;
|
|
|
-
|
|
|
-
|
|
|
-/*!
|
|
|
- Argument handler responsible for calling a function
|
|
|
-*/
|
|
|
-template <typename T> struct Caller: public ArgHandler {
|
|
|
- Caller() {}
|
|
|
- Caller(QString a1) {
|
|
|
- argn.push_back(a1);
|
|
|
- }
|
|
|
- bool operator() (const char **vals, CommandLineParserPrivate & s, Page & page) {
|
|
|
- return T()(vals, s, page);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-//All these function would have been lambda function, had C++ supported them, now we are forced to write them here
|
|
|
-
|
|
|
-/*!
|
|
|
- Lambda: Call the usage method
|
|
|
-*/
|
|
|
-template <bool v>
|
|
|
-struct HelpFunc {
|
|
|
- bool operator()(const char **, CommandLineParserPrivate & p, Page &) {
|
|
|
- p.usage(stdout,v);
|
|
|
- exit(0);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
struct DefaultTocFunc {
|
|
|
- bool operator()(const char **, CommandLineParserPrivate &, Page &) {
|
|
|
+ bool operator()(const char **, CommandLineParserBase &, char *) {
|
|
|
QFile file;
|
|
|
file.open(stdout, QIODevice::WriteOnly | QIODevice::Text);
|
|
|
QTextStream stream(&file);
|
|
@@ -359,46 +127,16 @@ struct DefaultTocFunc {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-/*!
|
|
|
- Lambda: Call the man method
|
|
|
-*/
|
|
|
-struct ManPageFunc {
|
|
|
- bool operator()(const char **, CommandLineParserPrivate & p, Page &) {
|
|
|
- p.manpage(stdout);
|
|
|
- exit(0);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-/*!
|
|
|
- Lambda: Call the man method
|
|
|
-*/
|
|
|
-template <bool T>
|
|
|
-struct ReadmeFunc {
|
|
|
- bool operator()(const char **, CommandLineParserPrivate & p, Page &) {
|
|
|
- p.readme(stdout, T);
|
|
|
- exit(0);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-/*!
|
|
|
- Lambda: Call the version method
|
|
|
-*/
|
|
|
-struct VersionFunc {
|
|
|
- bool operator()(const char **, CommandLineParserPrivate & p, Page &) {
|
|
|
- p.version(stdout);
|
|
|
- exit(0);
|
|
|
- }
|
|
|
-};
|
|
|
|
|
|
/*!
|
|
|
Set the default header
|
|
|
*/
|
|
|
struct DefaultHeaderFunc {
|
|
|
- bool operator()(const char **, CommandLineParserPrivate & p, Page & page) {
|
|
|
- page.header.left="[webpage]";
|
|
|
- page.header.right="[page]/[toPage]";
|
|
|
- page.header.line=true;
|
|
|
- p.globalSettings.margin.top = strToUnitReal("2cm");
|
|
|
+ bool operator()(const char **, CommandLineParserBase & p, char * page) {
|
|
|
+ reinterpret_cast<Page*>(page)->header.left="[webpage]";
|
|
|
+ reinterpret_cast<Page*>(page)->header.right="[page]/[toPage]";
|
|
|
+ reinterpret_cast<Page*>(page)->header.line=true;
|
|
|
+ static_cast<CommandLineParser&>(p).globalSettings.margin.top = strToUnitReal("2cm");
|
|
|
return true;
|
|
|
}
|
|
|
};
|
|
@@ -407,7 +145,7 @@ struct DefaultHeaderFunc {
|
|
|
Setup default book mode
|
|
|
*/
|
|
|
struct BookFunc {
|
|
|
- bool operator()(const char **, CommandLineParserPrivate &) {
|
|
|
+ bool operator()(const char **, CommandLineParserBase &) {
|
|
|
//p.settings.header.left="[section]";
|
|
|
//p.settings.header.right="[page]/[toPage]";
|
|
|
//p.settings.header.line=true;
|
|
@@ -418,78 +156,25 @@ struct BookFunc {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-/*!
|
|
|
- The next arguments we add will belong to this section
|
|
|
- /param s The name of the section
|
|
|
- /param desc A description of the section
|
|
|
-*/
|
|
|
-void CommandLineParserPrivate::section(QString s, QString desc) {
|
|
|
- currentSection = s;
|
|
|
- sectionDesc[s] = desc;
|
|
|
- sections.push_back(s);
|
|
|
-}
|
|
|
-
|
|
|
-/*!
|
|
|
- Indicate whether the next arguments we add require a patched qt to work
|
|
|
- /param h Do we require a patch
|
|
|
-*/
|
|
|
-void CommandLineParserPrivate::qthack(bool h) {
|
|
|
- currentHack = h;
|
|
|
-}
|
|
|
-
|
|
|
-void CommandLineParserPrivate::mode(int m) {
|
|
|
- currentMode = m;
|
|
|
-}
|
|
|
-
|
|
|
-/*!
|
|
|
- Indicate whether the next arguments we add are "extended" and should not
|
|
|
- be shown in a simple --help
|
|
|
- \param e Are the arguments extended
|
|
|
-*/
|
|
|
-void CommandLineParserPrivate::extended(bool e) {
|
|
|
- currentExtended = e;
|
|
|
-}
|
|
|
-
|
|
|
-/*!
|
|
|
- Add an argument to the list of arguments
|
|
|
- \param l The long "--" name of the argument
|
|
|
- \param s The short '-' name of the argument or 0 if unspecified
|
|
|
- \param d Description of the argument
|
|
|
- \param h The handler for the argument
|
|
|
- \param display Is the argument hidden
|
|
|
-*/
|
|
|
-void CommandLineParserPrivate::addarg(QString l, char s, QString d, ArgHandler * h, bool display) {
|
|
|
- h->desc = d;
|
|
|
- h->longName = l;
|
|
|
- h->shortSwitch = s;
|
|
|
- h->display = display;
|
|
|
- h->qthack = currentHack;
|
|
|
- h->extended = currentExtended;
|
|
|
- h->section = currentMode;
|
|
|
- longToHandler[l] = h;
|
|
|
- if(s) shortToHandler[s] = h;
|
|
|
- sectionArgumentHandles[currentSection].push_back(h);
|
|
|
-}
|
|
|
-
|
|
|
/*!
|
|
|
Construct the commandline parser adding all the arguments
|
|
|
\param s The settings to store values in
|
|
|
*/
|
|
|
-CommandLineParserPrivate::CommandLineParserPrivate(Global & s, QList<Page> & ps):
|
|
|
+CommandLineParser::CommandLineParser(Global & s, QList<Page> & ps):
|
|
|
readArgsFromStdin(false),
|
|
|
globalSettings(s),
|
|
|
pageSettings(ps)
|
|
|
{
|
|
|
section("Global Options");
|
|
|
mode(global);
|
|
|
-
|
|
|
+
|
|
|
+ addDocArgs();
|
|
|
+
|
|
|
extended(false);
|
|
|
qthack(false);
|
|
|
- addarg("help", 'h', "Display help", new Caller<HelpFunc<false> >());
|
|
|
+
|
|
|
addarg("quiet", 'q', "Be less verbose", new ConstSetter<bool>(s.quiet,true));
|
|
|
- addarg("version", 'V' ,"Output version information an exit", new Caller<VersionFunc>());
|
|
|
|
|
|
- addarg("extended-help", 'H',"Display more extensive help, detailing less common command switches", new Caller<HelpFunc<true> >());
|
|
|
addarg("no-collate", 0, "Do not collate when printing multiple copies", new ConstSetter<bool>(s.collate, false));
|
|
|
addarg("collate", 0, "Collate when printing multiple copies", new ConstSetter<bool>(s.collate, true));
|
|
|
|
|
@@ -513,15 +198,12 @@ CommandLineParserPrivate::CommandLineParserPrivate(Global & s, QList<Page> & ps)
|
|
|
addarg("margin-right",'R',"Set the page right margin", new UnitRealSetter(s.margin.right,"unitreal"));
|
|
|
addarg("margin-top",'T',"Set the page top margin", new UnitRealSetter(s.margin.top,"unitreal"));
|
|
|
|
|
|
- addarg("manpage", 0, "Output program man page", new Caller<ManPageFunc>());
|
|
|
- addarg("htmldoc", 0, "Output program html help", new Caller<ReadmeFunc<true> >());
|
|
|
- addarg("readme", 0, "Output program readme", new Caller<ReadmeFunc<false> >());
|
|
|
addarg("dpi",'d',"Change the dpi explicitly (this has no effect on X11 based systems)", new IntSetter(s.dpi,"dpi"));
|
|
|
addarg("page-height", 0, "Page height", new UnitRealSetter(s.size.height,"unitreal"));
|
|
|
addarg("page-width", 0, "Page width", new UnitRealSetter(s.size.width,"unitreal"));
|
|
|
|
|
|
// addarg("book",'b',"Set the options one would usually set when printing a book", new Caller<BookFunc>());
|
|
|
- addarg("cookie-jar", 0, "Read and write cookies from and to the supplied cookie jar file", new QStrSetter(s.cookieJar, "path") );
|
|
|
+ addGlobalLoadArgs(s.load);
|
|
|
|
|
|
|
|
|
extended(true);
|
|
@@ -546,30 +228,11 @@ CommandLineParserPrivate::CommandLineParserPrivate(Global & s, QList<Page> & ps)
|
|
|
extended(true);
|
|
|
qthack(false);
|
|
|
addarg("default-header",0,"Add a default header, with the name of the page to the left, and the page number to the right, this is short for: --header-left='[webpage]' --header-right='[page]/[toPage]' --top 2cm --header-line", new Caller<DefaultHeaderFunc>());
|
|
|
- addarg("proxy",'p',"Use a proxy", new ProxySetter(od.proxy, "proxy"));
|
|
|
- addarg("username",0,"HTTP Authentication username", new QStrSetter(od.username, "username"));
|
|
|
- addarg("password",0,"HTTP Authentication password", new QStrSetter(od.password, "password"));
|
|
|
- addarg("load-error-handling", 0, "Specify how to handle pages that fail to load: abort, ignore or skip", new LoadErrorHandlingSetting(od.loadErrorHandling, "handler"));
|
|
|
- addarg("custom-header",0,"Set an additional HTTP header (repeatable)", new MapSetter<>(od.customHeaders, "name", "value"));
|
|
|
- addarg("custom-header-propagation",0,"Add HTTP headers specified by --custom-header for each resource request.", new ConstSetter<bool>(od.repeatCustomHeaders, true));
|
|
|
- addarg("no-custom-header-propagation",0,"Do not add HTTP headers specified by --custom-header for each resource request.", new ConstSetter<bool>(od.repeatCustomHeaders, true));
|
|
|
|
|
|
- addarg("disable-javascript",'n',"Do not allow web pages to run javascript", new ConstSetter<bool>(od.enableJavascript,false));
|
|
|
- addarg("enable-javascript",'n',"Do allow web pages to run javascript", new ConstSetter<bool>(od.enableJavascript,true));
|
|
|
-
|
|
|
- addarg("javascript-delay",0,"Wait some milliseconds for javascript finish", new IntSetter(od.jsdelay,"msec"));
|
|
|
addarg("enable-plugins",0,"Enable installed plugins (plugins will likely not work)", new ConstSetter<bool>(od.enablePlugins,true));
|
|
|
addarg("disable-plugins",0,"Disable installed plugins", new ConstSetter<bool>(od.enablePlugins,false));
|
|
|
|
|
|
addarg("minimum-font-size",0,"Minimum font size", new IntSetter(od.minimumFontSize,"int"));
|
|
|
- addarg("zoom",0,"Use this zoom factor", new FloatSetter(od.zoomFactor,"float",1.0));
|
|
|
- addarg("cookie",0,"Set an additional cookie (repeatable)", new MapSetter<>(od.cookies, "name", "value"));
|
|
|
- addarg("post", 0, "Add an additional post field (repeatable)", new MapSetter<PostItemCreator<false> >(od.post, "name", "value"));
|
|
|
- addarg("post-file", 0, "Post an additional file (repeatable)", new MapSetter<PostItemCreator<true> >(od.post, "name", "path"));
|
|
|
-
|
|
|
- addarg("disable-local-file-access", 0, "Do not allowed conversion of a local file to read in other local files, unless explecitily allowed with --allow", new ConstSetter<bool>(od.blockLocalFileAccess, true));
|
|
|
- addarg("enable-local-file-access", 0, "Allowed conversion of a local file to read in other local files.", new ConstSetter<bool>(od.blockLocalFileAccess, false));
|
|
|
- addarg("allow", 0, "Allow the file or files from the specified folder to be loaded (repeatable)", new StringListSetter(od.allowed,"path"));
|
|
|
|
|
|
#if QT_VERSION >= 0x040500 //Not printing the background was added in QT4.5
|
|
|
addarg("no-background",0,"Do not print background", new ConstSetter<bool>(od.background, false));
|
|
@@ -577,15 +240,6 @@ CommandLineParserPrivate::CommandLineParserPrivate(Global & s, QList<Page> & ps)
|
|
|
addarg("user-style-sheet",0,"Specify a user style sheet, to load with every page", new QStrSetter(od.userStyleSheet,"url"));
|
|
|
#endif
|
|
|
|
|
|
- addarg("debug-javascript", 0,"Show javascript debugging output", new ConstSetter<bool>(od.debugJavascript, true));
|
|
|
- addarg("no-debug-javascript", 0,"Do not show javascript debugging output", new ConstSetter<bool>(od.debugJavascript, false));
|
|
|
-#if QT_VERSION >= 0x040600
|
|
|
- addarg("stop-slow-scripts", 0, "Stop slow running javascripts", new ConstSetter<bool>(od.stopSlowScripts, true));
|
|
|
- addarg("no-stop-slow-scripts", 0, "Do not Stop slow running javascripts", new ConstSetter<bool>(od.stopSlowScripts, true));
|
|
|
- addarg("no-images",0,"Do not load or print images", new ConstSetter<bool>(od.loadImages, false));
|
|
|
- addarg("images",0,"Do load or print images", new ConstSetter<bool>(od.loadImages, true));
|
|
|
-#endif
|
|
|
-
|
|
|
extended(true);
|
|
|
qthack(true);
|
|
|
addarg("enable-forms", 0, "Turn HTML form fields into pdf form fields", new ConstSetter<bool>(od.produceForms, true));
|
|
@@ -601,6 +255,15 @@ CommandLineParserPrivate::CommandLineParserPrivate(Global & s, QList<Page> & ps)
|
|
|
addarg("enable-toc-back-links",0,"Do not link from section header to toc", new ConstSetter<bool>(od.toc.backLinks,true));
|
|
|
addarg("disable-toc-back-links",0,"Do not link from section header to toc", new ConstSetter<bool>(od.toc.backLinks,true));
|
|
|
|
|
|
+ addarg("disable-javascript",'n',"Do not allow web pages to run javascript", new ConstSetter<bool>(od.enableJavascript,false));
|
|
|
+ addarg("enable-javascript",'n',"Do allow web pages to run javascript", new ConstSetter<bool>(od.enableJavascript,true));
|
|
|
+
|
|
|
+ addPageLoadArgs(od.load);
|
|
|
+#if QT_VERSION >= 0x040600
|
|
|
+ addarg("no-images",0,"Do not load or print images", new ConstSetter<bool>(od.loadImages, false));
|
|
|
+ addarg("images",0,"Do load or print images", new ConstSetter<bool>(od.loadImages, true));
|
|
|
+#endif
|
|
|
+
|
|
|
|
|
|
// addarg("page-offset",0,"Set the starting page number", new IntSetter(s.pageOffset,"offset",1));
|
|
|
|