QDataStream out = new QDataStream(file);
Resource resBinary = conn.getNoteTable().noteResourceTable.getNoteResource(res.getGuid(), true);
QByteArray binData = new QByteArray(resBinary.getData().getBody());
resBinary = null;
logger.log(logger.EXTREME, "Writing resource");
out.writeBytes(binData.toByteArray());
file.close();
String whichOS = System.getProperty("os.name");
if (whichOS.contains("Windows"))
url.setUrl("file:///"+file.fileName());