| 134 | #endif |
| 135 | |
| 136 | bool DefaultFileAccessJobHandler::put(const void* pSrcBuffer, long maxLength, bool bOverwrite) |
| 137 | { |
| 138 | ProgressProxyExtender pp; // Implicitly used in slotPercent() |
| 139 | if(maxLength > 0) |
| 140 | { |
| 141 | m_bSuccess = false; |
| 142 | #if HAS_KFKIO |
| 143 | KIO::TransferJob* pJob = KIO::put(mFileAccess->url(), -1, |
| 144 | KIO::HideProgressInfo | (bOverwrite ? KIO::Overwrite : KIO::DefaultFlags)); |
| 145 | m_transferredBytes = 0; |
| 146 | m_pTransferBuffer = (char*)pSrcBuffer; |
| 147 | m_maxLength = maxLength; |
| 148 | mFileAccess->setStatusText(QString()); |
| 149 | |
| 150 | chk_connect(pJob, &KIO::TransferJob::result, this, &DefaultFileAccessJobHandler::slotPutJobResult); |
| 151 | chk_connect(pJob, &KIO::TransferJob::finished, this, &DefaultFileAccessJobHandler::slotJobEnded); |
| 152 | chk_connect(pJob, &KIO::TransferJob::dataReq, this, &DefaultFileAccessJobHandler::slotPutData); |
| 153 | chk_connect(pJob, &KIO::TransferJob::percentChanged, &pp, &ProgressProxyExtender::slotPercent); |
| 154 | |
| 155 | ProgressProxy::enterEventLoop(pJob, i18nc("Message for progress dialog %1 = path to file", "Writing file: %1", mFileAccess->prettyAbsPath())); |
| 156 | #endif |
| 157 | return m_bSuccess; |
| 158 | } |
| 159 | else |
| 160 | return true; |
| 161 | } |
| 162 | |
| 163 | #if HAS_KFKIO |
| 164 | void DefaultFileAccessJobHandler::slotPutData(KIO::Job* pJob, QByteArray& data) |
no test coverage detected