Use UUIDs instead of paths to match osprober entries with partitions.

This commit is contained in:
Teo Mrnjavac 2016-07-28 17:42:45 +02:00
parent 811261258b
commit 849137c20b

View File

@ -205,27 +205,37 @@ PartitionModel::data( const QModelIndex& index, int role ) const
// Osprober roles: // Osprober roles:
case OsproberNameRole: case OsproberNameRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
if ( osproberEntry.path == partition->partitionPath() ) if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone &&
!partition->fileSystem().uuid().isEmpty() &&
osproberEntry.uuid == partition->fileSystem().uuid() )
return osproberEntry.prettyName; return osproberEntry.prettyName;
return QVariant(); return QVariant();
case OsproberPathRole: case OsproberPathRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
if ( osproberEntry.path == partition->partitionPath() ) if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone &&
!partition->fileSystem().uuid().isEmpty() &&
osproberEntry.uuid == partition->fileSystem().uuid() )
return osproberEntry.path; return osproberEntry.path;
return QVariant(); return QVariant();
case OsproberCanBeResizedRole: case OsproberCanBeResizedRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
if ( osproberEntry.path == partition->partitionPath() ) if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone &&
!partition->fileSystem().uuid().isEmpty() &&
osproberEntry.uuid == partition->fileSystem().uuid() )
return osproberEntry.canBeResized; return osproberEntry.canBeResized;
return QVariant(); return QVariant();
case OsproberRawLineRole: case OsproberRawLineRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
if ( osproberEntry.path == partition->partitionPath() ) if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone &&
!partition->fileSystem().uuid().isEmpty() &&
osproberEntry.uuid == partition->fileSystem().uuid() )
return osproberEntry.line; return osproberEntry.line;
return QVariant(); return QVariant();
case OsproberHomePartitionPathRole: case OsproberHomePartitionPathRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
if ( osproberEntry.path == partition->partitionPath() ) if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone &&
!partition->fileSystem().uuid().isEmpty() &&
osproberEntry.uuid == partition->fileSystem().uuid() )
return osproberEntry.homePath; return osproberEntry.homePath;
return QVariant(); return QVariant();
// end Osprober roles. // end Osprober roles.