void ContentNode::fromPath(ContentNode & node,const QString &path) { node.clear(); QFileInfo info(path); node.mutable_name() = info.fileName(); node.mutable_location() = info.path(); node.mutable_size() = info.size(); }
bool ContentNode::removeContentNode(QSqlDatabase& database, ContentNode& node) { QSqlQuery query(database); query.prepare( "delete from content where id = ?"); query.addBindValue(node.id()); if (query.exec()) { node.clear(); return true; } return false; }