Merge branch 'master' into sfdisk
This commit is contained in:
commit
6996687123
|
@ -335,7 +335,7 @@ bool Partition::unmount(Report& report)
|
|||
const QString canonicalDeviceNode = QFileInfo(deviceNode()).canonicalFilePath();
|
||||
const QList<QStorageInfo> mountedVolumes = QStorageInfo::mountedVolumes();
|
||||
for (const QStorageInfo &storage : mountedVolumes) {
|
||||
if (QFileInfo(QString::fromUtf8(storage.device())).canonicalFilePath() == canonicalDeviceNode ) {
|
||||
if (QFileInfo(QString::fromLocal8Bit(storage.device())).canonicalFilePath() == canonicalDeviceNode ) {
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ void SmartStatus::update()
|
|||
if (sk_disk_identify_parse(skDisk, &skIdentify) < 0)
|
||||
qDebug() << "getting identify data failed for " << devicePath() << ": " << strerror(errno);
|
||||
else {
|
||||
setModelName(QString::fromUtf8(skIdentify->model));
|
||||
setFirmware(QString::fromUtf8(skIdentify->firmware));
|
||||
setSerial(QString::fromUtf8(skIdentify->serial));
|
||||
setModelName(QString::fromLocal8Bit(skIdentify->model));
|
||||
setFirmware(QString::fromLocal8Bit(skIdentify->firmware));
|
||||
setSerial(QString::fromLocal8Bit(skIdentify->serial));
|
||||
}
|
||||
|
||||
const SkSmartParsedData* skParsed;
|
||||
|
|
|
@ -43,6 +43,7 @@ FileSystem::CommandSupportType f2fs::m_Backup = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType f2fs::m_SetLabel = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType f2fs::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType f2fs::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
bool f2fs::oldVersion = false; // 1.8.x or older
|
||||
|
||||
f2fs::f2fs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::F2fs)
|
||||
|
@ -54,11 +55,16 @@ void f2fs::init()
|
|||
m_Create = findExternal(QStringLiteral("mkfs.f2fs")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
m_Check = findExternal(QStringLiteral("fsck.f2fs")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
|
||||
if (m_Create == cmdSupportFileSystem) {
|
||||
ExternalCommand cmd(QStringLiteral("mkfs.f2fs"), {});
|
||||
oldVersion = cmd.run(-1) && !cmd.output().contains(QStringLiteral("-f"));
|
||||
}
|
||||
|
||||
m_GetLabel = cmdSupportCore;
|
||||
// m_SetLabel = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
// m_UpdateUUID = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
|
||||
// m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("nilfs-resize"))) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("resize.f2fs"))) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
// m_GetUsed = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
// m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
|
||||
|
@ -79,7 +85,7 @@ bool f2fs::supportToolFound() const
|
|||
m_Create != cmdSupportNone &&
|
||||
m_Check != cmdSupportNone &&
|
||||
// m_UpdateUUID != cmdSupportNone &&
|
||||
// m_Grow != cmdSupportNone &&
|
||||
m_Grow != cmdSupportNone &&
|
||||
// m_Shrink != cmdSupportNone &&
|
||||
m_Copy != cmdSupportNone &&
|
||||
m_Move != cmdSupportNone &&
|
||||
|
@ -115,13 +121,24 @@ bool f2fs::check(Report& report, const QString& deviceNode) const
|
|||
|
||||
bool f2fs::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), { deviceNode });
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
return createWithLabel(report, deviceNode, QString());
|
||||
}
|
||||
|
||||
bool f2fs::createWithLabel(Report& report, const QString& deviceNode, const QString& label)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), { QStringLiteral("-l"), label, deviceNode });
|
||||
QStringList args;
|
||||
if (oldVersion)
|
||||
args << QStringLiteral("-l") << label << deviceNode;
|
||||
else
|
||||
args << QStringLiteral("-f") << QStringLiteral("-l") << label << deviceNode;
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), args);
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
bool f2fs::resize(Report& report, const QString& deviceNode, qint64 length) const
|
||||
{
|
||||
Q_UNUSED(length)
|
||||
ExternalCommand cmd(report, QStringLiteral("resize.f2fs"), { deviceNode });
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
bool create(Report& report, const QString& deviceNode) override;
|
||||
bool createWithLabel(Report& report, const QString& deviceNode, const QString& label) override;
|
||||
// qint64 readUsedCapacity(const QString& deviceNode) const override;
|
||||
// bool resize(Report& report, const QString& deviceNode, qint64 length) const override;
|
||||
bool resize(Report& report, const QString& deviceNode, qint64 length) const override;
|
||||
// bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override;
|
||||
// bool updateUUID(Report& report, const QString& deviceNode) const override;
|
||||
|
||||
|
@ -110,6 +110,10 @@ public:
|
|||
static CommandSupportType m_SetLabel;
|
||||
static CommandSupportType m_UpdateUUID;
|
||||
static CommandSupportType m_GetUUID;
|
||||
|
||||
private:
|
||||
static bool oldVersion;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ FileSystem::FileSystem(qint64 firstsector, qint64 lastsector, qint64 sectorsused
|
|||
*/
|
||||
qint64 FileSystem::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(deviceNode)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ static QString readBlkIdValue(const QString& deviceNode, const QString& tag)
|
|||
char* label = nullptr;
|
||||
if ((dev = blkid_get_dev(cache, deviceNode.toLocal8Bit().constData(), BLKID_DEV_NORMAL)) != nullptr &&
|
||||
(label = blkid_get_tag_value(cache, tag.toLocal8Bit().constData(), deviceNode.toLocal8Bit().constData()))) {
|
||||
rval = QString::fromUtf8(label);
|
||||
rval = QString::fromLocal8Bit(label);
|
||||
free(label);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ QString FileSystem::detectMountPoint(FileSystem* fs, const QString& partitionPat
|
|||
QString partitionCanonicalPath = partitionPathFileInfo.canonicalFilePath();
|
||||
const QList<QStorageInfo> mountedVolumes = QStorageInfo::mountedVolumes();
|
||||
for (const QStorageInfo &storage : mountedVolumes) {
|
||||
if (partitionCanonicalPath == QFileInfo(QString::fromUtf8(storage.device())).canonicalFilePath() ) {
|
||||
if (partitionCanonicalPath == QFileInfo(QString::fromLocal8Bit(storage.device())).canonicalFilePath() ) {
|
||||
mountPoints.append(storage.rootPath());
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ bool FileSystem::createWithLabel(Report& report, const QString& deviceNode, cons
|
|||
*/
|
||||
void FileSystem::scan(const QString& deviceNode)
|
||||
{
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(deviceNode)
|
||||
}
|
||||
|
||||
/** Resize a FileSystem to a given new length
|
||||
|
@ -229,10 +229,10 @@ bool FileSystem::resize(Report& report, const QString& deviceNode, qint64 newLen
|
|||
*/
|
||||
bool FileSystem::resizeOnline(Report& report, const QString& deviceNode, const QString& mountPoint, qint64 newLength) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(mountPoint);
|
||||
Q_UNUSED(newLength);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
Q_UNUSED(mountPoint)
|
||||
Q_UNUSED(newLength)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -245,9 +245,9 @@ bool FileSystem::resizeOnline(Report& report, const QString& deviceNode, const Q
|
|||
*/
|
||||
bool FileSystem::move(Report& report, const QString& deviceNode, qint64 newStartSector) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(newStartSector);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
Q_UNUSED(newStartSector)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -260,9 +260,9 @@ bool FileSystem::move(Report& report, const QString& deviceNode, qint64 newStart
|
|||
*/
|
||||
bool FileSystem::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(newLabel);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
Q_UNUSED(newLabel)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -276,10 +276,10 @@ bool FileSystem::writeLabel(Report& report, const QString& deviceNode, const QSt
|
|||
*/
|
||||
bool FileSystem::writeLabelOnline(Report& report, const QString& deviceNode, const QString& mountPoint, const QString& newLabel)
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(mountPoint);
|
||||
Q_UNUSED(newLabel);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
Q_UNUSED(mountPoint)
|
||||
Q_UNUSED(newLabel)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -292,9 +292,9 @@ bool FileSystem::writeLabelOnline(Report& report, const QString& deviceNode, con
|
|||
*/
|
||||
bool FileSystem::copy(Report& report, const QString& targetDeviceNode, const QString& sourceDeviceNode) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(targetDeviceNode);
|
||||
Q_UNUSED(sourceDeviceNode);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(targetDeviceNode)
|
||||
Q_UNUSED(sourceDeviceNode)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -308,10 +308,10 @@ bool FileSystem::copy(Report& report, const QString& targetDeviceNode, const QSt
|
|||
*/
|
||||
bool FileSystem::backup(Report& report, const Device& sourceDevice, const QString& deviceNode, const QString& filename) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(sourceDevice);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(filename);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(sourceDevice)
|
||||
Q_UNUSED(deviceNode)
|
||||
Q_UNUSED(filename)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ bool FileSystem::backup(Report& report, const Device& sourceDevice, const QStrin
|
|||
*/
|
||||
bool FileSystem::remove(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -336,8 +336,8 @@ bool FileSystem::remove(Report& report, const QString& deviceNode) const
|
|||
*/
|
||||
bool FileSystem::check(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -349,8 +349,8 @@ bool FileSystem::check(Report& report, const QString& deviceNode) const
|
|||
*/
|
||||
bool FileSystem::updateUUID(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -372,8 +372,8 @@ QString FileSystem::readUUID(const QString& deviceNode) const
|
|||
*/
|
||||
bool FileSystem::updateBootSector(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ void FileSystem::move(qint64 newStartSector)
|
|||
}
|
||||
bool FileSystem::canMount(const QString& deviceNode, const QString& mountPoint) const
|
||||
{
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(deviceNode)
|
||||
// cannot mount if we have no mount points
|
||||
return !mountPoint.isEmpty();
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ bool luks::create(Report& report, const QString& deviceNode)
|
|||
QStringLiteral("luksFormat"),
|
||||
deviceNode });
|
||||
if (!( createCmd.start(-1) &&
|
||||
createCmd.write(m_passphrase.toUtf8() + '\n') == m_passphrase.toUtf8().length() + 1 &&
|
||||
createCmd.write(m_passphrase.toLocal8Bit() + '\n') == m_passphrase.toLocal8Bit().length() + 1 &&
|
||||
createCmd.waitFor() && createCmd.exitCode() == 0))
|
||||
{
|
||||
return false;
|
||||
|
@ -139,7 +139,7 @@ bool luks::create(Report& report, const QString& deviceNode)
|
|||
deviceNode,
|
||||
suggestedMapperName(deviceNode) });
|
||||
|
||||
if (!( openCmd.start(-1) && openCmd.write(m_passphrase.toUtf8() + '\n') == m_passphrase.toUtf8().length() + 1 && openCmd.waitFor()))
|
||||
if (!( openCmd.start(-1) && openCmd.write(m_passphrase.toLocal8Bit() + '\n') == m_passphrase.toLocal8Bit().length() + 1 && openCmd.waitFor()))
|
||||
return false;
|
||||
|
||||
scan(deviceNode);
|
||||
|
@ -262,7 +262,7 @@ bool luks::cryptOpen(QWidget* parent, const QString& deviceNode)
|
|||
suggestedMapperName(deviceNode) });
|
||||
|
||||
if (!( openCmd.start(-1) &&
|
||||
openCmd.write(passphrase.toUtf8() + '\n') == passphrase.toUtf8().length() + 1 &&
|
||||
openCmd.write(passphrase.toLocal8Bit() + '\n') == passphrase.toLocal8Bit().length() + 1 &&
|
||||
openCmd.waitFor() && openCmd.exitCode() == 0) )
|
||||
return false;
|
||||
|
||||
|
@ -572,7 +572,7 @@ void luks::getMapperName(const QString& deviceNode)
|
|||
m_MapperName = QString();
|
||||
|
||||
if (cmd.run(-1) && cmd.exitCode() == 0) {
|
||||
const QJsonDocument jsonDocument = QJsonDocument::fromJson(cmd.output().toUtf8());
|
||||
const QJsonDocument jsonDocument = QJsonDocument::fromJson(cmd.output().toLocal8Bit());
|
||||
QJsonObject jsonObject = jsonDocument.object();
|
||||
const QJsonArray jsonArray = jsonObject[QLatin1String("blockdevices")].toArray();
|
||||
for (const auto &deviceLine : jsonArray) {
|
||||
|
|
|
@ -107,7 +107,7 @@ typedef struct _GPTDiskData GPTDiskData;
|
|||
*/
|
||||
static qint64 firstUsableSector(const Device& d)
|
||||
{
|
||||
PedDevice* pedDevice = ped_device_get(d.deviceNode().toLatin1().constData());
|
||||
PedDevice* pedDevice = ped_device_get(d.deviceNode().toLocal8Bit().constData());
|
||||
PedDisk* pedDisk = pedDevice ? ped_disk_new(pedDevice) : nullptr;
|
||||
|
||||
qint64 rval = 0;
|
||||
|
@ -135,7 +135,7 @@ static qint64 firstUsableSector(const Device& d)
|
|||
*/
|
||||
static qint64 lastUsableSector(const Device& d)
|
||||
{
|
||||
PedDevice* pedDevice = ped_device_get(d.deviceNode().toLatin1().constData());
|
||||
PedDevice* pedDevice = ped_device_get(d.deviceNode().toLocal8Bit().constData());
|
||||
PedDisk* pedDisk = pedDevice ? ped_disk_new(pedDevice) : nullptr;
|
||||
|
||||
qint64 rval = 0;
|
||||
|
@ -305,7 +305,7 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk)
|
|||
|
||||
FileSystem::Type type = FileSystem::Unknown;
|
||||
char* pedPath = ped_partition_get_path(pedPartition);
|
||||
const QString partitionNode = pedPath ? QString::fromUtf8(pedPath) : QString();
|
||||
const QString partitionNode = pedPath ? QString::fromLocal8Bit(pedPath) : QString();
|
||||
free(pedPath);
|
||||
type = detectFileSystem(partitionNode);
|
||||
|
||||
|
@ -393,14 +393,14 @@ DiskDevice* LibPartedBackend::scanDevice(const QString& deviceNode)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Log(Log::information) << xi18nc("@info:status", "Device found: %1", QString::fromUtf8(pedDevice->model));
|
||||
Log(Log::information) << xi18nc("@info:status", "Device found: %1", QString::fromLocal8Bit(pedDevice->model));
|
||||
|
||||
DiskDevice* d = new DiskDevice(QString::fromUtf8(pedDevice->model), QString::fromUtf8(pedDevice->path), pedDevice->bios_geom.heads, pedDevice->bios_geom.sectors, pedDevice->bios_geom.cylinders, pedDevice->sector_size);
|
||||
DiskDevice* d = new DiskDevice(QString::fromLocal8Bit(pedDevice->model), QString::fromLocal8Bit(pedDevice->path), pedDevice->bios_geom.heads, pedDevice->bios_geom.sectors, pedDevice->bios_geom.cylinders, pedDevice->sector_size);
|
||||
|
||||
PedDisk* pedDisk = ped_disk_new(pedDevice);
|
||||
|
||||
if (pedDisk) {
|
||||
const PartitionTable::TableType type = PartitionTable::nameToTableType(QString::fromUtf8(pedDisk->type->name));
|
||||
const PartitionTable::TableType type = PartitionTable::nameToTableType(QString::fromLocal8Bit(pedDisk->type->name));
|
||||
CoreBackend::setPartitionTableForDevice(*d, new PartitionTable(type, firstUsableSector(*d), lastUsableSector(*d)));
|
||||
CoreBackend::setPartitionTableMaxPrimaries(*d->partitionTable(), ped_disk_get_max_primary_partition_count(pedDisk));
|
||||
|
||||
|
@ -426,7 +426,7 @@ QList<Device*> LibPartedBackend::scanDevices(bool excludeReadOnly)
|
|||
QStringLiteral("type,name") });
|
||||
|
||||
if (cmd.run(-1) && cmd.exitCode() == 0) {
|
||||
const QJsonDocument jsonDocument = QJsonDocument::fromJson(cmd.output().toUtf8());
|
||||
const QJsonDocument jsonDocument = QJsonDocument::fromJson(cmd.output().toLocal8Bit());
|
||||
QJsonObject jsonObject = jsonDocument.object();
|
||||
const QJsonArray jsonArray = jsonObject[QLatin1String("blockdevices")].toArray();
|
||||
for (const auto &deviceLine : jsonArray) {
|
||||
|
@ -479,7 +479,7 @@ FileSystem::Type LibPartedBackend::detectFileSystem(const QString& partitionPath
|
|||
partitionPath.toLocal8Bit().constData(),
|
||||
BLKID_DEV_NORMAL)) != nullptr) {
|
||||
char *string = blkid_get_tag_value(cache, "TYPE", partitionPath.toLocal8Bit().constData());
|
||||
QString s = QString::fromUtf8(string);
|
||||
QString s = QString::fromLocal8Bit(string);
|
||||
free(string);
|
||||
|
||||
if (s == QStringLiteral("ext2")) rval = FileSystem::Ext2;
|
||||
|
@ -497,7 +497,7 @@ FileSystem::Type LibPartedBackend::detectFileSystem(const QString& partitionPath
|
|||
else if (s == QStringLiteral("vfat")) {
|
||||
// libblkid uses SEC_TYPE to distinguish between FAT16 and FAT32
|
||||
string = blkid_get_tag_value(cache, "SEC_TYPE", partitionPath.toLocal8Bit().constData());
|
||||
QString st = QString::fromUtf8(string);
|
||||
QString st = QString::fromLocal8Bit(string);
|
||||
free(string);
|
||||
if (st == QStringLiteral("msdos"))
|
||||
rval = FileSystem::Fat16;
|
||||
|
|
|
@ -45,7 +45,7 @@ bool LibPartedDevice::open()
|
|||
if (pedDevice())
|
||||
return false;
|
||||
|
||||
m_PedDevice = ped_device_get(deviceNode().toLatin1().constData());
|
||||
m_PedDevice = ped_device_get(deviceNode().toLocal8Bit().constData());
|
||||
|
||||
return m_PedDevice != nullptr;
|
||||
}
|
||||
|
@ -87,14 +87,14 @@ CoreBackendPartitionTable* LibPartedDevice::openPartitionTable()
|
|||
|
||||
bool LibPartedDevice::createPartitionTable(Report& report, const PartitionTable& ptable)
|
||||
{
|
||||
PedDiskType* pedDiskType = ped_disk_type_get(ptable.typeName().toLatin1().constData());
|
||||
PedDiskType* pedDiskType = ped_disk_type_get(ptable.typeName().toLocal8Bit().constData());
|
||||
|
||||
if (pedDiskType == nullptr) {
|
||||
report.line() << xi18nc("@info:progress", "Creating partition table failed: Could not retrieve partition table type \"%1\" for <filename>%2</filename>.", ptable.typeName(), deviceNode());
|
||||
return false;
|
||||
}
|
||||
|
||||
PedDevice* dev = ped_device_get(deviceNode().toLatin1().constData());
|
||||
PedDevice* dev = ped_device_get(deviceNode().toLocal8Bit().constData());
|
||||
|
||||
if (dev == nullptr) {
|
||||
report.line() << xi18nc("@info:progress", "Creating partition table failed: Could not open backend device <filename>%1</filename>.", deviceNode());
|
||||
|
|
|
@ -104,7 +104,7 @@ static PedFileSystemType* getPedFileSystemType(FileSystem::Type t)
|
|||
{
|
||||
for (quint32 i = 0; i < sizeof(mapFileSystemTypeToLibPartedName) / sizeof(mapFileSystemTypeToLibPartedName[0]); i++)
|
||||
if (mapFileSystemTypeToLibPartedName[i].type == t)
|
||||
return ped_file_system_type_get(mapFileSystemTypeToLibPartedName[i].name.toLatin1().constData());
|
||||
return ped_file_system_type_get(mapFileSystemTypeToLibPartedName[i].name.toLocal8Bit().constData());
|
||||
|
||||
// if we didn't find anything, go with ext2 as a safe fallback
|
||||
return ped_file_system_type_get("ext2");
|
||||
|
@ -112,7 +112,7 @@ static PedFileSystemType* getPedFileSystemType(FileSystem::Type t)
|
|||
|
||||
QString LibPartedPartitionTable::createPartition(Report& report, const Partition& partition)
|
||||
{
|
||||
Q_ASSERT(partition.devicePath() == QString::fromUtf8(pedDevice()->path));
|
||||
Q_ASSERT(partition.devicePath() == QString::fromLocal8Bit(pedDevice()->path));
|
||||
|
||||
QString rval = QString();
|
||||
|
||||
|
@ -156,11 +156,11 @@ QString LibPartedPartitionTable::createPartition(Report& report, const Partition
|
|||
|
||||
if (ped_disk_add_partition(pedDisk(), pedPartition, pedConstraint)) {
|
||||
char *pedPath = ped_partition_get_path(pedPartition);
|
||||
rval = QString::fromUtf8(pedPath);
|
||||
rval = QString::fromLocal8Bit(pedPath);
|
||||
free(pedPath);
|
||||
}
|
||||
else {
|
||||
report.line() << xi18nc("@info:progress", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition.deviceNode(), QString::fromUtf8(pedDisk()->dev->path));
|
||||
report.line() << xi18nc("@info:progress", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition.deviceNode(), QString::fromLocal8Bit(pedDisk()->dev->path));
|
||||
report.line() << LibPartedBackend::lastPartedExceptionMessage();
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ QString LibPartedPartitionTable::createPartition(Report& report, const Partition
|
|||
|
||||
bool LibPartedPartitionTable::deletePartition(Report& report, const Partition& partition)
|
||||
{
|
||||
Q_ASSERT(partition.devicePath() == QString::fromUtf8(pedDevice()->path));
|
||||
Q_ASSERT(partition.devicePath() == QString::fromLocal8Bit(pedDevice()->path));
|
||||
|
||||
bool rval = false;
|
||||
|
||||
|
@ -192,7 +192,7 @@ bool LibPartedPartitionTable::deletePartition(Report& report, const Partition& p
|
|||
|
||||
bool LibPartedPartitionTable::updateGeometry(Report& report, const Partition& partition, qint64 sector_start, qint64 sector_end)
|
||||
{
|
||||
Q_ASSERT(partition.devicePath() == QString::fromUtf8(pedDevice()->path));
|
||||
Q_ASSERT(partition.devicePath() == QString::fromLocal8Bit(pedDevice()->path));
|
||||
|
||||
bool rval = false;
|
||||
|
||||
|
@ -296,7 +296,7 @@ FileSystem::Type LibPartedPartitionTable::detectFileSystemBySector(Report& repor
|
|||
char* pedPath = ped_partition_get_path(pedPartition);
|
||||
FileSystem::Type type = FileSystem::Unknown;
|
||||
if (pedPartition && pedPath)
|
||||
type = CoreBackendManager::self()->backend()->detectFileSystem(QString::fromUtf8(pedPath));
|
||||
type = CoreBackendManager::self()->backend()->detectFileSystem(QString::fromLocal8Bit(pedPath));
|
||||
else
|
||||
report.line() << xi18nc("@info:progress", "Could not determine file system of partition at sector %1 on device <filename>%2</filename>.", sector, device.deviceNode());
|
||||
free(pedPath);
|
||||
|
|
|
@ -59,7 +59,7 @@ ExternalCommand::ExternalCommand(Report& report, const QString& cmd, const QStri
|
|||
|
||||
void ExternalCommand::setup(const QProcess::ProcessChannelMode processChannelMode)
|
||||
{
|
||||
setEnvironment(QStringList() << QStringLiteral("LC_ALL=C") << QStringLiteral("PATH=") + QString::fromUtf8(getenv("PATH")) << QStringLiteral("LVM_SUPPRESS_FD_WARNINGS=1"));
|
||||
setEnvironment(QStringList() << QStringLiteral("LC_ALL=C") << QStringLiteral("PATH=") + QString::fromLocal8Bit(getenv("PATH")) << QStringLiteral("LVM_SUPPRESS_FD_WARNINGS=1"));
|
||||
setProcessChannelMode(processChannelMode);
|
||||
|
||||
connect(this, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &ExternalCommand::onFinished);
|
||||
|
|
|
@ -71,7 +71,7 @@ QString HtmlReport::header()
|
|||
|
||||
struct utsname info;
|
||||
uname(&info);
|
||||
const QString unameString = QString::fromUtf8(info.sysname) + QStringLiteral(" ") + QString::fromUtf8(info.nodename) + QStringLiteral(" ") + QString::fromUtf8(info.release) + QStringLiteral(" ") + QString::fromUtf8(info.version) + QStringLiteral(" ") + QString::fromUtf8(info.machine);
|
||||
const QString unameString = QString::fromLocal8Bit(info.sysname) + QStringLiteral(" ") + QString::fromLocal8Bit(info.nodename) + QStringLiteral(" ") + QString::fromLocal8Bit(info.release) + QStringLiteral(" ") + QString::fromLocal8Bit(info.version) + QStringLiteral(" ") + QString::fromLocal8Bit(info.machine);
|
||||
|
||||
s << "<table>\n"
|
||||
<< tableLine(i18n("Date:"), QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat))
|
||||
|
|
Loading…
Reference in New Issue