/* Modify an image tag. Basically we turn it back into a picture, write out the file, and modify the ENML */ void NoteFormatter::modifyImageTags(QDomDocument &doc, QDomElement &docElement, QDomElement &enMedia, QDomAttr &hash) { QLOG_DEBUG() << "Entering NoteFormatter::modifyImageTags"; QString mimetype = enMedia.attribute("type"); ResourceTable resourceTable; qint32 resLid = resourceTable.getLidByHashHex(QString::fromStdString(note.guid), hash.value()); Resource r; if (resLid>0) { //QFile tfile(global.fileManager.getResDirPath(QString::number(resLid)+type)); resourceTable.get(r, resLid); MimeReference ref; QString filename; if (r.__isset.attributes && r.attributes.__isset.fileName) filename = QString::fromStdString(r.attributes.fileName); QString type = ref.getExtensionFromMime(mimetype, filename); if (r.__isset.data && r.data.__isset.body && r.data.body.length() > 0) { enMedia.setAttribute("src", "file:///"+global.fileManager.getDbDirPath(QString("dba/") +QString::number(resLid) +type)); // Check if this is a LaTeX image if (r.__isset.attributes && r.attributes.__isset.sourceURL && QString::fromStdString(r.attributes.sourceURL).toLower().startsWith("http://latex.codecogs.com/gif.latex?")) { QDomElement newText(doc.createElement("a")); enMedia.setAttribute("en-tag", "en-latex"); newText.setAttribute("onMouseOver", "style.cursor='pointer'"); newText.setAttribute("title", QString::fromStdString(r.attributes.sourceURL)); newText.setAttribute("href", "latex://"+QString::number(resLid)); enMedia.parentNode().replaceChild(newText, enMedia); newText.appendChild(enMedia); } enMedia.setAttribute("onContextMenu", "window.browserWindow.imageContextMenu('" +QString::number(resLid) +"', '" +QString::number(resLid) +type +"');"); } } else { resourceError = true; readOnly = true; } // Reset the tags to something that WebKit will understand enMedia.setAttribute("en-tag", "en-media"); enMedia.setNodeValue(""); enMedia.setAttribute("lid", resLid); enMedia.setTagName("img"); }
// Return a resource structure given the LID bool ResourceTable::get(Resource &resource, qint32 lid, bool withBinary) { NSqlQuery query(db); db->lockForRead(); query.prepare("Select key, data from DataStore where lid=:lid"); query.bindValue(":lid", lid); query.exec(); if (query.size() == 0) { db->unlock(); return false; } while (query.next()) { mapResource(query, resource); } query.finish(); db->unlock(); // Now read the binary data from the disk if (withBinary) { QString mimetype = resource.mime; MimeReference ref; QString filename; ResourceAttributes attributes; if (resource.attributes.isSet()) attributes = resource.attributes; if (attributes.fileName.isSet()) filename = attributes.fileName; QString fileExt = ref.getExtensionFromMime(mimetype, filename); QFile tfile(global.fileManager.getDbDirPath("/dba/"+QString::number(lid)) +fileExt ); tfile.open(QIODevice::ReadOnly); QByteArray b = tfile.readAll(); Data d; if (resource.data.isSet()) d = resource.data; d.body = b; resource.data = d; tfile.close(); } return true; }
// Add a resource to the database qint32 ResourceTable::add(qint32 l, Resource &t, bool isDirty, int noteLid) { ConfigStore cs(db); qint32 lid = l; if (lid <= 0) lid = cs.incrementLidCounter(); else expunge(lid); NSqlQuery query(db); db->lockForWrite(); query.prepare("Insert into DataStore (lid, key, data) values (:lid, :key, :data)"); if (t.guid.isSet()) { QString guid = t.guid; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_GUID); query.bindValue(":data", guid); query.exec(); } query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_INDEX_NEEDED); query.bindValue(":data", true); query.exec(); if (noteLid <=0) { NoteTable noteTable(db); noteLid = noteTable.getLid(t.noteGuid); if (noteLid <=0) { noteLid = noteTable.addStub(t.noteGuid); } } query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_NOTE_LID); query.bindValue(":data", noteLid); query.exec(); query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_ISDIRTY); query.bindValue(":data", isDirty); query.exec(); if (t.data.isSet()) { Data d = t.data; if (d.size.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_DATA_SIZE); qint32 size = d.size; query.bindValue(":data", size); query.exec(); } if (d.bodyHash.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_DATA_HASH); QByteArray b; b.append(d.bodyHash); query.bindValue(":data", b.toHex()); query.exec(); } if (d.body.isSet()) { QString mimetype = t.mime; QString filename; MimeReference ref; ResourceAttributes attributes; if (t.attributes.isSet()) attributes = t.attributes; if (attributes.fileName.isSet()) filename = attributes.fileName; QString fileExt = ref.getExtensionFromMime(mimetype, filename); QFile tfile(global.fileManager.getDbDirPath("/dba/"+QString::number(lid)) +fileExt ); tfile.open(QIODevice::WriteOnly); if (d.size > 0) tfile.write(d.body); tfile.close(); } } if (t.mime.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_MIME); QString mime = t.mime; query.bindValue(":data", mime); query.exec(); } if (t.width.isSet()) { qint16 width = t.width; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_WIDTH); query.bindValue(":data", width); query.exec(); } if (t.height.isSet()) { qint16 height = t.height; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_HEIGHT); query.bindValue(":data", height); query.exec(); } if (t.duration.isSet()) { qint16 duration = t.duration; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_DURATION); query.bindValue(":data", duration); query.exec(); } if (t.active.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_ACTIVE); bool active = t.active; query.bindValue(":data", active); query.exec(); } if (t.recognition.isSet()) { Data r = t.recognition; if (r.size.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_RECOGNITION_SIZE); qint32 size = r.size; query.bindValue(":data", size); query.exec(); } if (r.bodyHash.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_RECOGNITION_HASH); QByteArray b; b.append(r.bodyHash); query.bindValue(":data", b.toHex()); query.exec(); } if (r.body.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_RECOGNITION_BODY); QByteArray body = r.body; query.bindValue(":data", body); query.exec(); } } if (t.updateSequenceNum.isSet()) { qint32 usn =t.updateSequenceNum; query.bindValue(":key", RESOURCE_UPDATE_SEQUENCE_NUMBER); query.bindValue(":data", usn); query.exec(); } if (t.alternateData.isSet()) { Data ad = t.alternateData; if (ad.size.isSet()) { qint32 size = ad.size; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_ALTERNATE_SIZE); query.bindValue(":data", size); query.exec(); } if (ad.bodyHash.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_ALTERNATE_HASH); QByteArray b; b.append(ad.bodyHash); query.bindValue(":data", b.toHex()); query.exec(); } if (ad.body.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_ALTERNATE_BODY); QByteArray body = ad.body; query.bindValue(":data", body); query.exec(); } } if (t.attributes.isSet()) { ResourceAttributes ra = t.attributes; if (ra.sourceURL.isSet()) { query.bindValue(":lid", lid); QString url = ra.sourceURL; query.bindValue(":key", RESOURCE_SOURCE_URL); query.bindValue(":data", url); query.exec(); } if (ra.timestamp.isSet()) { qlonglong ts = ra.timestamp; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_TIMESTAMP); query.bindValue(":data", ts); query.exec(); } if (ra.latitude.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_LATITUDE); double lat = ra.latitude; query.bindValue(":data", lat); query.exec(); } if (ra.longitude.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_LONGITUDE); double lon = ra.longitude; query.bindValue(":data", lon); query.exec(); } if (ra.altitude.isSet()) { double alt = ra.altitude; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_ALTITUDE); query.bindValue(":data", alt); query.exec(); } if (ra.cameraMake.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_CAMERA_MAKE); QString cameramake = ra.cameraMake; query.bindValue(":data", cameramake); query.exec(); } if (ra.cameraModel.isSet()) { query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_CAMERA_MODEL); QString model = ra.cameraModel; query.bindValue(":data", model); query.exec(); } if (ra.clientWillIndex.isSet()) { bool cwi = ra.clientWillIndex; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_CLIENT_WILL_INDEX); query.bindValue(":data", cwi); query.exec(); } if (ra.recoType.isSet()) { QString reco = ra.recoType; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_RECO_TYPE); query.bindValue(":data", reco); query.exec(); } if (ra.fileName.isSet()) { QString filename = ra.fileName; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_FILENAME); query.bindValue(":data", filename); query.exec(); } if (ra.attachment.isSet()) { bool attachment = ra.attachment; query.bindValue(":lid", lid); query.bindValue(":key", RESOURCE_ATTACHMENT); query.bindValue(":data", attachment); query.exec(); } } query.finish(); db->unlock(); NoteIndexer indexer(db); indexer.indexResource(lid); return lid; }
// Get all resources for a note void ResourceTable::getAllResources(QList<Resource> &list, qint32 noteLid, bool fullLoad, bool withBinary) { //NoteTable ntable(db); //QString noteGuid = ntable.getGuid(noteLid); NSqlQuery query(db); db->lockForRead(); QHash<qint32, Resource*> lidMap; if (fullLoad){ query.prepare("Select key, data, lid from datastore where lid in (select lid from datastore where key=:key2 and data=:noteLid) order by lid"); query.bindValue(":key2", RESOURCE_NOTE_LID); query.bindValue(":noteLid", noteLid); } else { query.prepare("Select key, data, lid from datastore where key=:key and lid in (select lid from datastore where key=:key2 and data=:noteLid) order by lid"); query.bindValue(":key", RESOURCE_GUID); query.bindValue(":key2", RESOURCE_NOTE_LID); query.bindValue(":noteLid", noteLid); } Resource *r = NULL; query.exec(); while (query.next()) { qint32 lid = query.value(2).toInt(); if (!lidMap.contains(lid)) { r = new Resource(); lidMap.insert(lid, r); } else { r = lidMap[lid]; } mapResource(query, *r); } query.finish(); db->unlock(); // if we need binary data, read it in. Then add to the list QHash<qint32, Resource*>::iterator i; list.clear(); for (i=lidMap.begin(); i!=lidMap.end(); ++i) { if (withBinary && fullLoad) { Resource *r = i.value(); qint32 lid = i.key(); QString mimetype = r->mime; MimeReference ref; QString filename; ResourceAttributes attributes; if (r->attributes.isSet()) attributes = r->attributes; if (attributes.fileName.isSet()) filename = attributes.fileName; QString fileExt = ref.getExtensionFromMime(mimetype, filename); QFile tfile(global.fileManager.getDbDirPath("/dba/"+QString::number(lid)) +fileExt ); if (!tfile.open(QIODevice::ReadOnly)) { QDir dir(global.fileManager.getDbaDirPath()); QStringList filterList; filterList.append(QString::number(lid)+".*"); QStringList list= dir.entryList(filterList, QDir::Files); if (list.size() > 0) { tfile.setFileName(global.fileManager.getDbaDirPath()+list[0]); tfile.open(QIODevice::ReadOnly); } } QByteArray b = tfile.readAll(); Data d; if (r->data.isSet()) d = r->data; d.body = b; r->data = d; tfile.close(); } list.append(*i.value()); } }
// Modify the en-media tag into an attachment void NoteFormatter::modifyApplicationTags(QWebElement &enmedia, QString &hash, QString appl) { if (appl.toLower() == "vnd.evernote.ink") { inkNote = true; readOnly = true; buildInkNote(enmedia, hash); return; } ResourceTable resTable(global.db); QString contextFileName; qint32 resLid = resTable.getLidByHashHex(note.guid, hash); Resource r; resTable.get(r, resLid, false); if (!r.data.isSet()) resourceError = true; else { // If we are running the formatter and we are not generating a thumbnail QString mimetype = ""; if (r.mime.isSet()) mimetype = r.mime; if (mimetype == "application/pdf" && pdfPreview && !thumbnail) { modifyPdfTags(resLid, enmedia); return; } // If we are running the formatter so we can generate a thumbnail and it is a PDF if (mimetype == "application/pdf" && pdfPreview && thumbnail) { QString printImageFile = global.fileManager.getTmpDirPath() + QString::number(resLid) +QString("-print.jpg"); QString file = global.fileManager.getDbaDirPath() + QString::number(resLid) +".pdf"; Poppler::Document *doc; doc = Poppler::Document::load(file); if (doc == NULL) return; QImage *image = new QImage(doc->page(0)->renderToImage()); image->save(printImageFile,"jpg"); delete image; enmedia.setAttribute("src", printImageFile); enmedia.removeAttribute("hash"); enmedia.removeAttribute("type"); enmedia.setOuterXml(enmedia.toOuterXml().replace("<en-media","<img")); enmedia.setOuterXml(enmedia.toOuterXml().replace("</en-media>","</img>")); return; } QString fileDetails = ""; MimeReference ref; ResourceAttributes attributes; if (r.attributes.isSet()) attributes = r.attributes; if (attributes.fileName.isSet()) fileDetails = ref.getExtensionFromMime(r.mime, fileDetails); enmedia.setAttribute("href", QString("nnres:") +global.fileManager.getDbaDirPath()+QString::number(resLid) +fileDetails); contextFileName = global.fileManager.getTmpDirPath("")+QString::number(resLid) +global.attachmentNameDelimeter + fileDetails; // Setup the context menu. This is useful if we want to do a "save as" or such contextFileName = contextFileName.replace("\\", "/"); enmedia.setAttribute("onContextMenu", "window.browserWindow.resourceContextMenu('" +contextFileName +"');"); enmedia.setAttribute("en-tag", "en-media"); enmedia.setAttribute("lid", QString::number(resLid)); enmedia.appendInside("<img/>"); QWebElement newText = enmedia.lastChild(); // Build an icon of the image QString fileExt; if (attributes.fileName.isSet()) fileExt = attributes.fileName; else fileExt = appl; QString fn; QString mime; if (attributes.fileName.isSet()) fn = attributes.fileName; if (r.mime.isSet()) mime = r.mime; fileExt = ref.getExtensionFromMime(mime, fn); QString icon = findIcon(resLid, r, fileExt); newText.setAttribute("src", "file:///"+icon); if (attributes.fileName.isSet()) newText.setAttribute("title",attributes.fileName); newText.setAttribute("en-tag", "temporary"); //Rename the tag to a <a> link enmedia.setOuterXml(enmedia.toOuterXml().replace("<en-media","<a")); enmedia.setOuterXml(enmedia.toOuterXml().replace("</en-media>","</a>")); } }
/* Modify an image tag. Basically we turn it back into a picture, write out the file, and modify the ENML */ void NoteFormatter::modifyImageTags(QWebElement &enMedia, QString &hash) { QString mimetype = enMedia.attribute("type"); qint32 resLid = 0; resLid = hashMap[hash]; QString highlightString = ""; if (resLid>0) { QLOG_TRACE() << "Getting resource"; Resource r = resourceMap[resLid]; QLOG_TRACE() << "resource retrieved"; MimeReference ref; QString filename; ResourceAttributes attributes; if (r.attributes.isSet()) attributes = r.attributes; if (attributes.fileName.isSet()) filename = attributes.fileName; QString type = ref.getExtensionFromMime(mimetype, filename); Data data; if (r.data.isSet()) data = r.data; if (data.size.isSet() && data.size > 0) { QString imgfile = "file:///"+global.fileManager.getDbDirPath(QString("dba/") +QString::number(resLid) +type); enMedia.setAttribute("src", imgfile); // Check if this is a LaTeX image ResourceAttributes attributes; if (r.attributes.isSet()) attributes = r.attributes; QString sourceUrl = ""; if (attributes.sourceURL.isSet()) sourceUrl = attributes.sourceURL; if (sourceUrl.toLower().startsWith("http://latex.codecogs.com/gif.latex?")) { enMedia.appendInside("<img/>"); QWebElement newText = enMedia.lastChild(); enMedia.setAttribute("en-tag", "en-latex"); newText.setAttribute("onMouseOver", "style.cursor='pointer'"); newText.setAttribute("title", sourceUrl); newText.setAttribute("href", "latex://"+QString::number(resLid)); } enMedia.setAttribute("onContextMenu", "window.browserWindow.imageContextMenu('" +QString::number(resLid) +"', '" +QString::number(resLid) +type +"');"); highlightString = addImageHighlight(resLid, imgfile); if (highlightString != "") enMedia.setAttribute("onload", highlightString); } } else { resourceError = true; readOnly = true; } // Reset the tags to something that WebKit will understand enMedia.setAttribute("en-tag", "en-media"); enMedia.setPlainText(""); enMedia.setAttribute("lid", QString::number(resLid)); // rename the <enmedia> tag to <img> enMedia.setOuterXml(enMedia.toOuterXml().replace("<en-media","<img")); enMedia.setOuterXml(enMedia.toOuterXml().replace("</en-media>","</img>")); }
void FileWatcher::saveFile(QString file) { QFileInfo fileInfo(file); // If we have a dbi import file QLOG_DEBUG() << fileInfo.dir().absolutePath() + QDir::separator(); QLOG_DEBUG() << global.fileManager.getDbiDirPath(); if ((fileInfo.dir().absolutePath() + QDir::separator()) == global.fileManager.getDbiDirPath()) { BatchImport importer; importer.import(file); emit(nnexImported()); QFile f(file); f.remove(); return; } // If we have a user-import file QFile f(file); f.open(QIODevice::ReadOnly); QByteArray data = f.readAll(); f.close(); if (f.size() == 0) return; Note newNote; NoteTable ntable(global.db); ConfigStore cs(global.db); qint32 lid = cs.incrementLidCounter(); QCryptographicHash md5hash(QCryptographicHash::Md5); QByteArray hash = md5hash.hash(data, QCryptographicHash::Md5); // * Start setting up the new note newNote.guid = QString::number(lid); newNote.title = file; NotebookTable bookTable(global.db); QString notebook; bookTable.getGuid(notebook, notebookLid); newNote.notebookGuid = notebook; QString newNoteBody = QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")+ QString("<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">")+ QString("<en-note style=\"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;\">"); MimeReference mimeRef; QString mime = mimeRef.getMimeFromFileName(file); QString enMedia =QString("<en-media hash=\"") +hash.toHex() +QString("\" border=\"0\"") +QString(" type=\"" +mime +"\" ") +QString("/>"); newNoteBody.append(enMedia + QString("</en-note>")); newNote.content = newNoteBody; newNote.active = true; newNote.created = QDateTime::currentMSecsSinceEpoch();; newNote.updated = newNote.created; newNote.updateSequenceNum = 0; NoteAttributes na; na.sourceURL = "file://" + file; newNote.attributes = na; qint32 noteLid = lid; ntable.add(lid, newNote, true); QString noteGuid = ntable.getGuid(lid); lid = cs.incrementLidCounter(); // Start creating the new resource Resource newRes; Data d; d.body = data; d.bodyHash = hash; d.size = data.size(); newRes.data = d; newRes.mime = mime; ResourceAttributes ra; ra.fileName = file; if (mime.startsWith("image", Qt::CaseInsensitive) || mime.endsWith("pdf", Qt::CaseInsensitive)) ra.attachment = false; else ra.attachment = true; newRes.active = true; newRes.guid = QString::number(lid); newRes.noteGuid = noteGuid; newRes.updateSequenceNum = 0; ResourceTable restable(global.db); restable.add(lid, newRes, true, noteLid); emit(fileImported(noteLid, lid)); if (scanType == FileWatcher::ImportDelete) { QLOG_DEBUG() << f.remove(); } }
// Modify the en-media tag into an attachment void NoteFormatter::modifyApplicationTags(QDomDocument &doc, QDomElement &docElem, QDomElement &enmedia, QDomAttr &hash, QString appl) { QLOG_TRACE() << "Entering NeverNote.modifyApplicationTags"; if (appl.toLower() == "vnd.evernote.ink") { inkNote = true; readOnly = true; buildInkNote(enmedia, hash); QLOG_DEBUG() << doc.toString(); return; } ResourceTable resTable; QString contextFileName; qint32 resLid = resTable.getLidByHashHex(QString::fromStdString(note.guid), hash.value()); Resource r; resTable.get(r, resLid); if (!r.__isset.data) resourceError = true; else { if (r.mime == "application/pdf" && pdfPreview) { modifyPdfTags(resLid, enmedia); return; } QString fileDetails = ""; MimeReference ref; if (r.__isset.attributes && r.attributes.__isset.fileName) fileDetails = QString::fromStdString(r.attributes.fileName); fileDetails = ref.getExtensionFromMime(QString::fromStdString(r.mime), fileDetails); if (fileDetails != "") { if (!noteHistory) { enmedia.setAttribute("href", QString("nnres:") +QString::number(resLid) +global.attachmentNameDelimeter +fileDetails); contextFileName = global.fileManager.getTmpDirPath(QString::number(resLid) +global.attachmentNameDelimeter + fileDetails); } else { enmedia.setAttribute("href", QString("nnres:") +QString::number(resLid) +QString("-")+ QString::number(note.updateSequenceNum) +global.attachmentNameDelimeter +fileDetails); contextFileName = global.fileManager.getTmpDirPath(QString::number(resLid) +QString("-")+ QString(note.updateSequenceNum) +global.attachmentNameDelimeter + fileDetails); } } else { if (!noteHistory) { enmedia.setAttribute("href", "nnres:" +QString::number(resLid) +QString("-") +QString(note.updateSequenceNum) +global.attachmentNameDelimeter +appl); contextFileName = global.fileManager.getTmpDirPath(QString::number(resLid) +QString("-") +QString(note.updateSequenceNum) +global.attachmentNameDelimeter + appl); } else { enmedia.setAttribute("href", "nnres:" +QString::number(resLid) +global.attachmentNameDelimeter +appl); contextFileName = global.fileManager.getTmpDirPath(QString::number(resLid) +global.attachmentNameDelimeter + appl); } } // Setup the context menu. This is useful if we want to do a "save as" or such contextFileName = contextFileName.replace("\\", "/"); enmedia.setAttribute("onContextMenu", "window.browserWindow.resourceContextMenu('" +contextFileName +"');"); enmedia.setAttribute("en-tag", "en-media"); enmedia.setAttribute("lid", QString::number(resLid)); enmedia.setTagName("a"); QDomElement newText = doc.createElement("img"); QFile tfile(contextFileName); tfile.open(QIODevice::WriteOnly); tfile.close(); // Build an icon of the image QString fileExt; if (r.__isset.attributes && r.attributes.__isset.fileName) fileExt = QString::fromStdString(r.attributes.fileName); else fileExt = appl; fileExt = ref.getExtensionFromMime(r.mime, r.attributes.fileName); QString icon = findIcon(resLid, r, fileExt); newText.setAttribute("src", "file:///"+icon); if (r.__isset.attributes && r.attributes.__isset.fileName) newText.setAttribute("title",QString::fromStdString(r.attributes.fileName)); newText.setAttribute("en-tag", "temporary"); enmedia.removeChild(enmedia.firstChild()); enmedia.appendChild(newText); QLOG_TRACE() << "Leaving NeverNote.modifyApplicationTags"; } }