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

Commit a0754ba

Browse files
committed
Merge branch 'jb44456' into 'master'
Mount an external storage with fs type that block device has See merge request mer-core/nemo-qml-plugin-systemsettings!98
2 parents ba97282 + ed7d2e8 commit a0754ba

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)