MCPcopy Create free account
hub / github.com/YACReader/yacreader / updateTreeType

Method updateTreeType

YACReaderLibrary/db/folder_model.cpp:682–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

680}
681
682void 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
711void FolderModel::setCustomFolderCover(const QModelIndex &index, const QString &path)
712{

Callers 1

setCurrentLibraryAsMethod · 0.80

Calls 2

setDataMethod · 0.45
childrenMethod · 0.45

Tested by

no test coverage detected