예제 #1
0
void MultiSegmentCopyJob::slotStart()
{
    kDebug(5001);
    if( !checkLocalFile() )
        emitResult();

    kDebug(5001) << " opening: " << m_dest_part;
    m_putJob = KIO::open(m_dest_part, QIODevice::WriteOnly | QIODevice::ReadOnly);
    connect( m_putJob, SIGNAL(open(KIO::Job *)), SLOT(slotOpen(KIO::Job *)));
    connect(m_putJob, SIGNAL(close(KIO::Job *)), SLOT(slotClose(KIO::Job *)));
    connect( m_putJob, SIGNAL(written(KIO::Job * ,KIO::filesize_t )), SLOT(slotWritten( KIO::Job * ,KIO::filesize_t )));
    connect( m_putJob, SIGNAL(result(KJob *)), SLOT(slotResult( KJob *)));

    emit description(this, "multiSegmentCopyJob", 
                    qMakePair(QString("source"), SegFactory->Urls().at(0).url()),
                    qMakePair(QString("destination"), m_dest.url()));
}
예제 #2
0
void Updater::checkLocalFiles()
{
  _downloadQueue.clear();

  // Get the current path
  vfs::Directory targetDir = getTargetDir();

  Logger::warning( "Checking target folder: " + targetDir.toString() );

  std::size_t count = 0;
  for( auto& item : _latestRelease )
  {
    if (_fileProgressCallback != NULL)
    {
      CurFileInfo info;
      info.operation = CurFileInfo::Check;
      info.file = item.second.file;
      info.progressFraction = static_cast<double>(count) / _latestRelease.size();

      _fileProgressCallback->onFileOperationProgress(info);
    }

    //Logger::warning( "Checking for file: " + i->second.file.toString() + "...");
    if( !checkLocalFile(targetDir, item.second) )
    {
      // A member is missing or out of date, mark the archive for download
      _downloadQueue.insert(item);
    }

    count++;
  }

  if (_fileProgressCallback != NULL)
  {
    _fileProgressCallback->OnFileOperationFinish();
  }

  if (NewUpdaterAvailable())
  {
    // Remove all download packages from the queue, except the one containing the updater
    removeAllPackagesExceptUpdater();
  }
}