Read and display UUID for some filesystems.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=964310
This commit is contained in:
Volker Lanz 2009-05-06 14:19:23 +00:00
parent 52914fdc57
commit 5c0acb2bba
17 changed files with 148 additions and 67 deletions

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -228,6 +228,9 @@ static void scanDevicePartitions(PedDevice* pedDevice, Device& d, PedDisk* pedDi
if (fs->supportGetLabel() == FileSystem::SupportExternal)
fs->setLabel(fs->readLabel(part->deviceNode()));
if (fs->supportGetUUID() == FileSystem::SupportExternal)
fs->setUUID(fs->readUUID(part->deviceNode()));
parent->append(part);
PartitionTable::isSnapped(d, *part);

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -38,6 +38,7 @@ namespace FS
FileSystem::SupportType ext2::m_Backup = FileSystem::SupportNone;
FileSystem::SupportType ext2::m_SetLabel = FileSystem::SupportNone;
FileSystem::SupportType ext2::m_UpdateUUID = FileSystem::SupportNone;
FileSystem::SupportType ext2::m_GetUUID = FileSystem::SupportNone;
ext2::ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t) :
FileSystem(firstsector, lastsector, sectorsused, label, t)
@ -56,6 +57,7 @@ namespace FS
m_Copy = (m_Check != SupportNone) ? SupportInternal : SupportNone;
m_Move = (m_Check != SupportNone) ? SupportInternal : SupportNone;
m_Backup = SupportInternal;
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
}
qint64 ext2::maxCapacity() const

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -49,7 +49,7 @@ namespace FS
virtual bool resize(Report& report, const QString& deviceNode, qint64 length) const;
virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel);
virtual bool updateUUID(Report& report, const QString& deviceNode) const;
virtual SupportType supportGetUsed() const { return m_GetUsed; }
virtual SupportType supportGetLabel() const { return m_GetLabel; }
virtual SupportType supportCreate() const { return m_Create; }
@ -61,9 +61,10 @@ namespace FS
virtual SupportType supportBackup() const { return m_Backup; }
virtual SupportType supportSetLabel() const { return m_SetLabel; }
virtual SupportType supportUpdateUUID() const { return m_UpdateUUID; }
virtual SupportType supportGetUUID() const { return m_GetUUID; }
virtual qint64 maxCapacity() const;
protected:
static SupportType m_GetUsed;
static SupportType m_GetLabel;
@ -76,6 +77,7 @@ namespace FS
static SupportType m_Backup;
static SupportType m_SetLabel;
static SupportType m_UpdateUUID;
static SupportType m_GetUUID;
};
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -42,7 +42,7 @@ namespace FS
FileSystem::SupportType fat16::m_Copy = FileSystem::SupportNone;
FileSystem::SupportType fat16::m_Backup = FileSystem::SupportNone;
FileSystem::SupportType fat16::m_UpdateUUID = FileSystem::SupportNone;
FileSystem::SupportType fat16::m_GetUUID = FileSystem::SupportNone;
fat16::fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t) :
FileSystem(firstsector, lastsector, sectorsused, label, t)
@ -65,6 +65,7 @@ namespace FS
m_Copy = SupportInternal;
m_Backup = SupportInternal;
m_UpdateUUID = findExternal("dd") ? SupportExternal : SupportNone;
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
}
qint64 fat16::minCapacity() const

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -58,6 +58,7 @@ namespace FS
virtual SupportType supportCopy() const { return m_Copy; }
virtual SupportType supportBackup() const { return m_Backup; }
virtual SupportType supportUpdateUUID() const { return m_UpdateUUID; }
virtual SupportType supportGetUUID() const { return m_GetUUID; }
virtual qint64 minCapacity() const;
virtual qint64 maxCapacity() const;
@ -73,6 +74,7 @@ namespace FS
static SupportType m_Copy;
static SupportType m_Backup;
static SupportType m_UpdateUUID;
static SupportType m_GetUUID;
};
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -37,7 +37,8 @@ FileSystem::FileSystem(qint64 firstsector, qint64 lastsector, qint64 sectorsused
m_FirstSector(firstsector),
m_LastSector(lastsector),
m_SectorsUsed(sectorsused),
m_Label(l)
m_Label(l),
m_UUID()
{
}
@ -164,6 +165,26 @@ bool FileSystem::updateUUID(Report& report, const QString& deviceNode) const
return true;
}
/** Returns the FileSystem UUID (or an empty string, if not supported).
@param deviceNode the device node for the Partition the FileSystem is on
@return the UUID or an empty string if the FileSystem does not support UUIDs
*/
QString FileSystem::readUUID(const QString& deviceNode) const
{
ExternalCommand cmd("vol_id", QStringList() << deviceNode);
if (cmd.run())
{
QRegExp rxUuid("ID_FS_UUID=([^\\s]+)");
if (rxUuid.indexIn(cmd.output()) != -1)
return rxUuid.cap(1).simplified();
}
return QString();
}
/** @return the minimum capacity valid for this FileSystem in bytes */
qint64 FileSystem::minCapacity() const
{

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -92,6 +92,7 @@ class FileSystem
virtual bool backup(Report& report, const Device& sourceDevice, const QString& deviceNode, const QString& filename) const;
virtual bool check(Report& report, const QString& deviceNode) const;
virtual bool updateUUID(Report& report, const QString& deviceNode) const;
virtual QString readUUID(const QString& deviceNode) const;
virtual SupportType supportGetUsed() const { return SupportNone; } /**< @return SupportType for getting used capacity */
virtual SupportType supportGetLabel() const { return SupportNone; } /**< @return SupportType for reading label*/
@ -104,6 +105,7 @@ class FileSystem
virtual SupportType supportBackup() const { return SupportNone; } /**< @return SupportType for backing up */
virtual SupportType supportSetLabel() const { return SupportNone; } /**< @return SupportType for setting label*/
virtual SupportType supportUpdateUUID() const { return SupportNone; } /**< @return SupportType for updating the UUID */
virtual SupportType supportGetUUID() const { return SupportNone; } /**< @return SupportType for reading the UUID */
virtual qint64 minCapacity() const;
virtual qint64 maxCapacity() const;
@ -136,9 +138,11 @@ class FileSystem
const QString& label() const { return m_Label; } /**< @return the FileSystem's label */
qint64 sectorsUsed() const { return m_SectorsUsed; } /**< @return the sectors in use on the FileSystem */
const QString& uuid() const { return m_UUID; } /**< @return the FileSystem's UUID */
void setSectorsUsed(qint64 s) { m_SectorsUsed = s; } /**< @param s the new value for sectors in use */
void setLabel(const QString& s) { m_Label = s; } /**< @param s the new label */
void setUUID(const QString& s) { m_UUID = s; } /**< @param s the new UUID */
protected:
static bool findExternal(const QString& cmdName, const QStringList& args = QStringList(), int exptectedCode = 1);
@ -149,6 +153,7 @@ class FileSystem
qint64 m_LastSector;
qint64 m_SectorsUsed;
QString m_Label;
QString m_UUID;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(FileSystem::SupportTypes)

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -32,6 +32,7 @@ namespace FS
FileSystem::SupportType linuxswap::m_Copy = FileSystem::SupportNone;
FileSystem::SupportType linuxswap::m_GetLabel = FileSystem::SupportNone;
FileSystem::SupportType linuxswap::m_SetLabel = FileSystem::SupportNone;
FileSystem::SupportType linuxswap::m_GetUUID = FileSystem::SupportNone;
linuxswap::linuxswap(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::LinuxSwap)
@ -44,6 +45,7 @@ namespace FS
m_GetLabel = findExternal("vol_id") ? SupportExternal : SupportNone;
m_Copy = SupportInternal;
m_Move = SupportInternal;
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
}
bool linuxswap::create(Report& report, const QString& deviceNode) const

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -49,10 +49,10 @@ namespace FS
virtual bool canMount(const QString&) const { return true; }
virtual bool canUnmount(const QString&) const { return true; }
virtual bool mount(const QString& deviceNode);
virtual bool unmount(const QString& deviceNode);
virtual QString mountTitle() const;
virtual QString unmountTitle() const;
@ -63,7 +63,8 @@ namespace FS
virtual SupportType supportCopy() const { return m_Copy; }
virtual SupportType supportGetLabel() const { return m_GetLabel; }
virtual SupportType supportSetLabel() const { return m_SetLabel; }
virtual SupportType supportGetUUID() const { return m_GetUUID; }
protected:
static SupportType m_Create;
static SupportType m_Grow;
@ -72,6 +73,7 @@ namespace FS
static SupportType m_Copy;
static SupportType m_SetLabel;
static SupportType m_GetLabel;
static SupportType m_GetUUID;
};
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -41,6 +41,7 @@ namespace FS
FileSystem::SupportType ntfs::m_Backup = FileSystem::SupportNone;
FileSystem::SupportType ntfs::m_SetLabel = FileSystem::SupportNone;
FileSystem::SupportType ntfs::m_UpdateUUID = FileSystem::SupportNone;
FileSystem::SupportType ntfs::m_GetUUID = FileSystem::SupportNone;
ntfs::ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Ntfs)
@ -56,13 +57,14 @@ namespace FS
m_Backup = SupportInternal;
m_UpdateUUID = findExternal("dd") ? SupportExternal : SupportNone;
m_Move = (m_Check != SupportNone) ? SupportInternal : SupportNone;
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
}
qint64 ntfs::maxCapacity() const
{
return 256 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB);
}
qint64 ntfs::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd("ntfsresize", QStringList() << "--info" << "--force" << "--no-progress-bar" << deviceNode);
@ -103,10 +105,10 @@ namespace FS
ExternalCommand testCmd("ntfslabel", QStringList() << "--force" << deviceNode);
testCmd.setProcessChannelMode(QProcess::SeparateChannels);
if (!testCmd.run(-1))
return false;
return testCmd.output().simplified() == newLabel.simplified();
}
@ -132,7 +134,7 @@ namespace FS
{
QStringList args;
args << "-P" << "-f" << deviceNode << "-s" << QString::number(length);
QStringList dryRunArgs = args;
dryRunArgs << "-n";
ExternalCommand cmdDryRun("ntfsresize", dryRunArgs);
@ -142,7 +144,7 @@ namespace FS
ExternalCommand cmd(report, "ntfsresize", args);
return cmd.run(-1) && cmd.exitCode() == 0;
}
return false;
}
@ -150,7 +152,7 @@ namespace FS
{
char uuid[16];
uuid_generate(reinterpret_cast<unsigned char*>(uuid));
ExternalCommand cmd(report, "dd", QStringList() << "of=" + deviceNode << "bs=1" << "count=8" << "seek=72");
if (!cmd.start())
@ -158,7 +160,7 @@ namespace FS
if (cmd.write(uuid, 8) != 8)
return false;
return cmd.waitFor(-1);
}
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -62,9 +62,10 @@ namespace FS
virtual SupportType supportBackup() const { return m_Backup; }
virtual SupportType supportSetLabel() const { return m_SetLabel; }
virtual SupportType supportUpdateUUID() const { return m_UpdateUUID; }
virtual SupportType supportGetUUID() const { return m_GetUUID; }
virtual qint64 maxCapacity() const;
protected:
static SupportType m_GetUsed;
static SupportType m_GetLabel;
@ -77,6 +78,7 @@ namespace FS
static SupportType m_Backup;
static SupportType m_SetLabel;
static SupportType m_UpdateUUID;
static SupportType m_GetUUID;
};
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -41,6 +41,7 @@ namespace FS
FileSystem::SupportType reiserfs::m_Backup = FileSystem::SupportNone;
FileSystem::SupportType reiserfs::m_SetLabel = FileSystem::SupportNone;
FileSystem::SupportType reiserfs::m_UpdateUUID = FileSystem::SupportNone;
FileSystem::SupportType reiserfs::m_GetUUID = FileSystem::SupportNone;
reiserfs::reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::ReiserFS)
@ -58,6 +59,7 @@ namespace FS
m_Shrink = (m_GetUsed != SupportNone && m_Grow != SupportNone) ? SupportExternal : SupportNone;
m_Backup = SupportInternal;
m_UpdateUUID = findExternal("reiserfstune") ? SupportExternal : SupportNone;
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
}
qint64 reiserfs::minCapacity() const
@ -69,7 +71,7 @@ namespace FS
{
return 16 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB);
}
qint64 reiserfs::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd("debugreiserfs", QStringList() << deviceNode);
@ -81,7 +83,7 @@ namespace FS
if (rxBlockCount.indexIn(cmd.output()) != -1)
blockCount = rxBlockCount.cap(1).toLongLong();
qint64 blockSize = -1;
QRegExp rxBlockSize("Blocksize: (\\d+)");
@ -131,19 +133,19 @@ namespace FS
{
return ExternalCommand(report, "mkfs.reiserfs", QStringList() << "-f" << deviceNode).run(-1);
}
bool reiserfs::resize(Report& report, const QString& deviceNode, qint64 length) const
{
ExternalCommand cmd(report, "resize_reiserfs", QStringList() << deviceNode << "-q" << "-s" << QString::number(length));
bool rval = cmd.start(-1);
if (!rval)
return false;
if (cmd.write("y\n", 2) != 2)
return false;
return cmd.waitFor(-1) && (cmd.exitCode() == 0 || cmd.exitCode() == 256);
}
@ -153,7 +155,7 @@ namespace FS
uuid_generate(uuid);
char uuid_ascii[37];
uuid_unparse(uuid, uuid_ascii);
return ExternalCommand(report, "reiserfstune", QStringList() << "-u" << uuid_ascii << deviceNode).run(-1);
}
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -63,10 +63,11 @@ namespace FS
virtual SupportType supportBackup() const { return m_Backup; }
virtual SupportType supportSetLabel() const { return m_SetLabel; }
virtual SupportType supportUpdateUUID() const { return m_UpdateUUID; }
virtual SupportType supportGetUUID() const { return m_GetUUID; }
virtual qint64 minCapacity() const;
virtual qint64 maxCapacity() const;
protected:
static SupportType m_GetUsed;
static SupportType m_GetLabel;
@ -79,6 +80,7 @@ namespace FS
static SupportType m_Backup;
static SupportType m_SetLabel;
static SupportType m_UpdateUUID;
static SupportType m_GetUUID;
};
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -116,6 +116,8 @@ void PartPropsDialog::setupDialog()
}
dialogWidget().status().setText(statusText);
dialogWidget().uuid().setText(partition().fileSystem().uuid().isEmpty() ? i18nc("@item uuid", "(none)") : partition().fileSystem().uuid());
setupFileSystemComboBox();
// don't do this before the file system combo box has been set up!
@ -164,7 +166,7 @@ void PartPropsDialog::setupFlagsList()
void PartPropsDialog::updateHideAndShow()
{
// create a temporary fs just to check if the currently selected type supports setting a label
// create a temporary fs for some checks
const FileSystem* fs = FileSystemFactory::create(newFileSystemType(), -1, -1, -1, "");
if (fs == NULL || fs->supportSetLabel() == FileSystem::SupportNone)
@ -185,6 +187,13 @@ void PartPropsDialog::updateHideAndShow()
dialogWidget().noSetLabel().setVisible(false);
}
// when do we show the uuid?
const bool showUuid =
partition().state() != Partition::StateNew && // not for new partitions
!(fs == NULL || fs->supportGetUUID() == FileSystem::SupportNone); // not if the FS doesn't support it
dialogWidget().showUuid(showUuid);
delete fs;
// when do we show available and used capacity?

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -37,7 +37,7 @@ class PartPropsWidget : public QWidget, public Ui::PartPropsWidgetBase
QLabel& mountPoint() { Q_ASSERT(m_LabelMountPoint); return *m_LabelMountPoint; }
QLabel& role() { Q_ASSERT(m_LabelRole); return *m_LabelRole; }
QLabel& capacity() { Q_ASSERT(m_LabelCapacity); return *m_LabelCapacity; }
QLabel& textAvailable() { Q_ASSERT(m_LabelTextAvailable); return *m_LabelTextAvailable; }
QLabel& available() { Q_ASSERT(m_LabelAvailable); return *m_LabelAvailable; }
@ -55,6 +55,9 @@ class PartPropsWidget : public QWidget, public Ui::PartPropsWidgetBase
QLabel& numSectors() { Q_ASSERT(m_LabelNumSectors); return *m_LabelNumSectors; }
QLabel& status() { Q_ASSERT(m_LabelStatus); return *m_LabelStatus; }
QLabel& textUuid() { Q_ASSERT(m_LabelTextUuid); return *m_LabelTextUuid; }
QLabel& uuid() { Q_ASSERT(m_LabelUuid); return *m_LabelUuid; }
QLabel& textLabel() { Q_ASSERT(m_LabelTextLabel); return *m_LabelTextLabel; }
KLineEdit& label() { Q_ASSERT(m_EditLabel); return *m_EditLabel; }
const KLineEdit& label() const { Q_ASSERT(m_EditLabel); return *m_EditLabel; }
@ -71,6 +74,7 @@ class PartPropsWidget : public QWidget, public Ui::PartPropsWidgetBase
void showCheckRecreate(bool b) { checkRecreate().setVisible(b); }
void showListFlags(bool b) { listFlags().setVisible(b); textFlags().setVisible(b); lineFlags().setVisible(b); }
void showLabel(bool b) { textLabel().setVisible(b); label().setVisible(b); }
void showUuid(bool b) { textUuid().setVisible(b); uuid().setVisible(b); }
};
#endif

