Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.

Commit ed7d2e8

Browse files
committed
[nemo-storage] Mount an external storage with fs type that block device has. Contributes to JB#44456
1 parent f4375b5 commit ed7d2e8

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/udisks2monitor.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,25 @@ void UDisks2::Monitor::mount(const QString &devicePath)
174174
{
175175
QVariantList arguments;
176176
QVariantMap options;
177-
options.insert(QStringLiteral("fstype"), QString());
178-
arguments << options;
179-
startMountOperation(devicePath, UDISKS2_FILESYSTEM_MOUNT, m_blockDevices->objectPath(devicePath), arguments);
177+
178+
if (Block *block = m_blockDevices->find(devicePath)) {
179+
QString objectPath;
180+
if (block->device() == devicePath) {
181+
objectPath = block->path();
182+
} else if (block->cryptoBackingDevicePath() == devicePath) {
183+
objectPath = block->cryptoBackingDeviceObjectPath();
184+
}
185+
186+
// Find has the same condition.
187+
Q_ASSERT(!objectPath.isEmpty());
188+
189+
options.insert(QStringLiteral("fstype"), block->idType());
190+
arguments << options;
191+
startMountOperation(devicePath, UDISKS2_FILESYSTEM_MOUNT, objectPath, arguments);
192+
} else {
193+
emit mountError(Partition::ErrorOptionNotPermitted);
194+
emit status(devicePath, Partition::Unmounted);
195+
}
180196
}
181197

182198
void UDisks2::Monitor::unmount(const QString &devicePath)

0 commit comments

Comments
 (0)