void TreeLog::onSaveLog() { const QUrl url = QFileDialog::getSaveFileUrl(); if (!url.isEmpty()) { QTemporaryFile tempFile; if (!tempFile.open()) { KMessageBox::error(this, xi18nc("@info", "Could not create temporary output file to save <filename>%1</filename>.", url.fileName()), i18nc("@title:window", "Error Saving Log File")); return; } QTextStream stream(&tempFile); for (qint32 idx = 0; idx < treeLog().topLevelItemCount(); idx++) { QTreeWidgetItem* item = treeLog().topLevelItem(idx); stream << item->text(1) << ": " << item->text(2) << "\n"; } tempFile.close(); KIO::CopyJob* job = KIO::move(QUrl::fromLocalFile(tempFile.fileName()), url, KIO::HideProgressInfo); job->exec(); if ( job->error() ) job->ui()->showErrorMessage(); } }
void Importer::slotCopyDone(KJob* _job) { KIO::CopyJob* job = static_cast<KIO::CopyJob*>(_job); KUrl url = job->destUrl(); if (job->error()) { kWarning() << "FIXME: What do we do with failed urls?"; advance(); d->importNext(); return; } d->renameImportedUrl(url); }