Commit 8afa0c35 authored by Raine Makelainen's avatar Raine Makelainen

Change objectPath internals to devicePath based

parent 880055f6
......@@ -327,12 +327,13 @@ void PartitionManagerPrivate::format(const QString &devicePath, const QString &t
}
}
QString PartitionManagerPrivate::objectPath(const Partition &partition) const
QString PartitionManagerPrivate::objectPath(const QString &devicePath) const
{
if (externalMedia.match(partition.deviceName()).hasMatch()) {
return m_udisksMonitor->instance()->objectPath(partition.devicePath());
QString deviceName = devicePath.section(QChar('/'), 2);
if (externalMedia.match(deviceName).hasMatch()) {
return m_udisksMonitor->instance()->objectPath(devicePath);
} else {
qCWarning(lcMemoryCardLog) << "Object path existing only for external memory cards:" << partition.devicePath();
qCWarning(lcMemoryCardLog) << "Object path existing only for external memory cards:" << devicePath;
return QString();
}
}
......
......@@ -72,7 +72,7 @@ public:
void unmount(const Partition &partition);
void format(const QString &devicePath, const QString &type, const QString &label, const QString &passphrase);
QString objectPath(const Partition &partition) const;
QString objectPath(const QString &devicePath) const;
QStringList supportedFileSystems() const;
......
......@@ -168,12 +168,7 @@ void PartitionModel::format(const QString &devicePath, const QString &type, cons
QString PartitionModel::objectPath(const QString &devicePath) const
{
qCInfo(lcMemoryCardLog) << Q_FUNC_INFO << devicePath;
if (const Partition *partition = getPartition(devicePath)) {
return m_manager->objectPath(*partition);
} else {
qCWarning(lcMemoryCardLog) << "Unable to get object path for unknown device:" << devicePath;
return QString();
}
return m_manager->objectPath(devicePath);
}
void PartitionModel::update()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment