mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Merge pull request #9406 from thalieht/preselecttext
Preselect name without extension when renaming files
This commit is contained in:
commit
bfb1210c43
4 changed files with 20 additions and 10 deletions
|
@ -489,8 +489,9 @@ void AddNewTorrentDialog::renameSelectedFile()
|
|||
|
||||
// Ask for new name
|
||||
bool ok = false;
|
||||
QString newName = AutoExpandableDialog::getText(this, tr("Renaming"), tr("New name:"), QLineEdit::Normal, modelIndex.data().toString(), &ok)
|
||||
.trimmed();
|
||||
const bool isFile = (m_contentModel->itemType(modelIndex) == TorrentContentModelItem::FileType);
|
||||
QString newName = AutoExpandableDialog::getText(this, tr("Renaming"), tr("New name:"), QLineEdit::Normal
|
||||
, modelIndex.data().toString(), &ok, isFile).trimmed();
|
||||
if (!ok) return;
|
||||
|
||||
if (newName.isEmpty() || !Utils::Fs::isValidFileSystemName(newName)) {
|
||||
|
@ -500,8 +501,7 @@ void AddNewTorrentDialog::renameSelectedFile()
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_contentModel->itemType(modelIndex) == TorrentContentModelItem::FileType) {
|
||||
// renaming a file
|
||||
if (isFile) {
|
||||
const int fileIndex = m_contentModel->getFileIndex(modelIndex);
|
||||
|
||||
if (newName.endsWith(QB_EXT))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue