| 680 | } |
| 681 | |
| 682 | void FolderModel::updateTreeType(YACReader::FileType type) |
| 683 | { |
| 684 | QString connectionName = ""; |
| 685 | { |
| 686 | QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); |
| 687 | db.transaction(); |
| 688 | |
| 689 | auto item = rootItem; |
| 690 | |
| 691 | std::function<void(FolderItem *, YACReader::FileType)> setType; |
| 692 | setType = [&setType](FolderItem *item, YACReader::FileType type) -> void { |
| 693 | item->setData(FolderModel::Type, QVariant::fromValue(type)); |
| 694 | |
| 695 | for (auto child : item->children()) { |
| 696 | setType(child, type); |
| 697 | } |
| 698 | }; |
| 699 | |
| 700 | setType(item, type); |
| 701 | |
| 702 | if (!isSubfolder) { |
| 703 | DBHelper::updateDBType(db, type); |
| 704 | } |
| 705 | db.commit(); |
| 706 | connectionName = db.connectionName(); |
| 707 | } |
| 708 | QSqlDatabase::removeDatabase(connectionName); |
| 709 | } |
| 710 | |
| 711 | void FolderModel::setCustomFolderCover(const QModelIndex &index, const QString &path) |
| 712 | { |
no test coverage detected