set the uuid when copying a FileSystem

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1091925
This commit is contained in:
Volker Lanz 2010-02-17 22:07:28 +00:00
parent 4849ec5ff8
commit b7a0b4c4e1
2 changed files with 27 additions and 24 deletions

View File

@ -91,33 +91,36 @@ void FileSystemFactory::init()
@param label the FileSystem's label
@return pointer to the newly created FileSystem object or NULL if FileSystem could not be created
*/
FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label)
FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QString& uuid)
{
FileSystem* fs = NULL;
switch(t)
{
case FileSystem::Ext2: return new FS::ext2(firstsector, lastsector, sectorsused, label);
case FileSystem::Ext3: return new FS::ext3(firstsector, lastsector, sectorsused, label);
case FileSystem::Ext4: return new FS::ext4(firstsector, lastsector, sectorsused, label);
case FileSystem::Extended: return new FS::extended(firstsector, lastsector, sectorsused, label);
case FileSystem::Fat16: return new FS::fat16(firstsector, lastsector, sectorsused, label);
case FileSystem::Fat32: return new FS::fat32(firstsector, lastsector, sectorsused, label);
case FileSystem::Hfs: return new FS::hfs(firstsector, lastsector, sectorsused, label);
case FileSystem::HfsPlus: return new FS::hfsplus(firstsector, lastsector, sectorsused, label);
case FileSystem::Jfs: return new FS::jfs(firstsector, lastsector, sectorsused, label);
case FileSystem::LinuxSwap: return new FS::linuxswap(firstsector, lastsector, sectorsused, label);
case FileSystem::Ntfs: return new FS::ntfs(firstsector, lastsector, sectorsused, label);
case FileSystem::ReiserFS: return new FS::reiserfs(firstsector, lastsector, sectorsused, label);
case FileSystem::Reiser4: return new FS::reiser4(firstsector, lastsector, sectorsused, label);
case FileSystem::Ufs: return new FS::ufs(firstsector, lastsector, sectorsused, label);
case FileSystem::Unformatted: return new FS::unformatted(firstsector, lastsector, sectorsused, label);
case FileSystem::Unknown: return new FS::unknown(firstsector, lastsector, sectorsused, label);
case FileSystem::Xfs: return new FS::xfs(firstsector, lastsector, sectorsused, label);
default:
break;
case FileSystem::Ext2: fs = new FS::ext2(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ext3: fs = new FS::ext3(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ext4: fs = new FS::ext4(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Extended: fs = new FS::extended(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Fat16: fs = new FS::fat16(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Fat32: fs = new FS::fat32(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Hfs: fs = new FS::hfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::HfsPlus: fs = new FS::hfsplus(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::ReiserFS: fs = new FS::reiserfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Reiser4: fs = new FS::reiser4(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ufs: fs = new FS::ufs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Unformatted: fs = new FS::unformatted(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Unknown: fs = new FS::unknown(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Xfs: fs = new FS::xfs(firstsector, lastsector, sectorsused, label); break;
default: break;
}
return NULL;
if (fs != NULL)
fs->setUUID(uuid);
return fs;
}
/**
@ -125,7 +128,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
*/
FileSystem* FileSystemFactory::create(const FileSystem& other)
{
return create(other.type(), other.firstSector(), other.lastSector(), other.sectorsUsed(), other.label());
return create(other.type(), other.firstSector(), other.lastSector(), other.sectorsUsed(), other.label(), other.uuid());
}
/** @return the map of FileSystems */

View File

@ -42,7 +42,7 @@ class FileSystemFactory
public:
static void init();
static FileSystem* create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused = -1, const QString& label = QString());
static FileSystem* create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused = -1, const QString& label = QString(), const QString& uuid = QString());
static FileSystem* create(const FileSystem& other);
static FileSystem* cloneWithNewType(FileSystem::Type newType, const FileSystem& other);
static const FileSystems& map();