View File

@ -138,14 +138,14 @@
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<item row="14" column="0" colspan="3">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="13" column="0">
<item row="15" column="0">
<widget class="QLabel" name="m_LabelTextCapacity">
<property name="text">
<string comment="@label">Size:</string>
@ -155,14 +155,14 @@
</property>
</widget>
</item>
<item row="13" column="1" colspan="2">
<item row="15" column="1" colspan="2">
<widget class="QLabel" name="m_LabelCapacity">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="14" column="0">
<item row="16" column="0">
<widget class="QLabel" name="m_LabelTextAvailable">
<property name="text">
<string comment="@label partition capacity available">Available:</string>
@ -172,14 +172,14 @@
</property>
</widget>
</item>
<item row="14" column="1" colspan="2">
<item row="16" column="1" colspan="2">
<widget class="QLabel" name="m_LabelAvailable">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="15" column="0">
<item row="17" column="0">
<widget class="QLabel" name="m_LabelTextUsed">
<property name="text">
<string comment="@label partition capacity used">Used:</string>
@ -189,21 +189,21 @@
</property>
</widget>
</item>
<item row="15" column="1" colspan="2">
<item row="17" column="1" colspan="2">
<widget class="QLabel" name="m_LabelUsed">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="16" column="0" colspan="3">
<item row="18" column="0" colspan="3">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="17" column="0">
<item row="19" column="0">
<widget class="QLabel" name="m_LabelTextFirstSector">
<property name="text">
<string comment="@label">First sector:</string>
@ -213,14 +213,14 @@
</property>
</widget>
</item>
<item row="17" column="1" colspan="2">
<item row="19" column="1" colspan="2">
<widget class="QLabel" name="m_LabelFirstSector">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="18" column="0">
<item row="20" column="0">
<widget class="QLabel" name="m_LabelTextLastSector">
<property name="text">
<string comment="@label">Last sector:</string>
@ -230,14 +230,14 @@
</property>
</widget>
</item>
<item row="18" column="1" colspan="2">
<item row="20" column="1" colspan="2">
<widget class="QLabel" name="m_LabelLastSector">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="19" column="0">
<item row="21" column="0">
<widget class="QLabel" name="m_LabelTextNumSectors">
<property name="text">
<string comment="@label">Number of sectors:</string>
@ -247,21 +247,21 @@
</property>
</widget>
</item>
<item row="19" column="1" colspan="2">
<item row="21" column="1" colspan="2">
<widget class="QLabel" name="m_LabelNumSectors">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="20" column="0" colspan="3">
<item row="22" column="0" colspan="3">
<widget class="Line" name="m_LineListFlags">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="21" column="0">
<item row="23" column="0">
<widget class="QLabel" name="m_LabelTextFlags">
<property name="text">
<string comment="@label">&amp;Flags:</string>
@ -274,7 +274,7 @@
</property>
</widget>
</item>
<item row="21" column="1" colspan="2">
<item row="23" column="1" colspan="2">
<widget class="QListWidget" name="m_ListFlags">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
@ -290,7 +290,7 @@
</property>
</widget>
</item>
<item row="22" column="1" colspan="2">
<item row="24" column="1" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -329,6 +329,23 @@
</property>
</spacer>
</item>
<item row="12" column="0">
<widget class="QLabel" name="m_LabelTextUuid">
<property name="text">
<string comment="@label">UUID:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLabel" name="m_LabelUuid">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -54,9 +54,9 @@ qint32 CopyFileSystemJob::numSteps() const
bool CopyFileSystemJob::run(Report& parent)
{
bool rval = false;
Report* report = jobStarted(parent);
if (targetPartition().fileSystem().length() < sourcePartition().fileSystem().length())
report->line() << i18nc("@info/plain", "Cannot copy file system: File system on target partition <filename>%1</filename> is smaller than the file system on source partition <filename>%2</filename>.", targetPartition().deviceNode(), sourcePartition().deviceNode());
else if (sourcePartition().fileSystem().supportCopy() == FileSystem::SupportExternal)
@ -65,7 +65,7 @@ bool CopyFileSystemJob::run(Report& parent)
{
CopySourceDevice copySource(sourceDevice(), sourcePartition().fileSystem().firstSector(), sourcePartition().fileSystem().lastSector());
CopyTargetDevice copyTarget(targetDevice(), targetPartition().fileSystem().firstSector(), targetPartition().fileSystem().lastSector());
if (!copySource.open())
report->line() << i18nc("@info/plain", "Could not open file system on source partition <filename>%1</filename> for copying.", sourcePartition().deviceNode());
else if (!copyTarget.open())
@ -81,14 +81,17 @@ bool CopyFileSystemJob::run(Report& parent)
{
// set the target file system to the length of the source
const qint64 newLastSector = targetPartition().fileSystem().firstSector() + sourcePartition().fileSystem().length() - 1;
targetPartition().fileSystem().setLastSector(newLastSector);
// and set a new UUID, if the target filesystem supports UUIDs
if (targetPartition().fileSystem().supportUpdateUUID() == FileSystem::SupportExternal)
{
targetPartition().fileSystem().updateUUID(*report, targetPartition().deviceNode());
targetPartition().fileSystem().setUUID(targetPartition().fileSystem().readUUID(targetPartition().deviceNode()));
}
}
jobFinished(*report, rval);
return rval;