CVS commit by isdale: Bug fix for KXSLDbg/xsldbg : Fault: No explanation displayed user why output command failed Fix: Strengthen preconitions for output command, be more verbose if the output command has/can fail M +2 -2 doc/xsldbg/commands.docbook 1.2 M +8 -13 kxsldbg/kxsldbgpart/xsldbgconfigimpl.cpp 1.13 M +12 -5 kxsldbg/kxsldbgpart/libxsldbg/file_cmds.cpp 1.12 --- kdewebdev/doc/xsldbg/commands.docbook #1.1:1.2 @@ -381,10 +381,10 @@ Output -Specify the output file name +Specify a local, writable file to be used for output of results Shortcut name : o Output usage -output <FILENAME>    (A local file name. Which can have a "~" prefix on *nix and CYGWIN platforms. Or environment variables under RISC OS) +output <FILENAME>    (A local writable file name. Which can have a "~" prefix on *nix and CYGWIN platforms. Or environment variables under RISC OS)output <URI>    (The <URI> must only use the "file://" protocol. This is then converted to a file name suitable for the operating system)output -    ( Send to standard output. Must only be used when using xsldbg's command line prompt ) --- kdewebdev/kxsldbg/kxsldbgpart/xsldbgconfigimpl.cpp #1.12:1.13 @@ -472,9 +472,5 @@ void XsldbgConfigImpl::slotApply() { - if (1){ - update(); - return; - }else{ - // TODO redundant code to be removed ? + // Validate the users choices before applying it QString msg; if (isValid(msg)){ @@ -487,5 +483,4 @@ void XsldbgConfigImpl::slotApply() msg, QMessageBox::Ok); } - } } --- kdewebdev/kxsldbg/kxsldbgpart/libxsldbg/file_cmds.cpp #1.11:1.12 @@ -243,5 +243,8 @@ int xslDbgShellOutput(const xmlChar *arg NULL); result = 1; - }else { + } else if (!xmlStrnCmp(arg, "ftp://", 6) || !xmlStrnCmp(arg, "http://", 7)){ + xsldbgGenericErrorFunc(i18n("Error: Invalid arguments for the command %1.\n").arg("output")); + return 0; + } else { /* assume that we were provided a local file name * that may need expanding @@ -249,9 +252,13 @@ int xslDbgShellOutput(const xmlChar *arg xmlChar *expandedName = filesExpandName(arg); - if (expandedName) { - optionsSetStringOption - (OPTIONS_OUTPUT_FILE_NAME, expandedName); + // The output file must not be the same as our SOURCE or DATA file + if (expandedName && + (!xmlStrEqual(optionsGetStringOption(OPTIONS_SOURCE_FILE_NAME), expandedName)) && + (!xmlStrEqual(optionsGetStringOption(OPTIONS_DATA_FILE_NAME), expandedName)) ){ + optionsSetStringOption(OPTIONS_OUTPUT_FILE_NAME, expandedName); xmlFree(expandedName); result = 1; + }else{ + xsldbgGenericErrorFunc(i18n("Error: Invalid arguments for the command %1.\n").arg("output")); } }