MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / stripContentsForPrint

Method stripContentsForPrint

cmdtools/emailnote.cpp:232–245  ·  view source on GitHub ↗

Strip the contents from the current webview in preparation for printing.

Source from the content-addressed store, hash-verified

230
231// Strip the contents from the current webview in preparation for printing.
232QString EmailNote::stripContentsForPrint(QString contents) {
233 int pos = contents.indexOf("<object");
234 while (pos != -1) {
235 int endPos = contents.indexOf(">", pos);
236 QString lidString = contents.mid(contents.indexOf("lid=", pos)+5);
237 lidString = lidString.mid(0,lidString.indexOf("\" "));
238 contents = contents.mid(0,pos) + "<img src=\"file://" +
239 global.fileManager.getTmpDirPath() + lidString +
240 QString("-print.png\" width=\"10%\" height=\"10%\"></img>")+contents.mid(endPos+1);
241
242 pos = contents.indexOf("<object", endPos);
243 }
244 return contents.replace("src=\"file:////", "src=\"/");
245}
246
247
248

Callers 1

prepareEmailMessageMethod · 0.95

Calls 2

getTmpDirPathMethod · 0.80
QStringClass · 0.50

Tested by

no test coverage detected