- Validate label names to make sure there is no character forbidden by the file system

This commit is contained in:
Christophe Dumez 2010-01-05 12:18:17 +00:00
parent 2b289655c1
commit 037e57b687
4 changed files with 49 additions and 11 deletions

View file

@ -183,6 +183,20 @@ public:
}
}
static QString toValidFileSystemName(QString filename) {
filename = filename.replace("\\", "/");
QRegExp regex("[/:!?\"*<>|]");
return filename.replace(regex, " ");
}
static bool isValidFileSystemName(QString filename) {
filename = filename.replace("\\", "/");
QRegExp regex("[/:!?\"*<>|]");
if(filename.contains(regex))
return false;
return true;
}
#ifdef Q_WS_MAC
static QString getFullPath(const FSRef &ref)
{