- 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

@ -868,11 +868,20 @@ void TransferListWidget::toggleSelectedFirstLastPiecePrio() {
void TransferListWidget::askNewLabelForSelection() {
// Ask for label
bool ok;
QString label = QInputDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, "", &ok);
if (ok && !label.isEmpty()) {
// Assign label to selection
setSelectionLabel(label);
}
QString label = "";
bool invalid;
do {
invalid = false;
label = QInputDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, label, &ok);
if (ok && !label.isEmpty()) {
if(misc::isValidFileSystemName(label)) {
setSelectionLabel(label);
} else {
QMessageBox::warning(this, tr("Invalid label name"), tr("Please don't use any special characters in the label name."));
invalid = true;
}
}
}while(invalid);
}
void TransferListWidget::renameSelectedTorrent() {