Code formatting

Refactor
This commit is contained in:
Chocobo1 2017-01-30 20:22:03 +08:00
parent 0939875ca8
commit 51e3e5438b
2 changed files with 116 additions and 113 deletions

View file

@ -674,15 +674,19 @@ void PropertiesWidget::renameSelectedFile()
const QModelIndexList selectedIndexes = m_ui->filesList->selectionModel()->selectedRows(0); const QModelIndexList selectedIndexes = m_ui->filesList->selectionModel()->selectedRows(0);
if (selectedIndexes.size() != 1) if (selectedIndexes.size() != 1)
return; return;
const QModelIndex index = selectedIndexes.first(); const QModelIndex index = selectedIndexes.first();
if (!index.isValid()) if (!index.isValid())
return; return;
// Ask for new name // Ask for new name
bool ok; bool ok = false;
QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"), QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"),
tr("New name:"), QLineEdit::Normal, tr("New name:"), QLineEdit::Normal,
index.data().toString(), &ok).trimmed(); index.data().toString(), &ok).trimmed();
if (ok && !new_name_last.isEmpty()) { if (!ok || new_name_last.isEmpty())
return;
if (!Utils::Fs::isValidFileSystemName(new_name_last)) { if (!Utils::Fs::isValidFileSystemName(new_name_last)) {
MessageBoxRaised::warning(this, tr("The file could not be renamed"), MessageBoxRaised::warning(this, tr("The file could not be renamed"),
tr("This file name contains forbidden characters, please choose a different one."), tr("This file name contains forbidden characters, please choose a different one."),
@ -787,7 +791,6 @@ void PropertiesWidget::renameSelectedFile()
} }
} }
} }
}
void PropertiesWidget::openSelectedFile() void PropertiesWidget::openSelectedFile()
{ {