ADS: Fix workspace dialog on removal

- Fix an issue where the list of workspaces is not correctly updated
  after removal of a workspace in the dialog
- Fix initial sorting of the workspace model

Change-Id: I0c16aabc1fdcc2690fcb83e40b0d5d16cb6c72ba
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2020-03-13 15:02:50 +01:00
committed by Henning Gründl
parent 5803448ea0
commit e3e62d852f
2 changed files with 9 additions and 7 deletions

View File

@@ -774,15 +774,16 @@ namespace ADS
if (!d->m_workspaces.contains(workspace))
return false;
d->m_workspaces.removeOne(workspace);
emit workspacesRemoved();
emit workspaceListChanged();
// Remove corresponding workspace file
QFile fi(workspaceNameToFileName(workspace).toString());
if (fi.exists())
return fi.remove();
if (fi.exists()) {
if (fi.remove()) {
d->m_workspaces.removeOne(workspace);
emit workspacesRemoved();
emit workspaceListChanged();
return true;
}
}
return false;
}

View File

@@ -53,6 +53,7 @@ WorkspaceModel::WorkspaceModel(DockManager *manager, QObject *parent)
, m_currentSortColumn(0)
{
m_sortedWorkspaces = m_manager->workspaces();
sort(m_currentSortColumn, m_currentSortOrder);
connect(m_manager, &DockManager::workspaceLoaded, this, &WorkspaceModel::resetWorkspaces);
}