Browse Source

Remove leading and trailing whitespace when choosing filenames. Fixes issue #401.

adaptive-webui-19844
sledgehammer999 12 years ago
parent
commit
a2e4e2ad37
  1. 2
      src/addnewtorrentdialog.cpp
  2. 2
      src/properties/propertieswidget.cpp
  3. 2
      src/transferlistwidget.cpp

2
src/addnewtorrentdialog.cpp

@ -394,7 +394,7 @@ void AddNewTorrentDialog::renameSelectedFile()
bool ok; bool ok;
const QString new_name_last = QInputDialog::getText(this, tr("Rename the file"), const QString new_name_last = QInputDialog::getText(this, tr("Rename the file"),
tr("New name:"), QLineEdit::Normal, tr("New name:"), QLineEdit::Normal,
index.data().toString(), &ok); index.data().toString(), &ok).trimmed();
if (ok && !new_name_last.isEmpty()) { if (ok && !new_name_last.isEmpty()) {
if (!fsutils::isValidFileSystemName(new_name_last)) { if (!fsutils::isValidFileSystemName(new_name_last)) {
QMessageBox::warning(this, tr("The file could not be renamed"), QMessageBox::warning(this, tr("The file could not be renamed"),

2
src/properties/propertieswidget.cpp

@ -511,7 +511,7 @@ void PropertiesWidget::renameSelectedFile() {
bool ok; bool ok;
QString new_name_last = QInputDialog::getText(this, tr("Rename the file"), QString new_name_last = QInputDialog::getText(this, tr("Rename the file"),
tr("New name:"), QLineEdit::Normal, tr("New name:"), QLineEdit::Normal,
index.data().toString(), &ok); index.data().toString(), &ok).trimmed();
if (ok && !new_name_last.isEmpty()) { if (ok && !new_name_last.isEmpty()) {
if (!fsutils::isValidFileSystemName(new_name_last)) { if (!fsutils::isValidFileSystemName(new_name_last)) {
QMessageBox::warning(this, tr("The file could not be renamed"), QMessageBox::warning(this, tr("The file could not be renamed"),

2
src/transferlistwidget.cpp

@ -593,7 +593,7 @@ void TransferListWidget::askNewLabelForSelection() {
bool invalid; bool invalid;
do { do {
invalid = false; invalid = false;
const QString label = QInputDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, "", &ok); const QString label = QInputDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, "", &ok).trimmed();
if (ok && !label.isEmpty()) { if (ok && !label.isEmpty()) {
if (fsutils::isValidFileSystemName(label)) { if (fsutils::isValidFileSystemName(label)) {
setSelectionLabel(label); setSelectionLabel(label);

Loading…
Cancel
Save