- Don't fail when the selection is empty and the pipe command is invoked
- Pipe the entire body through the command instead of just the selection.
  This ensures that the body is correctly piped when nothing is selected.

svn path=/trunk/KDE/kdepim/; revision=701880
wilder-work
Thomas McGuire 19 years ago
parent 65076e6d1e
commit 7032375bd4
  1. 14
      templateparser.cpp

@ -283,7 +283,8 @@ void TemplateParser::processWithTemplate( const QString &tmpl )
i += len;
QString pipe_cmd = q;
if ( mOrigMsg ) {
QString str = pipe( pipe_cmd, mSelection );
QString str =
pipe( pipe_cmd, mOrigMsg->asPlainText( mSmartQuote, mAllowDecryption ) );
QString quote = mOrigMsg->asQuotedString( "", mQuoteString, str,
mSmartQuote, mAllowDecryption );
if ( quote.endsWith( '\n' ) )
@ -330,7 +331,8 @@ void TemplateParser::processWithTemplate( const QString &tmpl )
i += len;
QString pipe_cmd = q;
if ( mOrigMsg ) {
QString str = pipe(pipe_cmd, mSelection );
QString str =
pipe(pipe_cmd, mOrigMsg->asPlainText( mSmartQuote, mAllowDecryption ) );
body.append( str );
}
@ -991,9 +993,11 @@ QString TemplateParser::pipe( const QString &cmd, const QString &buf )
process.setShellCommand( cmd );
process.start();
if ( process.waitForStarted( PipeTimeout ) ) {
process.write( buf.toAscii() );
if ( process.waitForBytesWritten( PipeTimeout ) ) {
process.closeWriteChannel();
if ( !buf.isEmpty() )
process.write( buf.toAscii() );
if ( buf.isEmpty() || process.waitForBytesWritten( PipeTimeout ) ) {
if ( !buf.isEmpty() )
process.closeWriteChannel();
if ( process.waitForFinished( PipeTimeout ) ) {
success = ( process.exitStatus() == QProcess::NormalExit );
finished = true;

Loading…
Cancel
Save