if (!query.prepare("delete from SystemIcon where name=:name and type=:type"))
logger.log(logger.EXTREME, "Error preparing notebook icon select.");
} else {
if (!query.prepare("update SystemIcon set icon=:icon where name=:name and type=:type"))
logger.log(logger.EXTREME, "Error preparing notebook icon select.");
QBuffer buffer = new QBuffer();
if (!buffer.open(QIODevice.OpenModeFlag.ReadWrite)) {
logger.log(logger.EXTREME, "Failure to open buffer. Aborting.");
return;
}
QPixmap p = icon.pixmap(32, 32);
QImage i = p.toImage();
i.save(buffer, filetype.toUpperCase());
buffer.close();
QByteArray b = new QByteArray(buffer.buffer());
if (!b.isNull() && !b.isEmpty())
query.bindValue(":icon", b.toByteArray());
else
return;
}