| 90 | #endif |
| 91 | |
| 92 | bool DefaultFileAccessJobHandler::get(void* pDestBuffer, long maxLength) |
| 93 | { |
| 94 | ProgressProxyExtender pp; // Implicitly used in slotPercent() |
| 95 | |
| 96 | if(maxLength > 0 && !ProgressProxy::wasCancelled()) |
| 97 | { |
| 98 | m_bSuccess = false; |
| 99 | #if HAS_KFKIO |
| 100 | KIO::TransferJob* pJob = KIO::get(mFileAccess->url(), KIO::NoReload); |
| 101 | m_transferredBytes = 0; |
| 102 | m_pTransferBuffer = (char*)pDestBuffer; |
| 103 | m_maxLength = maxLength; |
| 104 | mFileAccess->setStatusText(QString()); |
| 105 | |
| 106 | chk_connect(pJob, &KIO::TransferJob::result, this, &DefaultFileAccessJobHandler::slotSimpleJobResult); |
| 107 | chk_connect(pJob, &KIO::TransferJob::finished, this, &DefaultFileAccessJobHandler::slotJobEnded); |
| 108 | chk_connect(pJob, &KIO::TransferJob::data, this, &DefaultFileAccessJobHandler::slotGetData); |
| 109 | chk_connect(pJob, &KIO::TransferJob::percentChanged, &pp, &ProgressProxyExtender::slotPercent); |
| 110 | |
| 111 | ProgressProxy::enterEventLoop(pJob, i18nc("Message for progress dialog %1 = path to file", "Reading file: %1", mFileAccess->prettyAbsPath())); |
| 112 | #endif |
| 113 | return m_bSuccess; |
| 114 | } |
| 115 | else |
| 116 | return true; |
| 117 | } |
| 118 | |
| 119 | #if HAS_KFKIO |
| 120 | void DefaultFileAccessJobHandler::slotGetData(KJob* pJob, const QByteArray& newData) |
no test coverage detected