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)
|
||||
|
|
|
@ -293,19 +293,19 @@ void LibPartedBackend::initFSSupport()
|
|||
#if defined LIBPARTED_FS_RESIZE_LIBRARY_SUPPORT
|
||||
if (FS::fat16::m_Shrink == FileSystem::cmdSupportNone)
|
||||
FS::fat16::m_Shrink = FileSystem::cmdSupportBackend;
|
||||
|
||||
|
||||
if (FS::fat16::m_Grow == FileSystem::cmdSupportNone)
|
||||
FS::fat16::m_Grow = FileSystem::cmdSupportBackend;
|
||||
|
||||
if (FS::hfs::m_Shrink == FileSystem::cmdSupportNone)
|
||||
FS::hfs::m_Shrink = FileSystem::cmdSupportBackend;
|
||||
|
||||
|
||||
if (FS::hfsplus::m_Shrink == FileSystem::cmdSupportNone)
|
||||
FS::hfsplus::m_Shrink = FileSystem::cmdSupportBackend;
|
||||
|
||||
|
||||
if (FS::hfs::m_GetUsed == FileSystem::cmdSupportNone)
|
||||
FS::hfs::m_GetUsed = FileSystem::cmdSupportBackend;
|
||||
|
||||
|
||||
if (FS::hfsplus::m_GetUsed == FileSystem::cmdSupportNone)
|
||||
FS::hfsplus::m_GetUsed = FileSystem::cmdSupportBackend;
|
||||
#endif
|
||||
|
@ -447,16 +447,18 @@ 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 ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::MemoryStick ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::SmartMedia ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::SdMmc ||
|
||||
if (solidDrive->driveType() == Solid::StorageDrive::HardDisk ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::CompactFlash ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::MemoryStick ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::SmartMedia ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::SdMmc ||
|
||||
solidDrive->driveType() == Solid::StorageDrive::Xd)
|
||||
#endif
|
||||
rval++;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
@ -471,15 +473,17 @@ 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 &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::CompactFlash &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::MemoryStick &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::SmartMedia &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::SdMmc &&
|
||||
if (solidDrive->driveType() != Solid::StorageDrive::HardDisk &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::CompactFlash &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::MemoryStick &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::SmartMedia &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::SdMmc &&
|
||||
solidDrive->driveType() != Solid::StorageDrive::Xd)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
const Solid::Block* solidBlock = solidDevice.as<Solid::Block>();
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ bool checkPermissions()
|
|||
QStringList argList;
|
||||
|
||||
const QString suCmd = suCommand();
|
||||
|
||||
|
||||
// kdesu broke backward compatibility at some point and now only works with "-c";
|
||||
// kdesudo accepts either (with or without "-c"), but the gk* helpers only work
|
||||
// without. kdesu maintainers won't fix their app, so we need to work around that here.
|
||||
|
@ -99,7 +99,7 @@ bool checkPermissions()
|
|||
if (QProcess::execute(suCmd, argList) == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return KMessageBox::warningContinueCancel(NULL, i18nc("@info",
|
||||
"<para><warning>You do not have administrative privileges.</warning></para>"
|
||||
"<para>It is possible to run <application>%1</application> without these privileges. "
|
||||
|
@ -226,15 +226,20 @@ bool checkAccessibleDevices()
|
|||
i18nc("@title:window", "Error: No Usable Devices Found"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<Solid::Device> getSolidDeviceList()
|
||||
{
|
||||
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'] ]";
|
||||
#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