@@ -261,7 +261,8 @@ bool UDisks2::Block::isReadOnly() const
261
261
bool UDisks2::Block::isExternal () const
262
262
{
263
263
const QString prefDevice = preferredDevice ();
264
- return prefDevice != QStringLiteral (" /dev/sailfish/home" ) && prefDevice != QStringLiteral (" /dev/sailfish/root" );
264
+ return prefDevice != QStringLiteral (" /dev/sailfish/home" ) && prefDevice != QStringLiteral (" /dev/sailfish/root" )
265
+ && mountPath () != QStringLiteral (" /home" ) && mountPath () != QStringLiteral (" /" );
265
266
}
266
267
267
268
bool UDisks2::Block::isValid () const
@@ -332,7 +333,7 @@ void UDisks2::Block::addInterface(const QString &interface, QVariantMap property
332
333
{
333
334
m_interfacePropertyMap.insert (interface, propertyMap);
334
335
if (interface == UDISKS2_FILESYSTEM_INTERFACE) {
335
- setMountable ( true );
336
+ updateFileSystemInterface (propertyMap );
336
337
} else if (interface == UDISKS2_ENCRYPTED_INTERFACE) {
337
338
setEncrypted (true );
338
339
}
@@ -346,7 +347,7 @@ void UDisks2::Block::removeInterface(const QString &interface)
346
347
} else if (interface == UDISKS2_DRIVE_INTERFACE) {
347
348
m_drive.clear ();
348
349
} else if (interface == UDISKS2_FILESYSTEM_INTERFACE) {
349
- setMountable ( false );
350
+ updateFileSystemInterface ( QVariantMap () );
350
351
} else if (interface == UDISKS2_ENCRYPTED_INTERFACE) {
351
352
setEncrypted (false );
352
353
}
@@ -438,21 +439,25 @@ bool UDisks2::Block::isCompleted() const
438
439
void UDisks2::Block::updateFileSystemInterface (const QVariant &filesystemInterface)
439
440
{
440
441
QVariantMap filesystem = NemoDBus::demarshallArgument<QVariantMap>(filesystemInterface);
441
- m_interfacePropertyMap.insert (UDISKS2_FILESYSTEM_INTERFACE, filesystem);
442
+
443
+ bool interfaceChange = m_interfacePropertyMap.contains (UDISKS2_FILESYSTEM_INTERFACE) != filesystem.isEmpty ();
444
+ if (filesystem.isEmpty ()) {
445
+ m_interfacePropertyMap.remove (UDISKS2_FILESYSTEM_INTERFACE);
446
+ } else {
447
+ m_interfacePropertyMap.insert (UDISKS2_FILESYSTEM_INTERFACE, filesystem);
448
+ }
442
449
QList<QByteArray> mountPointList = NemoDBus::demarshallArgument<QList<QByteArray> >(filesystem.value (QStringLiteral (" MountPoints" )));
443
450
m_mountPath.clear ();
444
451
445
- for (const QByteArray &bytes : mountPointList) {
446
- if (bytes.startsWith (" /run" )) {
447
- m_mountPath = QString::fromLocal8Bit (bytes);
448
- break ;
449
- }
452
+ if (!mountPointList.isEmpty ()) {
453
+ m_mountPath = QString::fromLocal8Bit (mountPointList.at (0 ));
450
454
}
451
455
452
456
bool triggerUpdate = false ;
453
457
blockSignals (true );
454
- triggerUpdate = setMountable (true );
458
+ triggerUpdate = setMountable (!filesystem. isEmpty () );
455
459
triggerUpdate |= clearFormattingState ();
460
+ triggerUpdate |= interfaceChange;
456
461
blockSignals (false );
457
462
458
463
if (triggerUpdate) {
0 commit comments