bool KraConverter::saveRootDocuments(KoStore *store) { dbgFile << "Saving root"; if (store->open("root")) { KoStoreDevice dev(store); if (!saveToStream(&dev) || !store->close()) { dbgUI << "saveToStream failed"; return false; } } else { m_doc->setErrorMessage(i18n("Not able to write '%1'. Partition full?", QString("maindoc.xml"))); return false; } bool success = false; if (store->open("documentinfo.xml")) { QDomDocument doc = KisDocument::createDomDocument("document-info" /*DTD name*/, "document-info" /*tag name*/, "1.1"); doc = m_doc->documentInfo()->save(doc); KoStoreDevice dev(store); QByteArray s = doc.toByteArray(); // this is already Utf8! success = dev.write(s.data(), s.size()); store->close(); } if (store->open("preview.png")) { // ### TODO: missing error checking (The partition could be full!) savePreview(store); (void)store->close(); } dbgUI << "Saving done of url:" << m_doc->url().toLocalFile(); // Success return success; }
void ThemeDialog::accept() { m_theme.setName(m_name->text().simplified()); setValues(m_theme); m_theme.saveChanges(); savePreview(); QDialog::accept(); }
PreviewThread::PreviewThread(uint timeInterval, uint maxWidth, uint maxHeight) // ---------------------------------------------------------------------------- // Start preview-save thread by saving // ---------------------------------------------------------------------------- : mutex(), path(), image(), nextSave(), timeInterval(timeInterval), maxWidth(maxWidth), maxHeight(maxHeight) { IFTRACE(preview) debug() << "Starting preview thread (" << timeInterval << " ms)\n"; // Ready the thread to receive events moveToThread(this); connect(this, SIGNAL(imageAvailable()), this, SLOT(savePreview())); // Configure the timer nextSave.setSingleShot(true); nextSave.setInterval(timeInterval); connect(&nextSave, SIGNAL(timeout()), this, SLOT(savePreview())); start(); // Wait until a preview is posted to save }