mirror of
https://github.com/YACReader/yacreader
synced 2025-07-27 01:15:07 -04:00
added validation for names of folders
This commit is contained in:
@ -1477,7 +1477,11 @@ void LibraryWindow::addFolderToCurrentIndex()
|
|||||||
QString newFolderName = QInputDialog::getText(this, tr("Add new folder"),
|
QString newFolderName = QInputDialog::getText(this, tr("Add new folder"),
|
||||||
tr("Folder name:"), QLineEdit::Normal,
|
tr("Folder name:"), QLineEdit::Normal,
|
||||||
"", &ok);
|
"", &ok);
|
||||||
if (ok && !newFolderName.isEmpty())
|
|
||||||
|
QRegExp invalidChars("\/\\\:\*\?\"\<\>\|");
|
||||||
|
bool isValid = !newFolderName.contains(invalidChars);
|
||||||
|
|
||||||
|
if (ok && !newFolderName.isEmpty() && isValid)
|
||||||
{
|
{
|
||||||
QString parentPath = QDir::cleanPath(currentPath()+foldersModel->getFolderPath(currentIndex));
|
QString parentPath = QDir::cleanPath(currentPath()+foldersModel->getFolderPath(currentIndex));
|
||||||
QDir parentDir(parentPath);
|
QDir parentDir(parentPath);
|
||||||
|
Reference in New Issue
Block a user