* @brief Files a table into folder @p parentFolderId; rejects a leaf-name collision in the target. */
| 6624 | * @brief Files a table into folder @p parentFolderId; rejects a leaf-name collision in the target. |
| 6625 | */ |
| 6626 | void DataModel::ProjectModel::moveTableToFolder(const QString& tablePath, int parentFolderId) |
| 6627 | { |
| 6628 | if (parentFolderId != -1 && !folderExists(m_tableFolders, parentFolderId)) |
| 6629 | return; |
| 6630 | |
| 6631 | const int idx = findTableIndexByPath(tablePath); |
| 6632 | if (idx < 0) |
| 6633 | return; |
| 6634 | |
| 6635 | auto& table = m_tables[static_cast<size_t>(idx)]; |
| 6636 | if (table.parentFolderId == parentFolderId) |
| 6637 | return; |
| 6638 | |
| 6639 | for (size_t i = 0; i < m_tables.size(); ++i) |
| 6640 | if (static_cast<int>(i) != idx && m_tables[i].parentFolderId == parentFolderId |
| 6641 | && m_tables[i].name == table.name) |
| 6642 | return; |
| 6643 | |
| 6644 | table.parentFolderId = parentFolderId; |
| 6645 | setModified(true); |
| 6646 | Q_EMIT tablesChanged(); |
| 6647 | } |
| 6648 | |
| 6649 | /** |
| 6650 | * @brief Re-parents a table folder, rejecting a cyclic move into its own subtree. |
nothing calls this directly
no test coverage detected