| 709 | } |
| 710 | |
| 711 | void FolderModel::setCustomFolderCover(const QModelIndex &index, const QString &path) |
| 712 | { |
| 713 | QString connectionName = ""; |
| 714 | { |
| 715 | QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); |
| 716 | db.transaction(); |
| 717 | |
| 718 | auto item = static_cast<FolderItem *>(index.internalPointer()); |
| 719 | item->setData(FolderModel::CustomImage, path); |
| 720 | |
| 721 | Folder f = DBHelper::loadFolder(item->id, db); |
| 722 | f.customImage = path; |
| 723 | DBHelper::update(f, db); |
| 724 | |
| 725 | db.commit(); |
| 726 | connectionName = db.connectionName(); |
| 727 | } |
| 728 | QSqlDatabase::removeDatabase(connectionName); |
| 729 | |
| 730 | emit dataChanged(index, index); |
| 731 | } |
| 732 | |
| 733 | void FolderModel::resetFolderCover(const QModelIndex &index) |
| 734 | { |