From e9871e0e82aa191ead718587a4bb15a00d77d751 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Thu, 20 May 2010 15:25:55 +0000 Subject: [PATCH] add a check when scanning devices if support for all file systems we found is present. if not, show a messagebox with detailed information what is missing. svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1128887 --- src/fs/btrfs.cpp | 22 +++++++ src/fs/btrfs.h | 2 + src/fs/ext2.cpp | 24 +++++++- src/fs/ext2.h | 2 + src/fs/extended.h | 2 + src/fs/fat16.cpp | 24 ++++++++ src/fs/fat16.h | 2 + src/fs/filesystem.cpp | 10 ++++ src/fs/filesystem.h | 14 +++++ src/fs/hfs.cpp | 23 ++++++++ src/fs/hfs.h | 2 + src/fs/hfsplus.cpp | 22 +++++++ src/fs/hfsplus.h | 2 + src/fs/hpfs.h | 1 + src/fs/jfs.cpp | 27 +++++++++ src/fs/jfs.h | 3 + src/fs/linuxswap.cpp | 22 +++++++ src/fs/linuxswap.h | 3 + src/fs/luks.h | 1 + src/fs/ntfs.cpp | 22 +++++++ src/fs/ntfs.h | 2 + src/fs/ocfs2.cpp | 22 +++++++ src/fs/ocfs2.h | 2 + src/fs/reiser4.cpp | 22 +++++++ src/fs/reiser4.h | 2 + src/fs/reiserfs.cpp | 22 +++++++ src/fs/reiserfs.h | 2 + src/fs/ufs.h | 2 + src/fs/unformatted.h | 2 + src/fs/unknown.h | 1 + src/fs/xfs.cpp | 27 +++++++++ src/fs/xfs.h | 3 + src/fs/zfs.h | 1 + src/gui/filesystemsupportdialog.cpp | 2 + src/gui/filesystemsupportdialogwidgetbase.ui | 5 ++ src/gui/mainwindow.cpp | 61 ++++++++++++++++++++ src/gui/mainwindow.h | 1 + 37 files changed, 408 insertions(+), 1 deletion(-) diff --git a/src/fs/btrfs.cpp b/src/fs/btrfs.cpp index 67c2d5e..900c956 100644 --- a/src/fs/btrfs.cpp +++ b/src/fs/btrfs.cpp @@ -65,6 +65,28 @@ namespace FS m_GetUUID = cmdSupportCore; } + bool btrfs::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && +// m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && + m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool btrfs::supportToolName() const + { + return SupportTool("e2fsprogs", KUrl("http://e2fsprogs.sf.net")); + } + qint64 btrfs::maxCapacity() const { return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); diff --git a/src/fs/btrfs.h b/src/fs/btrfs.h index abec65e..63b5146 100644 --- a/src/fs/btrfs.h +++ b/src/fs/btrfs.h @@ -65,6 +65,8 @@ namespace FS virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/ext2.cpp b/src/fs/ext2.cpp index 8bf9d3c..0bccea9 100644 --- a/src/fs/ext2.cpp +++ b/src/fs/ext2.cpp @@ -61,9 +61,31 @@ namespace FS m_GetUUID = cmdSupportCore; } + bool ext2::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && + m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && + m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool ext2::supportToolName() const + { + return SupportTool("e2fsprogs", KUrl("http://e2fsprogs.sf.net")); + } + qint64 ext2::maxCapacity() const { - return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); + return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); } qint64 ext2::readUsedCapacity(const QString& deviceNode) const diff --git a/src/fs/ext2.h b/src/fs/ext2.h index e500ba5..b3f2c4f 100644 --- a/src/fs/ext2.h +++ b/src/fs/ext2.h @@ -65,6 +65,8 @@ namespace FS virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/extended.h b/src/fs/extended.h index 65ebe9d..d2dab2b 100644 --- a/src/fs/extended.h +++ b/src/fs/extended.h @@ -54,6 +54,8 @@ namespace FS virtual CommandSupportType supportShrink() const { return m_Shrink; } virtual CommandSupportType supportMove() const { return m_Move; } + virtual bool supportToolFound() const { return true; } + public: static CommandSupportType m_Create; static CommandSupportType m_Grow; diff --git a/src/fs/fat16.cpp b/src/fs/fat16.cpp index e3f87ff..13c366b 100644 --- a/src/fs/fat16.cpp +++ b/src/fs/fat16.cpp @@ -69,6 +69,30 @@ namespace FS m_GetUUID = cmdSupportCore; } + bool fat16::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && + m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && + m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool fat16::supportToolName() const + { + // also, dd for updating the UUID, but let's assume it's there ;-) + return SupportTool("dosfstools", KUrl("http://www.daniel-baumann.ch/software/dosfstools/")); + } + + qint64 fat16::minCapacity() const { return 16 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB); diff --git a/src/fs/fat16.h b/src/fs/fat16.h index bc89dfc..088d967 100644 --- a/src/fs/fat16.h +++ b/src/fs/fat16.h @@ -65,6 +65,8 @@ namespace FS virtual qint64 minCapacity() const; virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 0fe5e44..798b94f 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -355,3 +355,13 @@ FileSystem::Type FileSystem::defaultFileSystem() { return static_cast(Config::defaultFileSystem()); } + +bool FileSystem::supportToolFound() const +{ + return false; +} + +FileSystem::SupportTool FileSystem::supportToolName() const +{ + return SupportTool(); +} diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index 571849f..967dabf 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -21,6 +21,8 @@ #define FILESYSTEM__H +#include + #include #include #include @@ -41,6 +43,15 @@ class FileSystem Q_DISABLE_COPY(FileSystem) public: + class SupportTool + { + public: + SupportTool(const QString& n = QString(), const KUrl& u = KUrl()) : name(n), url(u) {} + + const QString name; + const KUrl url; + }; + /** Supported FileSystem types */ enum Type { @@ -128,6 +139,9 @@ class FileSystem virtual qint64 minCapacity() const; virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; + virtual QString name() const; virtual FileSystem::Type type() const { return m_Type; } /**< @return the FileSystem's type */ diff --git a/src/fs/hfs.cpp b/src/fs/hfs.cpp index efeab7a..f7771c8 100644 --- a/src/fs/hfs.cpp +++ b/src/fs/hfs.cpp @@ -54,6 +54,29 @@ namespace FS m_Backup = cmdSupportCore; } + bool hfs::supportToolFound() const + { + return +// m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && +// m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && +// m_Grow != cmdSupportNone && +// m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone; +// m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool hfs::supportToolName() const + { + return SupportTool("hfsutils", KUrl("http://www.mars.org/home/rob/proj/hfs/")); + } + + qint64 hfs::maxCapacity() const { return 2 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB); diff --git a/src/fs/hfs.h b/src/fs/hfs.h index 7503f38..d0ddca6 100644 --- a/src/fs/hfs.h +++ b/src/fs/hfs.h @@ -57,6 +57,8 @@ namespace FS virtual CommandSupportType supportBackup() const { return m_Backup; } virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/hfsplus.cpp b/src/fs/hfsplus.cpp index f181965..860dc0f 100644 --- a/src/fs/hfsplus.cpp +++ b/src/fs/hfsplus.cpp @@ -49,6 +49,28 @@ namespace FS m_Backup = cmdSupportCore; } + bool hfsplus::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && +// m_GetLabel != cmdSupportNone && +// m_SetLabel != cmdSupportNone && +// m_Create != cmdSupportNone && + m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && +// m_Grow != cmdSupportNone && +// m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone; +// m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool hfsplus::supportToolName() const + { + return SupportTool("hfsplus", KUrl()); + } + qint64 hfsplus::maxCapacity() const { return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); diff --git a/src/fs/hfsplus.h b/src/fs/hfsplus.h index 8e3833b..6361d75 100644 --- a/src/fs/hfsplus.h +++ b/src/fs/hfsplus.h @@ -54,6 +54,8 @@ namespace FS virtual CommandSupportType supportBackup() const { return m_Backup; } virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/hpfs.h b/src/fs/hpfs.h index bb0d409..6a4ab07 100644 --- a/src/fs/hpfs.h +++ b/src/fs/hpfs.h @@ -58,6 +58,7 @@ namespace FS virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual qint64 maxCapacity() const; + virtual bool supportToolFound() const { return true; } public: static CommandSupportType m_GetUsed; diff --git a/src/fs/jfs.cpp b/src/fs/jfs.cpp index fa42cda..c26b8b7 100644 --- a/src/fs/jfs.cpp +++ b/src/fs/jfs.cpp @@ -59,11 +59,38 @@ namespace FS m_Backup = cmdSupportCore; } + bool jfs::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && +// m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone; +// m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool jfs::supportToolName() const + { + return SupportTool("jfsutils", KUrl("http://jfs.sourceforge.net/")); + } + qint64 jfs::minCapacity() const { return 16 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB); } + qint64 jfs::maxCapacity() const + { + return 32 * Capacity::unitFactor(Capacity::Byte, Capacity::PiB); + } + qint64 jfs::readUsedCapacity(const QString& deviceNode) const { ExternalCommand cmd("jfs_debugfs", QStringList() << deviceNode); diff --git a/src/fs/jfs.h b/src/fs/jfs.h index 5845986..66a82fe 100644 --- a/src/fs/jfs.h +++ b/src/fs/jfs.h @@ -61,6 +61,9 @@ namespace FS virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } virtual qint64 minCapacity() const; + virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/linuxswap.cpp b/src/fs/linuxswap.cpp index 921e7ac..5b6cd15 100644 --- a/src/fs/linuxswap.cpp +++ b/src/fs/linuxswap.cpp @@ -48,6 +48,28 @@ namespace FS m_GetUUID = cmdSupportCore; } + bool linuxswap::supportToolFound() const + { + return +// m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && +// m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && + m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && +// m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool linuxswap::supportToolName() const + { + return SupportTool("util-linux", KUrl("http://www.kernel.org/pub/linux/utils/util-linux-ng/")); + } + bool linuxswap::create(Report& report, const QString& deviceNode) const { ExternalCommand cmd(report, "mkswap", QStringList() << deviceNode); diff --git a/src/fs/linuxswap.h b/src/fs/linuxswap.h index 054d1f4..2fdc62f 100644 --- a/src/fs/linuxswap.h +++ b/src/fs/linuxswap.h @@ -66,6 +66,9 @@ namespace FS virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; + public: static CommandSupportType m_Create; static CommandSupportType m_Grow; diff --git a/src/fs/luks.h b/src/fs/luks.h index b517c7c..a36fc10 100644 --- a/src/fs/luks.h +++ b/src/fs/luks.h @@ -58,6 +58,7 @@ namespace FS virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual qint64 maxCapacity() const; + virtual bool supportToolFound() const { return true; } public: static CommandSupportType m_GetUsed; diff --git a/src/fs/ntfs.cpp b/src/fs/ntfs.cpp index 8cdbc0c..559b8e7 100644 --- a/src/fs/ntfs.cpp +++ b/src/fs/ntfs.cpp @@ -68,6 +68,28 @@ namespace FS m_GetUUID = cmdSupportCore; } + bool ntfs::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && + m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && + m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool ntfs::supportToolName() const + { + return SupportTool("ntfsprogs", KUrl("http://www.linux-ntfs.org/doku.php?id=ntfsprogs")); + } + qint64 ntfs::maxCapacity() const { return 256 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB); diff --git a/src/fs/ntfs.h b/src/fs/ntfs.h index 14a3ee7..c2fb9e4 100644 --- a/src/fs/ntfs.h +++ b/src/fs/ntfs.h @@ -67,6 +67,8 @@ namespace FS virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/ocfs2.cpp b/src/fs/ocfs2.cpp index 4e74b72..0c4f455 100644 --- a/src/fs/ocfs2.cpp +++ b/src/fs/ocfs2.cpp @@ -68,6 +68,28 @@ namespace FS m_GetUUID = cmdSupportCore; } + bool ocfs2::supportToolFound() const + { + return +// m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && + m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && +// m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool ocfs2::supportToolName() const + { + return SupportTool("ocfs2-tools", KUrl("http://oss.oracle.com/projects/ocfs2-tools/")); + } + qint64 ocfs2::maxCapacity() const { return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); diff --git a/src/fs/ocfs2.h b/src/fs/ocfs2.h index dd4bfe7..237f961 100644 --- a/src/fs/ocfs2.h +++ b/src/fs/ocfs2.h @@ -65,6 +65,8 @@ namespace FS virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/reiser4.cpp b/src/fs/reiser4.cpp index 7f70b1c..f0fa9c0 100644 --- a/src/fs/reiser4.cpp +++ b/src/fs/reiser4.cpp @@ -50,6 +50,28 @@ namespace FS m_Backup = cmdSupportCore; } + bool reiser4::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && +// m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && +// m_Grow != cmdSupportNone && +// m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone; +// m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool reiser4::supportToolName() const + { + return SupportTool("reiser4progs", KUrl("http://www.kernel.org/pub/linux/utils/fs/reiser4/reiser4progs/")); + } + qint64 reiser4::maxCapacity() const { // looks like it's actually unknown. see diff --git a/src/fs/reiser4.h b/src/fs/reiser4.h index 3b4df49..57bf598 100644 --- a/src/fs/reiser4.h +++ b/src/fs/reiser4.h @@ -57,6 +57,8 @@ namespace FS virtual CommandSupportType supportBackup() const { return m_Backup; } virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/reiserfs.cpp b/src/fs/reiserfs.cpp index 200571a..8a21612 100644 --- a/src/fs/reiserfs.cpp +++ b/src/fs/reiserfs.cpp @@ -62,6 +62,28 @@ namespace FS m_GetUUID = cmdSupportCore; } + bool reiserfs::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && + m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && + m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool reiserfs::supportToolName() const + { + return SupportTool("reiserfsprogs", KUrl("http://www.kernel.org/pub/linux/utils/fs/reiserfs/")); + } + qint64 reiserfs::minCapacity() const { return 32 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB); diff --git a/src/fs/reiserfs.h b/src/fs/reiserfs.h index 4661fd9..b32901f 100644 --- a/src/fs/reiserfs.h +++ b/src/fs/reiserfs.h @@ -68,6 +68,8 @@ namespace FS virtual qint64 minCapacity() const; virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/ufs.h b/src/fs/ufs.h index cfdd380..9fb80f2 100644 --- a/src/fs/ufs.h +++ b/src/fs/ufs.h @@ -46,6 +46,8 @@ namespace FS virtual CommandSupportType supportCopy() const { return m_Copy; } virtual CommandSupportType supportBackup() const { return m_Backup; } + virtual bool supportToolFound() const { return true; } + public: static CommandSupportType m_Move; static CommandSupportType m_Copy; diff --git a/src/fs/unformatted.h b/src/fs/unformatted.h index 7cde3f5..fcb714e 100644 --- a/src/fs/unformatted.h +++ b/src/fs/unformatted.h @@ -48,6 +48,8 @@ namespace FS virtual CommandSupportType supportCreate() const { return m_Create; } + virtual bool supportToolFound() const { return true; } + public: static CommandSupportType m_Create; }; diff --git a/src/fs/unknown.h b/src/fs/unknown.h index 95acaa4..d124a42 100644 --- a/src/fs/unknown.h +++ b/src/fs/unknown.h @@ -39,6 +39,7 @@ namespace FS public: static void init() {} + virtual bool supportToolFound() const { return true; } }; } diff --git a/src/fs/xfs.cpp b/src/fs/xfs.cpp index f734528..7319181 100644 --- a/src/fs/xfs.cpp +++ b/src/fs/xfs.cpp @@ -62,11 +62,38 @@ namespace FS m_Backup = cmdSupportCore; } + bool xfs::supportToolFound() const + { + return + m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && + m_Grow != cmdSupportNone && +// m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone; +// m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool xfs::supportToolName() const + { + return SupportTool("xfsprogs", KUrl("http://oss.sgi.com/projects/xfs/")); + } + qint64 xfs::minCapacity() const { return 32 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB); } + qint64 xfs::maxCapacity() const + { + return 8 * Capacity::unitFactor(Capacity::Byte, Capacity::EiB); + } + qint64 xfs::readUsedCapacity(const QString& deviceNode) const { ExternalCommand cmd("xfs_db", QStringList() << "-c" << "sb 0" << "-c" << "print" << deviceNode); diff --git a/src/fs/xfs.h b/src/fs/xfs.h index 8c4b71e..58f193a 100644 --- a/src/fs/xfs.h +++ b/src/fs/xfs.h @@ -62,6 +62,9 @@ namespace FS virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } virtual qint64 minCapacity() const; + virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; public: static CommandSupportType m_GetUsed; diff --git a/src/fs/zfs.h b/src/fs/zfs.h index 4999ebe..739df1b 100644 --- a/src/fs/zfs.h +++ b/src/fs/zfs.h @@ -58,6 +58,7 @@ namespace FS virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual qint64 maxCapacity() const; + virtual bool supportToolFound() const { return true; } public: static CommandSupportType m_GetUsed; diff --git a/src/gui/filesystemsupportdialog.cpp b/src/gui/filesystemsupportdialog.cpp index a44d00a..613da5e 100644 --- a/src/gui/filesystemsupportdialog.cpp +++ b/src/gui/filesystemsupportdialog.cpp @@ -88,6 +88,8 @@ void FileSystemSupportDialog::setupDialog() // if a file is an image of a supported or unsupported (or even invalid) filesystem item->setIcon(i++, yes); + item->setText(i++, fs->supportToolName().name.isEmpty() ? "---" : fs->supportToolName().name); + dialogWidget().tree().addTopLevelItem(item); } diff --git a/src/gui/filesystemsupportdialogwidgetbase.ui b/src/gui/filesystemsupportdialogwidgetbase.ui index 25e67d6..9fa73fe 100644 --- a/src/gui/filesystemsupportdialogwidgetbase.ui +++ b/src/gui/filesystemsupportdialogwidgetbase.ui @@ -120,6 +120,11 @@ Some file systems need external tools to be installed for them to be supported. Restore + + + Support Tools + + diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index b4033b6..80c4c56 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -623,6 +623,7 @@ void MainWindow::on_m_DeviceScanner_finished() listDevices().setSelectedDevice(operationStack().previewDevices()[0]->deviceNode()); updateSeletedDeviceMenu(); + checkFileSystemSupport(); } void MainWindow::updateSeletedDeviceMenu() @@ -1040,3 +1041,63 @@ void MainWindow::onPropertiesDevice(const QString&) delete dlg; } } + +static QStringList checkSupportInNode(const PartitionNode* parent) +{ + QStringList rval; + + foreach(const PartitionNode* node, parent->children()) + { + const Partition* p = dynamic_cast(node); + + if (p == NULL) + continue; + + if (node->children().size() > 0) + rval << checkSupportInNode(node); + + if (!p->fileSystem().supportToolFound() && !p->fileSystem().supportToolName().name.isEmpty()) + rval << QString("" + "%1" + "%2" + "%3" + "%4" + "") + .arg(p->deviceNode()) + .arg(p->fileSystem().name()) + .arg(p->fileSystem().supportToolName().name) + .arg(p->fileSystem().supportToolName().url.prettyUrl()); + } + + return rval; +} + +void MainWindow::checkFileSystemSupport() +{ + QStringList supportList; + + foreach(const Device* d, operationStack().previewDevices()) + supportList << checkSupportInNode(d->partitionTable()); + + supportList.sort(); + supportList.removeDuplicates(); + + if (!supportList.isEmpty()) + KMessageBox::information(this, + i18nc("@info", + "No support tools were found for file systems currently present on hard disks in this computer:" + "" + "" + "" + "" + "" + "" + "" + "%1" + "
PartitionFile SystemSupport ToolsURL
" + "As long as the support tools for these file systems are not installed you will not be able to modify them." + "You should find packages with these support tools in your distribution's package manager.", + supportList.join("\n")), + i18nc("@title:window", "Missing File System Support Packages"), + "showInformationOnMissingFileSystemSupport", KMessageBox::Notify | KMessageBox::AllowLink); +} diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 500d26f..4a78842 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -66,6 +66,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi void saveConfig() const; void updateWindowTitle(); void updateSeletedDeviceMenu(); + void checkFileSystemSupport(); void enableActions();