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; }
bool ConfigFile::saveToFile(const String &filename) { DumpFile file; if (file.open(filename)) return saveToStream(file); else return false; }
bool ConfigFile::saveToFile(const String &filename) { File file; if (file.open(filename, File::kFileWriteMode)) return saveToStream(file); else return false; }
bool Strings::saveToFile(const char* fileName) const { FileStream fs; bool result = fs.open(fileName, FM_CREATE); if (result) result = saveToStream(fs); return result; }
WorldRegion::~WorldRegion() { saveToStream(mRegionFile, mChunkFile); unloadPillars(); mRegionFile.close(); mChunkFile.close(); }
bool ConfigFile::saveToSaveFile(const char *filename) { SaveFileManager *saveFileMan = g_system->getSavefileManager(); WriteStream *saveFile; if (!(saveFile = saveFileMan->openForSaving(filename))) return false; bool status = saveToStream(*saveFile); delete saveFile; return status; }
bool FQTermConfig::save(const QString &szFileName) { QFile file(szFileName); if (!file.open(QIODevice::WriteOnly)) { FQ_TRACE("config", 0) << "Failed to open the file for writing: " << szFileName; return false; } QTextStream os; os.setDevice(&file); saveToStream(os); // os.unsetDevice(); file.close(); return true; }