From 4a39e453dc0a4fce8c6b6a5a12d42ab44576704d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Mon, 4 Sep 2017 17:39:29 +0100 Subject: [PATCH] Add a function for validating labels. --- src/fs/filesystem.cpp | 8 ++++++++ src/fs/filesystem.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 1ce8391..ffe40b6 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -387,6 +387,14 @@ qint64 FileSystem::maxLabelLength() const return 16; } +/** Validates the label for this FileSystem + * @param label the label that will be checked + * @return the valid label */ +QString FileSystem::validateLabel(const QString& label) const +{ + return label.left(maxLabelLength()); +} + /** @return this FileSystem's type as printable name */ QString FileSystem::name() const { diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index 2f344f7..284cb5e 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -182,6 +182,7 @@ public: virtual qint64 minCapacity() const; virtual qint64 maxCapacity() const; virtual qint64 maxLabelLength() const; + virtual QString validateLabel(const QString& label) const; virtual SupportTool supportToolName() const; virtual bool supportToolFound() const;