Skip to content

Add rename local project option - #4633

Open
xkello wants to merge 2 commits into
masterfrom
feature/add-edit-local-project-name
Open

Add rename local project option#4633
xkello wants to merge 2 commits into
masterfrom
feature/add-edit-local-project-name

Conversation

@xkello

@xkello xkello commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

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

  • Added rename flow via app/projectsmodel.h and app/projectsmodel.cpp: ProjectsModel now exposes and forwards rename requests.
  • Implemented rename logic in core/localprojectsmanager.h and core/localprojectsmanager.cpp: LocalProjectsManager now renames by project id and returns validation feedback as a string (empty on success, message on failure).
  • Added local rename persistence in core/localprojectsmanager.cpp: renamed local project names are stored in QSettings under localProjectNames and restored on reload.
  • Added cleanup of persisted rename keys in core/localprojectsmanager.cpp: when a local project is removed, its stored custom name is removed as well.
  • Added rename drawer UI in app/qml/dialogs/MMRenameProjectDialog.qml: input, confirm action, inline error row (icon + text), and red error styling on invalid state.
  • Wired rename interaction in app/qml/project/MMProjectList.qml: local-only project menu now includes rename, opens dialog with current project name, and handles success/failure responses.
  • Applied local name display consistency in app/qml/project/MMProjectList.qml: delegate uses project name so renamed local values are reflected immediately.
  • Enforced guards in core/localprojectsmanager.cpp: empty name, invalid name, and duplicate name are rejected.

Behaviour

  • In Home tab project list, local-only projects (not yet pushed/synced) now show a Rename option in the 3-dot menu.
  • Tapping Rename opens a drawer with current project name prefilled.
  • Confirm with valid input renames the project immediately and closes the drawer.
  • Confirm with invalid input keeps the drawer open, highlights the input in error colors, and shows an inline error message with icon.
  • Renamed local names persist across app reloads.
  • Rename is not offered for projects that are already on server / synced.

Media:

Screencast.From.2026-07-30.13-49-31.webm

TLDR for @Withalion

  • Added end-to-end rename path: project list action -> ProjectsModel -> LocalProjectsManager.
  • Added local rename persistence with QSettings and restore-on-reload.
  • Added rename guards: empty, invalid, duplicate.
  • Added inline error UI (icon + message + red input state) in rename drawer.
  • Rename action is available only for local-only (not pushed/synced) projects.

@xkello xkello added this to the 2026.4.0 milestone Jul 30, 2026
@xkello
xkello requested review from Withalion and Copilot July 30, 2026 11:55
@github-actions

Copy link
Copy Markdown

Coverage Report for CI Build 30539196363

Coverage decreased (-0.09%) to 59.045%

Details

  • Coverage decreased (-0.09%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 79 coverage regressions across 5 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

79 previously-covered lines in 5 files lost coverage.

File Lines Losing Coverage Coverage
mm/core/localprojectsmanager.cpp 43 65.77%
mm/app/projectsmodel.cpp 27 69.07%
mm/core/merginapi.cpp 7 74.79%
mm/app/position/providers/simulatedpositionprovider.cpp 1 91.67%
mm/core/merginuserinfo.cpp 1 79.08%

Coverage Stats

Coverage Status
Relevant Lines: 15710
Covered Lines: 9276
Line Coverage: 59.05%
Coverage Strength: 96.99 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 ProjectsModelLocalProjectsManager.
  • Implemented rename validation + persistence (store/restore) for local-only project display names using QSettings.
  • Introduced MMRenameProjectDialog with 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.

Comment on lines +277 to +282
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
Comment on lines +335 to +338
else {
renameDialog.newProjectName = ""
renameDialog.showRenameError( renameResult )
}
Comment on lines +289 to +310
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();
@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 71271 dmg Expires: 28/10/2026 #7127
linux Build 📬 Mergin Maps 71531 x86_64 Expires: 28/10/2026 #7153
win64 Build 📬 Mergin Maps 63291 win64 Expires: 28/10/2026 #6329
Android Build 📬 Mergin Maps 843851 APK [arm64-v8a] Expires: 28/10/2026 #8438
📬 Mergin Maps 843851 APK [arm64-v8a] Google Play Store #8438
Android Build 📬 Mergin Maps 843811 APK [armeabi-v7a] Expires: 28/10/2026 #8438
📬 Mergin Maps 843811 APK [armeabi-v7a] Google Play Store #8438
iOS Build Build failed or not found. #9379

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 71281 dmg Expires: 28/10/2026 #7128
linux Build 📬 Mergin Maps 71541 x86_64 Expires: 28/10/2026 #7154
win64 Build 📬 Mergin Maps 63301 win64 Expires: 28/10/2026 #6330
Android Build 📬 Mergin Maps 843911 APK [armeabi-v7a] Expires: 28/10/2026 #8439
📬 Mergin Maps 843911 APK [armeabi-v7a] Google Play Store #8439
Android Build 📬 Mergin Maps 843951 APK [arm64-v8a] Expires: 28/10/2026 #8439
📬 Mergin Maps 843951 APK [arm64-v8a] Google Play Store #8439
iOS Build 📬 Build number: 26.07.938011 #9380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support to rename local projects

2 participants