| 393 | } |
| 394 | |
| 395 | void LoadingDocumentImpl::init() |
| 396 | { |
| 397 | QUrl url = document()->url(); |
| 398 | |
| 399 | if (UrlUtils::urlIsFastLocalFile(url)) { |
| 400 | // Load file content directly |
| 401 | QFile file(url.toLocalFile()); |
| 402 | if (!file.open(QIODevice::ReadOnly)) { |
| 403 | setDocumentErrorString(i18nc("@info", "Could not open file %1", url.toLocalFile())); |
| 404 | Q_EMIT loadingFailed(); |
| 405 | switchToImpl(new EmptyDocumentImpl(document())); |
| 406 | return; |
| 407 | } |
| 408 | d->mData = file.read(HEADER_SIZE); |
| 409 | if (d->determineKind()) { |
| 410 | return; |
| 411 | } |
| 412 | d->mData += file.readAll(); |
| 413 | d->startLoading(); |
| 414 | } else { |
| 415 | // Transfer file via KIO |
| 416 | d->mTransferJob = KIO::get(document()->url(), KIO::NoReload, KIO::HideProgressInfo); |
| 417 | connect(d->mTransferJob.data(), &KIO::TransferJob::data, this, &LoadingDocumentImpl::slotDataReceived); |
| 418 | connect(d->mTransferJob.data(), &KJob::result, this, &LoadingDocumentImpl::slotTransferFinished); |
| 419 | d->mTransferJob->start(); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | void LoadingDocumentImpl::loadImage(int invertedZoom) |
| 424 | { |
nothing calls this directly
no test coverage detected