Disable some characters in FAT label input.

This commit is contained in:
Andrius Štikonas 2017-09-10 19:15:47 +01:00
parent fbf7e78efe
commit 0f2ab468eb
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include <KLocalizedString>
#include <QRegularExpression>
#include <QRegularExpressionValidator>
#include <QString>
#include <QStringList>
@ -101,6 +102,13 @@ qint64 fat16::maxLabelLength() const
return 11;
}
QValidator* fat16::labelValidator(QObject *parent) const
{
QRegularExpressionValidator *m_LabelValidator = new QRegularExpressionValidator(parent);
m_LabelValidator->setRegularExpression(QRegularExpression(QStringLiteral(R"(^[^*?.,;:\/\\|+=<>\[\]"]*$)")));
return m_LabelValidator;
}
qint64 fat16::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("fsck.fat"), { QStringLiteral("-n"), QStringLiteral("-v"), deviceNode });

View File

@ -88,6 +88,7 @@ public:
qint64 minCapacity() const override;
qint64 maxCapacity() const override;
qint64 maxLabelLength() const override;
QValidator* labelValidator(QObject *parent) const override;
SupportTool supportToolName() const override;
bool supportToolFound() const override;