예제 #1
0
파일: k3bisoimager.cpp 프로젝트: KDE/k3b
void K3b::IsoImager::slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus )
{
    qDebug();

    cleanup();

    if( m_canceled ) {
        emit canceled();
        jobFinished(false);
    }
    else {
        if( exitStatus == QProcess::NormalExit ) {
            if( exitCode == 0 ) {
                jobFinished( !mkisofsReadError() );
            }
            else {
                switch( exitCode ) {
                case 104:
                    // connection reset by peer
                    // This only happens if cdrecord does not finish successfully
                    // so we may leave the error handling to it meaning we handle this
                    // as a known error
                    break;

                case 2:
                    // mkisofs seems to have a bug that prevents to use filenames
                    // that contain one or more backslashes
                    // mkisofs 1.14 has the bug, 1.15a40 not
                    // TODO: find out the version that fixed the bug
                    if( m_containsFilesWithMultibleBackslashes &&
                        !k3bcore->externalBinManager()->binObject( "mkisofs" )->hasFeature( "backslashed_filenames" ) ) {
                        emit infoMessage( i18n("Due to a bug in mkisofs <= 1.15a40, K3b is unable to handle "
                                               "filenames that contain more than one backslash:"), MessageError );

                        break;
                    }
                    // otherwise just fall through

                default:
                    if( !d->knownError && !mkisofsReadError() ) {
                        emit infoMessage( i18n("%1 returned an unknown error (code %2).", QLatin1String("mkisofs"), exitCode ),
                                          K3b::Job::MessageError );
                        emit infoMessage( i18n("Please send me an email with the last output."), K3b::Job::MessageError );
                    }
                }

                jobFinished( false );
            }
        }
        else {
            emit infoMessage( i18n("%1 crashed.", QLatin1String("mkisofs")), MessageError );
            jobFinished( false );
        }
    }
}
예제 #2
0
void K3bIsoImager::slotProcessExited( KProcess* p )
{
  kdDebug() << k_funcinfo << endl;

  m_processExited = true;

  d->pipe->close();

  emit debuggingOutput( "K3bIsoImager",
			QString("Pipe throughput: %1 bytes read, %2 bytes written.")
			.arg(d->pipe->bytesRead()).arg(d->pipe->bytesWritten()) );

  if( d->imageFile.isOpen() ) {
    d->imageFile.close();

    if( m_canceled || p->exitStatus() != 0 ) {
      d->imageFile.remove();
      emit infoMessage( i18n("Removed incomplete image file %1.").arg(d->imageFile.name()), WARNING );
    }
  }

  if( m_canceled ) {
    emit canceled();
    jobFinished(false);
  }
  else {
    if( p->normalExit() ) {
      if( p->exitStatus() == 0 ) {
	jobFinished( !mkisofsReadError() );
      }
      else {
	switch( p->exitStatus() ) {
	case 104:
	  // connection reset by peer
	  // This only happens if cdrecord does not finish successfully
	  // so we may leave the error handling to it meaning we handle this
	  // as a known error
	  break;

	case 2:
	  // mkisofs seems to have a bug that prevents to use filenames
	  // that contain one or more backslashes
	  // mkisofs 1.14 has the bug, 1.15a40 not
	  // TODO: find out the version that fixed the bug
	  if( m_containsFilesWithMultibleBackslashes &&
	      !k3bcore->externalBinManager()->binObject( "mkisofs" )->hasFeature( "backslashed_filenames" ) ) {
	    emit infoMessage( i18n("Due to a bug in mkisofs <= 1.15a40, K3b is unable to handle "
				   "filenames that contain more than one backslash:"), ERROR );

	    break;
	  }
	  // otherwise just fall through

	default:
	  if( !d->knownError && !mkisofsReadError() ) {
	    emit infoMessage( i18n("%1 returned an unknown error (code %2).").arg("mkisofs").arg(p->exitStatus()),
			      K3bJob::ERROR );
	    emit infoMessage( i18n("Please send me an email with the last output."), K3bJob::ERROR );
	  }
	}

	jobFinished( false );
      }
    }
    else {
      emit infoMessage( i18n("%1 did not exit cleanly.").arg("mkisofs"), ERROR );
      jobFinished( false );
    }
  }

  cleanup();
}