forked from qt-creator/qt-creator
File System view: Fix that projects could be duplicated
It is not possible to use the display name as an ID, because that can change (and to propagate that change we use the ID). Remove the display name from the ID, use a separate sort property, and sort by this property + display name. Task-number: QTCREATORBUG-18972 Change-Id: I27017473842931defa3a123ce9f41cc8e8ba1a61 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -120,9 +120,11 @@ static SessionManagerPrivate *d = nullptr;
|
||||
|
||||
static QString projectFolderId(Project *pro)
|
||||
{
|
||||
return "P." + pro->displayName() + "." + pro->projectFilePath().toString();
|
||||
return pro->projectFilePath().toString();
|
||||
}
|
||||
|
||||
const int PROJECT_SORT_VALUE = 100;
|
||||
|
||||
SessionManager::SessionManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_instance = this;
|
||||
@@ -392,8 +394,10 @@ void SessionManager::addProject(Project *pro)
|
||||
|
||||
emit m_instance->projectAdded(pro);
|
||||
const auto updateFolderNavigation = [pro] {
|
||||
FolderNavigationWidgetFactory::insertRootDirectory(
|
||||
{projectFolderId(pro), pro->displayName(), pro->projectFilePath().parentDir()});
|
||||
FolderNavigationWidgetFactory::insertRootDirectory({projectFolderId(pro),
|
||||
PROJECT_SORT_VALUE,
|
||||
pro->displayName(),
|
||||
pro->projectFilePath().parentDir()});
|
||||
};
|
||||
updateFolderNavigation();
|
||||
configureEditors(pro);
|
||||
|
||||
Reference in New Issue
Block a user