* @brief Re-parents a folder, rejecting a cyclic move into its own subtree. */
| 6149 | * @brief Re-parents a folder, rejecting a cyclic move into its own subtree. |
| 6150 | */ |
| 6151 | void DataModel::ProjectModel::moveFolderToFolder(int folderId, int parentFolderId) |
| 6152 | { |
| 6153 | if (!m_customizeWorkspaces) |
| 6154 | setCustomizeWorkspaces(true); |
| 6155 | |
| 6156 | if (parentFolderId != -1 && !folderExists(m_workspaceFolders, parentFolderId)) |
| 6157 | return; |
| 6158 | |
| 6159 | if (folderIsSelfOrDescendant(m_workspaceFolders, folderId, parentFolderId)) |
| 6160 | return; |
| 6161 | |
| 6162 | for (auto& f : m_workspaceFolders) { |
| 6163 | if (f.folderId != folderId) |
| 6164 | continue; |
| 6165 | |
| 6166 | if (f.parentFolderId == parentFolderId) |
| 6167 | return; |
| 6168 | |
| 6169 | f.parentFolderId = parentFolderId; |
| 6170 | setModified(true); |
| 6171 | Q_EMIT editorWorkspacesChanged(); |
| 6172 | Q_EMIT activeWorkspacesChanged(); |
| 6173 | return; |
| 6174 | } |
| 6175 | } |
| 6176 | |
| 6177 | /** |
| 6178 | * @brief Reorders a workspace among its siblings in the same folder. |
nothing calls this directly
no test coverage detected