* @brief Re-parents a table folder, rejecting a cyclic move into its own subtree. */
| 6650 | * @brief Re-parents a table folder, rejecting a cyclic move into its own subtree. |
| 6651 | */ |
| 6652 | void DataModel::ProjectModel::moveTableFolderToFolder(int folderId, int parentFolderId) |
| 6653 | { |
| 6654 | if (parentFolderId != -1 && !folderExists(m_tableFolders, parentFolderId)) |
| 6655 | return; |
| 6656 | |
| 6657 | if (folderIsSelfOrDescendant(m_tableFolders, folderId, parentFolderId)) |
| 6658 | return; |
| 6659 | |
| 6660 | for (auto& f : m_tableFolders) { |
| 6661 | if (f.folderId != folderId) |
| 6662 | continue; |
| 6663 | |
| 6664 | if (f.parentFolderId == parentFolderId) |
| 6665 | return; |
| 6666 | |
| 6667 | f.parentFolderId = parentFolderId; |
| 6668 | setModified(true); |
| 6669 | Q_EMIT tablesChanged(); |
| 6670 | return; |
| 6671 | } |
| 6672 | } |
| 6673 | |
| 6674 | /** |
| 6675 | * @brief Reorders a table folder among its sibling folders in the same parent. |
nothing calls this directly
no test coverage detected