From 9f627b5ec9a5d52dc17da3ff0a11d9faebaf8aea Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 24 Oct 2010 08:32:39 +0000 Subject: [PATCH] BUGFIX: Better fix for save path editing issues in torrent addition dialog --- Changelog | 1 + src/torrentadditiondlg.cpp | 21 ++++++--------------- src/torrentadditiondlg.h | 6 +----- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Changelog b/Changelog index 734b05a75..0fd5fe8a1 100644 --- a/Changelog +++ b/Changelog @@ -7,6 +7,7 @@ - BUGFIX: Fix status list widget height issue on style change - BUGFIX: Fix rounding issue in torrent progress display - BUGFIX: Fix issue when altering files priorities of a seeding torrent + - BUGFIX: Better fix for save path editing issues in torrent addition dialog * Tue Oct 19 2010 - Christophe Dumez - v2.4.7 - BUGFIX: Display the priority column when the queueing system gets enabled diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index eada81c6b..eca958982 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -30,7 +30,7 @@ #include "torrentadditiondlg.h" -torrentAdditionDialog::torrentAdditionDialog(GUI *parent, Bittorrent* _BTSession) : QDialog((QWidget*)parent), old_label(""), hidden_height(0), cursor_pos(-1) { +torrentAdditionDialog::torrentAdditionDialog(GUI *parent, Bittorrent* _BTSession) : QDialog((QWidget*)parent), old_label(""), hidden_height(0) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); connect(this, SIGNAL(torrentPaused(QTorrentHandle&)), parent->getTransferList(), SLOT(pauseTorrent(QTorrentHandle&))); @@ -250,8 +250,8 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) { loadSavePathHistory(); // Connect slots - connect(savePathTxt, SIGNAL(editTextChanged(QString)), this, SLOT(updateDiskSpaceLabels())); - connect(savePathTxt, SIGNAL(editTextChanged(QString)), this, SLOT(updateSavePathCurrentText(QString))); + connect(savePathTxt->lineEdit(), SIGNAL(editingFinished()), this, SLOT(updateDiskSpaceLabels())); + connect(savePathTxt->lineEdit(), SIGNAL(editingFinished()), this, SLOT(updateSavePathCurrentText())); if(nbFiles == 1) { // Update properties model whenever the file path is edited connect(savePathTxt, SIGNAL(editTextChanged(QString)), this, SLOT(renameTorrentNameInModel(QString))); @@ -643,18 +643,9 @@ void torrentAdditionDialog::renameSelectedFile() { } } - void torrentAdditionDialog::restoreCursorPosition() { - savePathTxt->lineEdit()->setCursorPosition(cursor_pos); - cursor_pos = -1; - } - - void torrentAdditionDialog::updateSavePathCurrentText(QString path) { - if(cursor_pos >= 0) - return; - Q_UNUSED(path); - cursor_pos = savePathTxt->lineEdit()->cursorPosition(); - savePathTxt->setItemText(savePathTxt->currentIndex(), path); - QTimer::singleShot(0, this, SLOT(restoreCursorPosition())); + void torrentAdditionDialog::updateSavePathCurrentText() { + qDebug("updateSavePathCurrentText() - ENTER"); + savePathTxt->setItemText(savePathTxt->currentIndex(), savePathTxt->currentText()); path_history.replace(savePathTxt->currentIndex(), getCurrentTruncatedSavePath()); QString root_folder_or_file_name = ""; getCurrentTruncatedSavePath(&root_folder_or_file_name); diff --git a/src/torrentadditiondlg.h b/src/torrentadditiondlg.h index e3d1aba6f..3e881e14c 100644 --- a/src/torrentadditiondlg.h +++ b/src/torrentadditiondlg.h @@ -86,12 +86,9 @@ public slots: void saveTruncatedPathHistory(); void loadSavePathHistory(); void updateLabelInSavePath(QString label); - void updateSavePathCurrentText(QString path); + void updateSavePathCurrentText(); void resetComboLabelIndex(QString text); -protected slots: - void restoreCursorPosition(); - signals: void torrentPaused(QTorrentHandle &h); @@ -112,7 +109,6 @@ private: bool is_magnet; int hidden_height; QStringList path_history; - int cursor_pos; }; #endif