Exemple #1
0
void ZooArch::unarchFileInternal()
{
  // if _fileList is empty, we extract all.
  // if _destDir is empty, abort with error.

  if ( m_destDir.isEmpty() || m_destDir.isNull() )
  {
    kdError( 1601 ) << "There was no extract directory given." << endl;
    return;
  }

  // zoo has no option to specify the destination directory
  // so we have to change to it.

  bool ret = QDir::setCurrent( m_destDir );
  // We already checked the validity of the dir before coming here
  Q_ASSERT(ret);

  KProcess *kp = m_currentProcess = new KProcess;
  kp->clearArguments();

  *kp << m_archiver_program;

  if ( ArkSettings::extractOverwrite() )
  {
    *kp << "xOOS";
  }
  else
  {
    *kp << "x";
  }

  *kp << m_filename;

  // if the list is empty, no filenames go on the command line,
  // and we then extract everything in the archive.
  if (m_fileList)
  {
    QStringList::Iterator it;
    for ( it = m_fileList->begin(); it != m_fileList->end(); ++it )
    {
      *kp << (*it);
    }
  }

  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
  connect( kp, SIGNAL( processExited(KProcess*) ),
           SLOT( slotExtractExited(KProcess*) ) );

  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
  {
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
    emit sigExtract( false );
  }
}
Exemple #2
0
void ZipArch::unarchFileInternal()
{
    // if fileList is empty, all files are extracted.
    // if destDir is empty, abort with error.
    if ( m_destDir.isEmpty() || m_destDir.isNull() )
    {
        kdError( 1601 ) << "There was no extract directory given." << endl;
        return;
    }

    KProcess *kp = m_currentProcess = new KProcess;
    kp->clearArguments();

    *kp << m_unarchiver_program;

    if ( !m_password.isEmpty() )
        *kp << "-P" << m_password;

    if ( ArkSettings::extractJunkPaths() && !m_viewFriendly )
        *kp << "-j" ;

    if ( ArkSettings::rarToLower() )
        *kp << "-L";

    if ( ArkSettings::extractOverwrite() )
        *kp << "-o";
    else
        *kp << "-n";

    *kp << m_filename;

    // if the list is empty, no filenames go on the command line,
    // and we then extract everything in the archive.
    if ( m_fileList )
    {
        QStringList::Iterator it;

        for ( it = m_fileList->begin(); it != m_fileList->end(); ++it )
        {
            *kp << (*it);
        }
    }

    *kp << "-d" << m_destDir;

    connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
             SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
    connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
             SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
    connect( kp, SIGNAL( processExited(KProcess*) ),
             SLOT( slotExtractExited(KProcess*) ) );

    if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
    {
        KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
        emit sigExtract( false );
    }
}
Exemple #3
0
void SevenZipArch::unarchFileInternal( )
{
  if ( m_destDir.isEmpty() || m_destDir.isNull() )
  {
    kdError( 1601 ) << "There was no extract directory given." << endl;
    return;
  }

  TDEProcess *kp = m_currentProcess = new TDEProcess;
  kp->clearArguments();

  // extract (and maybe overwrite)
  *kp << m_unarchiver_program << "x";

  if ( ArkSettings::extractOverwrite() )
  {
    //*kp << "-ao";
  }

  // FIXME overwrite existing files created with wrong password
  *kp << "-y";

  if ( !m_password.isEmpty() )
    *kp << "-p" + m_password;

  *kp << m_filename;

  // if the file list is empty, no filenames go on the command line,
  // and we then extract everything in the archive.
  if ( m_fileList )
  {
    TQStringList::Iterator it;
    for ( it = m_fileList->begin(); it != m_fileList->end(); ++it )
    {
      *kp << (*it);
    }
  }

  *kp << "-o" + m_destDir ;

  connect( kp, TQT_SIGNAL( receivedStdout(TDEProcess*, char*, int) ),
           TQT_SLOT( slotReceivedOutput(TDEProcess*, char*, int) ) );
  connect( kp, TQT_SIGNAL( receivedStderr(TDEProcess*, char*, int) ),
           TQT_SLOT( slotReceivedOutput(TDEProcess*, char*, int) ) );
  connect( kp, TQT_SIGNAL( processExited(TDEProcess*) ),
           TQT_SLOT( slotExtractExited(TDEProcess*) ) );

  if ( !kp->start( TDEProcess::NotifyOnExit, TDEProcess::AllOutput ) )
  {
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
    emit sigExtract( false );
  }
}
Exemple #4
0
void LhaArch::unarchFileInternal()
{
  // if _fileList is empty, we extract all.
  // if _destDir is empty, abort with error.

  if ( m_destDir.isEmpty() || m_destDir.isNull() )
  {
    kdError( 1601 ) << "There was no extract directory given." << endl;
    return;
  }

  KProcess *kp = m_currentProcess = new KProcess;
  kp->clearArguments();

  *kp << m_archiver_program << "xfw=" + m_destDir << m_filename;

  // if the list is empty, no filenames go on the command line,
  // and we then extract everything in the archive.
  if ( m_fileList )
  {
    QStringList::Iterator it;
    for ( it = m_fileList->begin(); it != m_fileList->end(); ++it )
    {
      *kp << ( *it );
    }
  }

  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
  connect( kp, SIGNAL( processExited(KProcess*) ),
           SLOT( slotExtractExited(KProcess*) ) );

  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
  {
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
    emit sigExtract( false );
  }
}