mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 11:49:01 +03:00
Fix torrent addition dialog path editing
This commit is contained in:
parent
7ae7a71782
commit
9543bd63f9
2 changed files with 13 additions and 2 deletions
|
@ -313,8 +313,8 @@ void torrentAdditionDialog::renameSelectedFile() {
|
||||||
// Ask for new name
|
// Ask for new name
|
||||||
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);
|
||||||
if (ok && !new_name_last.isEmpty()) {
|
if (ok && !new_name_last.isEmpty()) {
|
||||||
if(!misc::isValidFileSystemName(new_name_last)) {
|
if(!misc::isValidFileSystemName(new_name_last)) {
|
||||||
QMessageBox::warning(this, tr("The file could not be renamed"),
|
QMessageBox::warning(this, tr("The file could not be renamed"),
|
||||||
|
@ -614,8 +614,15 @@ void torrentAdditionDialog::renameSelectedFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void torrentAdditionDialog::restoreCursorPosition() {
|
||||||
|
savePathTxt->lineEdit()->setCursorPosition(cursor_pos);
|
||||||
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::updateSavePathCurrentText(QString path) {
|
void torrentAdditionDialog::updateSavePathCurrentText(QString path) {
|
||||||
|
Q_UNUSED(path);
|
||||||
|
cursor_pos = savePathTxt->lineEdit()->cursorPosition();
|
||||||
savePathTxt->setItemText(savePathTxt->currentIndex(), path);
|
savePathTxt->setItemText(savePathTxt->currentIndex(), path);
|
||||||
|
QTimer::singleShot(0, this, SLOT(restoreCursorPosition()));
|
||||||
path_history.replace(savePathTxt->currentIndex(), getCurrentTruncatedSavePath());
|
path_history.replace(savePathTxt->currentIndex(), getCurrentTruncatedSavePath());
|
||||||
QString root_folder_or_file_name = "";
|
QString root_folder_or_file_name = "";
|
||||||
getCurrentTruncatedSavePath(&root_folder_or_file_name);
|
getCurrentTruncatedSavePath(&root_folder_or_file_name);
|
||||||
|
|
|
@ -88,6 +88,9 @@ public slots:
|
||||||
void updateSavePathCurrentText(QString path);
|
void updateSavePathCurrentText(QString path);
|
||||||
void resetComboLabelIndex(QString text);
|
void resetComboLabelIndex(QString text);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void restoreCursorPosition();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void torrentPaused(QTorrentHandle &h);
|
void torrentPaused(QTorrentHandle &h);
|
||||||
|
|
||||||
|
@ -108,6 +111,7 @@ private:
|
||||||
bool is_magnet;
|
bool is_magnet;
|
||||||
int hidden_height;
|
int hidden_height;
|
||||||
QStringList path_history;
|
QStringList path_history;
|
||||||
|
int cursor_pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue