Add rename local project option - #4633
Conversation
Coverage Report for CI Build 30539196363Coverage decreased (-0.09%) to 59.045%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions79 previously-covered lines in 5 files lost coverage.
Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
🟡 Not ready to approve
The current rename implementation has a confirmed out-of-bounds crash risk/incorrect duplicate validation, plus UI/display regressions that should be fixed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR adds an end-to-end “rename local project” flow for projects that exist only on-device (not yet pushed/synced), including UI (rename drawer + inline validation feedback), model wiring, and persistence of custom local names across app restarts via QSettings.
Changes:
- Added a rename action to the local-only project overflow menu and wired it through
ProjectsModel→LocalProjectsManager. - Implemented rename validation + persistence (store/restore) for local-only project display names using
QSettings. - Introduced
MMRenameProjectDialogwith inline error display while keeping the drawer layout stable.
File summaries
| File | Description |
|---|---|
| gallery/qml/pages/ProjectItemsPage.qml | Adds rename to the gallery project action buttons and logs rename requests. |
| gallery/qml/pages/DrawerPage.qml | Adds a gallery entry point to open MMRenameProjectDialog. |
| core/localprojectsmanager.h | Exposes renameLocalProject(projectId, newName) to QML. |
| core/localprojectsmanager.cpp | Implements rename validation, persistence (QSettings), restore-on-reload, and cleanup on removal. |
| app/qml/project/MMProjectList.qml | Adds Rename menu option for local-only projects and wires dialog confirm → controller rename call. |
| app/qml/project/components/MMProjectDelegate.qml | Adds the rename action type and menu item definition. |
| app/qml/dialogs/MMRenameProjectDialog.qml | New drawer UI for renaming with inline error row and input error styling. |
| app/qml/CMakeLists.txt | Registers the new MMRenameProjectDialog.qml in the build. |
| app/projectsmodel.h | Adds ProjectsModel::renameLocalProject QML invokable API. |
| app/projectsmodel.cpp | Forwards rename calls to LocalProjectsManager. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 4
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| QString LocalProjectsManager::renameLocalProject( const QString &projectId, const QString &newName ) | ||
| { | ||
| if ( newName.trimmed().isEmpty() ) | ||
| { | ||
| return tr( "The project name cannot be empty" ); | ||
| } |
| height: visible ? implicitHeight : 0 | ||
|
|
||
| projectDisplayName: root.projectModelType === MM.ProjectsModel.WorkspaceProjectsModel ? model.ProjectName : model.ProjectFullName | ||
| projectDisplayName: model.ProjectName |
| else { | ||
| renameDialog.newProjectName = "" | ||
| renameDialog.showRenameError( renameResult ) | ||
| } |
| int projectIndex = -1; | ||
| for ( int i = 0; i < mProjects.count(); ++i ) | ||
| { | ||
| if ( mProjects[i].id() == projectId ) | ||
| { | ||
| projectIndex = i; | ||
| } | ||
|
|
||
| if ( i != projectIndex && mProjects[i].projectName == newName ) | ||
| { | ||
| return tr( "A project name is already taken" ); | ||
| } | ||
| } | ||
|
|
||
| QSettings settings; | ||
| settings.beginGroup( CoreUtils::QSETTINGS_APP_GROUP_NAME ); | ||
| settings.setValue( sLocalProjectNameSettingsGroup + "/" + mProjects[projectIndex].projectDir, newName ); | ||
| settings.endGroup(); | ||
|
|
||
| mProjects[projectIndex].projectName = newName; | ||
| emit localProjectDataChanged( mProjects[projectIndex] ); | ||
| return QString(); |
📦 Build Artifacts Ready
|
📦 Build Artifacts Ready
|
Description
This PR enables renaming of local projects before they are published to server.
It adds a rename action for local-only projects, validates user input on confirm, and shows inline error feedback in the rename drawer while keeping the drawer layout stable.
Fixes: #4603
What Changed
app/projectsmodel.handapp/projectsmodel.cpp:ProjectsModelnow exposes and forwards rename requests.core/localprojectsmanager.handcore/localprojectsmanager.cpp:LocalProjectsManagernow renames by project id and returns validation feedback as a string (empty on success, message on failure).core/localprojectsmanager.cpp: renamed local project names are stored inQSettingsunderlocalProjectNamesand restored on reload.core/localprojectsmanager.cpp: when a local project is removed, its stored custom name is removed as well.app/qml/dialogs/MMRenameProjectDialog.qml: input, confirm action, inline error row (icon + text), and red error styling on invalid state.app/qml/project/MMProjectList.qml: local-only project menu now includes rename, opens dialog with current project name, and handles success/failure responses.app/qml/project/MMProjectList.qml: delegate uses project name so renamed local values are reflected immediately.core/localprojectsmanager.cpp: empty name, invalid name, and duplicate name are rejected.Behaviour
Media:
Screencast.From.2026-07-30.13-49-31.webm
TLDR for @Withalion
ProjectsModel->LocalProjectsManager.QSettingsand restore-on-reload.