Beispiel #1
0
void HttpFileReceiver::readResponseHeader(const QHttpResponseHeader &responseHeader)
{
    if ( responseHeader.statusCode() >= 400 )
    {
        fetcher->httpRequestAborted = true;
        QString detailedError( "HttpFileReceiver::readReasponseHeader:- status code: %1 "
                               "reason phrase: %2" );
        detailedError = detailedError.arg( responseHeader.statusCode() )
                                     .arg( responseHeader.reasonPhrase() );
        fetcher->error = detailedError; 
    }
}
Beispiel #2
0
/*!
  Construct a new sandbox install job object, ensuring the sandbox
  root exists, and creating the destination directory for the
  package to be expanded into.

  The destination directory is below Qtopia::packagePath() and is formed from
  the md5sum of the package.

  The \a pkg points to the package which will be installed.

  If \a m is non-empty it specifies the file-system path mount-point
  of a media card (or other writeable file-system) on which the package
  will be located.

  In this case the destination directory will be a symlink from the
  system root to the location on the media card.
  */
SandboxInstallJob::SandboxInstallJob( const InstallControl::PackageInfo *pkg, const QString &m, ErrorReporter *errorReporter )
    : package( pkg )
    , media( m )
    , abort( false )
    , reporter( errorReporter )
{

    QDir sandboxRoot( Qtopia::packagePath() );
    destination = sandboxRoot.path() + "/" + pkg->md5Sum;
    Q_ASSERT( sandboxRoot.exists() );

    QString errReason;
    if ( !pkg->isComplete(InstallControl::PackageInfo::PkgList, &errReason ) )   // must have the md5Sum value, plus content!
    {

        if( reporter )
        {
            QString simpleError =  QObject::tr( "Invalid package, contact package supplier" );
            QString detailedError( "SandboxInstallJob::SandboxInstallJob:- PackageInfo pkg is incomplete: %1" );
            detailedError = detailedError.arg( errReason );
            reporter->reportError( simpleError, detailedError );
        }

        abort = true;
        return;
    }

    if (sandboxRoot.exists( pkg->md5Sum ))
    {
        qWarning( QString("SandboxInstallJob::SandboxInstallJob:- "
                          "Package directory matching %1 already exists, clearing out "
                          "residual package elements" ).arg(pkg->md5Sum).toLatin1() );

        SandboxUninstallJob job( pkg, m, reporter );
        job.terminateApps();
        job.unregisterPackageFiles();
        job.dismantleSandbox();
    }

    if ( media.isEmpty() )
    {
        if ( !sandboxRoot.mkdir( pkg->md5Sum ))
        {
            if( reporter )
            {
                QString simpleError = QObject::tr( "Error occurred during installation" );
                QString detailedError = QString( "SandboxInstallJob::SandboxInstallJob:- "
                                               "Could not create directory %1")
                                       .arg( pkg->md5Sum );
                reporter->reportError( simpleError, detailedError );
            }

            abort = true;
            return;
        }
    }
    else
    {
        mediaSandboxRoot();
    }

    QStringList dirs;
    dirs << BIN << PICS << SOUNDS << HELP << CONTROLS << I18N;
    foreach ( QString dir, dirs )
    {
        if ( !QDir::root().exists( Qtopia::packagePath() + dir) )
            QDir::root().mkpath( Qtopia::packagePath() + dir );
    }
}