Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/blockfilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ QString BlockFilesystem::Mount(const Block& block,
}

addMountPoint(mountPoint);
signalMountPointsChanged();
signalMountPointsChanged(block);
return mountPoint;
}

Expand Down Expand Up @@ -191,21 +191,21 @@ void BlockFilesystem::Unmount(const Block& block,
removeMountPoint(mountPoint, true);
QString errorMessage = umount.readAllStandardError();
conn.send(msg.createErrorReply("org.freedesktop.UDisks2.Error.Failed", errorMessage));
signalMountPointsChanged();
signalMountPointsChanged(block);
} else {
removeMountPoint(mountPoint, true);
mountPoints.removeAll(mountPoint);
}
}
}

void BlockFilesystem::signalMountPointsChanged()
void BlockFilesystem::signalMountPointsChanged(const Block& block)
{
QVariantMap props;
props.insert(QStringLiteral("MountPoints"), QVariant::fromValue(getMountPoints().join(",")));

QDBusMessage signal =
QDBusMessage::createSignal("", // XX parentBlock()->dbusPath.path(),
QDBusMessage::createSignal(block.getDbusPath().path(),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));

Expand All @@ -230,14 +230,21 @@ void BlockFilesystem::setFilesystem(const QString& fs)

bool BlockFilesystem::isFilesystemSupportedToMount() const
{
return (filesystem == "ffs");
return (filesystem == "ffs" || filesystem == "ext2fs" || filesystem == "ntfs" ||
filesystem == "msdos");
}

const QString BlockFilesystem::getMountCommand() const
{
QString mountProg;
if (filesystem == "ffs") {
mountProg = QStringLiteral("/sbin/mount_ffs");
} else if (filesystem == "ext2fs") {
mountProg = QStringLiteral("/sbin/mount_ext2fs");
} else if (filesystem == "ntfs") {
mountProg = QStringLiteral("/sbin/mount_ntfs");
} else if (filesystem == "ntfs") {
mountProg = QStringLiteral("/sbin/mount_msdos");
}
return mountProg;
}
Expand All @@ -247,6 +254,12 @@ const QStringList BlockFilesystem::getMountOptions() const
QStringList mountOps;
if (filesystem == "ffs") {
mountOps << QStringLiteral("-orw,nodev,nosuid,noatime");
} else if (filesystem == "ext2fs") {
mountOps << QStringLiteral("-orw,nodev,nosuid,noatime");
} else if (filesystem == "msdos") {
mountOps << QStringLiteral("-orw");
} else if (filesystem == "ntfs") {
mountOps << QStringLiteral("-oro");
}
return mountOps;
}
2 changes: 1 addition & 1 deletion src/blockfilesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BlockFilesystem
void setFilesystem(const QString&);

private:
void signalMountPointsChanged();
void signalMountPointsChanged(const Block&);
bool isFilesystemSupportedToMount() const;
const QString getMountCommand() const;
const QStringList getMountOptions() const;
Expand Down