mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added validation for names of folders
This commit is contained in:
parent
bba514b727
commit
fe26414aa6
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user