| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2006 Davide Bettio <davide.bettio@kdemail.net> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #include "fakevolume.h" |
| 8 | #include <QVariant> |
| 9 | |
| 10 | using namespace Solid::Backends::Fake; |
| 11 | |
| 12 | FakeVolume::FakeVolume(FakeDevice *device) |
| 13 | : FakeBlock(device) |
| 14 | { |
| 15 | } |
| 16 | |
| 17 | FakeVolume::~FakeVolume() |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | bool FakeVolume::isIgnored() const |
| 22 | { |
| 23 | return fakeDevice()->property(QStringLiteral("isIgnored")).toBool(); |
| 24 | } |
| 25 | |
| 26 | Solid::StorageVolume::UsageType FakeVolume::usage() const |
| 27 | { |
| 28 | QString usage = fakeDevice()->property(QStringLiteral("usage")).toString(); |
| 29 | |
| 30 | if (usage == QLatin1String("filesystem")) { |
| 31 | return Solid::StorageVolume::FileSystem; |
| 32 | } else if (usage == QLatin1String("partitiontable")) { |
| 33 | return Solid::StorageVolume::PartitionTable; |
| 34 | } else if (usage == QLatin1String("raid")) { |
| 35 | return Solid::StorageVolume::Raid; |
| 36 | } else if (usage == QLatin1String("unused")) { |
| 37 | return Solid::StorageVolume::Unused; |
| 38 | } else if (usage == QLatin1String("encrypted")) { |
| 39 | return Solid::StorageVolume::Encrypted; |
| 40 | } else { |
| 41 | return Solid::StorageVolume::Other; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | QString FakeVolume::fsType() const |
| 46 | { |
| 47 | return fakeDevice()->property(QStringLiteral("fsType")).toString(); |
| 48 | } |
| 49 | |
| 50 | QString FakeVolume::label() const |
| 51 | { |
| 52 | return fakeDevice()->property(QStringLiteral("label")).toString(); |
| 53 | } |
| 54 | |
| 55 | QString FakeVolume::uuid() const |
| 56 | { |
| 57 | return fakeDevice()->property(QStringLiteral("uuid")).toString(); |
| 58 | } |
| 59 | |
| 60 | qulonglong FakeVolume::size() const |
| 61 | { |
| 62 | return fakeDevice()->property(QStringLiteral("size")).toULongLong(); |
| 63 | } |
| 64 | |
| 65 | QString Solid::Backends::Fake::FakeVolume::encryptedContainerUdi() const |
| 66 | { |
| 67 | return QString(); |
| 68 | } |
| 69 | |
| 70 | #include "moc_fakevolume.cpp" |
| 71 |
