Add an initial support for UDisks2 solid backend.
Currently, UDisks2 support can only be enabled at compile time. BUG:311408 svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1358151
This commit is contained in:
parent
42302a11cc
commit
6573cfd4ea
|
@ -45,6 +45,11 @@ add_definitions(${KDE4_ENABLE_EXCEPTIONS})
|
|||
include(KDE4Defaults)
|
||||
include(MacroLibrary)
|
||||
|
||||
option(ENABLE_UDISKS2 "Use UDisks2 backend." OFF)
|
||||
if (ENABLE_UDISKS2)
|
||||
add_definitions(-DENABLE_UDISKS2)
|
||||
endif (ENABLE_UDISKS2)
|
||||
|
||||
include_directories(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} lib/ src/)
|
||||
|
||||
add_subdirectory(lib)
|
||||
|
|
|
@ -447,6 +447,8 @@ static quint32 countDevices(const QList<Solid::Device>& driveList)
|
|||
|
||||
foreach(const Solid::Device& solidDevice, driveList)
|
||||
{
|
||||
(void) solidDevice; // Silence compiler warning.
|
||||
#ifndef ENABLE_UDISKS2
|
||||
const Solid::StorageDrive* solidDrive = solidDevice.as<Solid::StorageDrive>();
|
||||
if (solidDrive->driveType() == Solid::StorageDrive::HardDisk ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::CompactFlash ||
|
||||
|
@ -454,9 +456,9 @@ static quint32 countDevices(const QList<Solid::Device>& driveList)
|
|||
solidDrive->driveType() == Solid::StorageDrive::SmartMedia ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::SdMmc ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::Xd)
|
||||
#endif
|
||||
rval++;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
@ -471,6 +473,7 @@ QList<Device*> LibPartedBackend::scanDevices()
|
|||
|
||||
foreach(const Solid::Device& solidDevice, driveList)
|
||||
{
|
||||
#ifndef ENABLE_UDISKS2
|
||||
const Solid::StorageDrive* solidDrive = solidDevice.as<Solid::StorageDrive>();
|
||||
|
||||
if (solidDrive->driveType() != Solid::StorageDrive::HardDisk &&
|
||||
|
@ -480,6 +483,7 @@ QList<Device*> LibPartedBackend::scanDevices()
|
|||
solidDrive->driveType() != Solid::StorageDrive::SdMmc &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::Xd)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
const Solid::Block* solidBlock = solidDevice.as<Solid::Block>();
|
||||
|
||||
|
|
|
@ -232,9 +232,14 @@ bool checkAccessibleDevices()
|
|||
|
||||
QList<Solid::Device> getSolidDeviceList()
|
||||
{
|
||||
#ifdef ENABLE_UDISKS2
|
||||
QString predicate = "StorageVolume.usage == 'PartitionTable'";
|
||||
|
||||
#else
|
||||
QString predicate = "[ [ [ StorageDrive.driveType == 'HardDisk' OR StorageDrive.driveType == 'CompactFlash'] OR "
|
||||
"[ StorageDrive.driveType == 'MemoryStick' OR StorageDrive.driveType == 'SmartMedia'] ] OR "
|
||||
"[ StorageDrive.driveType == 'SdMmc' OR StorageDrive.driveType == 'Xd'] ]";
|
||||
#endif
|
||||
|
||||
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
|
||||
if (args->count() > 0)
|
||||
|
|
Loading…
Reference in New Issue