bool isValidFileName(QString text, bool bWithExt)
{
if(text.isEmpty())
return false;
if (bWithExt)
{
int pos = text.lastIndexOf('.');
text.truncate(pos);
}
QString pattern("[\\\\/:|*?\"<>]|[cC][oO][mM][1-9]|[lL][pP][tT][1-9]|[cC][oO][nM]|[pP][rR][nN]|[aA][uU][xX]|[nN][uU][lL]");
QRegExp rx(pattern);
int match = text.indexOf(rx);
if(match >= 0)
return false;
return true;
}
{
if(text.isEmpty())
return false;
if (bWithExt)
{
int pos = text.lastIndexOf('.');
text.truncate(pos);
}
QString pattern("[\\\\/:|*?\"<>]|[cC][oO][mM][1-9]|[lL][pP][tT][1-9]|[cC][oO][nM]|[pP][rR][nN]|[aA][uU][xX]|[nN][uU][lL]");
QRegExp rx(pattern);
int match = text.indexOf(rx);
if(match >= 0)
return false;
return true;
}