MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / moveFolderToFolder

Method moveFolderToFolder

app/src/DataModel/ProjectModel.cpp:6151–6175  ·  view source on GitHub ↗

* @brief Re-parents a folder, rejecting a cyclic move into its own subtree. */

Source from the content-addressed store, hash-verified

6149 * @brief Re-parents a folder, rejecting a cyclic move into its own subtree.
6150 */
6151void 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.

Callers

nothing calls this directly

Calls 2

folderExistsFunction · 0.85
folderIsSelfOrDescendantFunction · 0.85

Tested by

no test coverage detected