7#include "fakestorage.h"
10using namespace Solid::Backends::Fake;
12FakeStorage::FakeStorage(FakeDevice *device)
17FakeStorage::~FakeStorage()
23 QString bus = fakeDevice()->property(QStringLiteral(
"bus")).toString();
25 if (bus == QLatin1String(
"ide")) {
26 return Solid::StorageDrive::Ide;
27 }
else if (bus == QLatin1String(
"usb")) {
28 return Solid::StorageDrive::Usb;
29 }
else if (bus == QLatin1String(
"ieee1394")) {
30 return Solid::StorageDrive::Ieee1394;
31 }
else if (bus == QLatin1String(
"scsi")) {
32 return Solid::StorageDrive::Scsi;
33 }
else if (bus == QLatin1String(
"sata")) {
34 return Solid::StorageDrive::Sata;
36 return Solid::StorageDrive::Platform;
42 QString
type = fakeDevice()->property(QStringLiteral(
"major")).toString();
44 if (type == QLatin1String(
"disk")) {
45 return Solid::StorageDrive::HardDisk;
46 }
else if (type == QLatin1String(
"cdrom")) {
47 return Solid::StorageDrive::CdromDrive;
48 }
else if (type == QLatin1String(
"floppy")) {
49 return Solid::StorageDrive::Floppy;
50 }
else if (type == QLatin1String(
"tape")) {
51 return Solid::StorageDrive::Tape;
52 }
else if (type == QLatin1String(
"compact_flash")) {
53 return Solid::StorageDrive::CompactFlash;
54 }
else if (type == QLatin1String(
"memory_stick")) {
55 return Solid::StorageDrive::MemoryStick;
56 }
else if (type == QLatin1String(
"smart_media")) {
57 return Solid::StorageDrive::SmartMedia;
58 }
else if (type == QLatin1String(
"sd_mmc")) {
59 return Solid::StorageDrive::SdMmc;
61 return Solid::StorageDrive::HardDisk;
65bool FakeStorage::isRemovable()
const
67 return fakeDevice()->property(QStringLiteral(
"isRemovable")).toBool();
70bool FakeStorage::isHotpluggable()
const
72 return fakeDevice()->property(QStringLiteral(
"isHotpluggable")).toBool();
75qulonglong FakeStorage::size()
const
77 return fakeDevice()->property(QStringLiteral(
"size")).toULongLong();
80QDateTime FakeStorage::timeDetected()
const
82 return fakeDevice()->property(QStringLiteral(
"timeDetected")).toDateTime();
85QDateTime FakeStorage::timeMediaDetected()
const
87 return fakeDevice()->property(QStringLiteral(
"timeMediaDetected")).toDateTime();
90#include "moc_fakestorage.cpp"
DriveType
This enum type defines the type of drive a storage device can be.
Bus
This enum type defines the type of bus a storage device is attached to.
Type type(const QSqlDatabase &db)