From 35e98b6cbbffa0885828d7ac6db0cd7097a7925d Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 26 Oct 2010 16:30:22 +0000 Subject: [PATCH] Fix crash when pressing enter in the save path field of the torrent addition dialog --- src/torrentadditiondlg.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index 444511ea4..6efe99505 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -49,6 +49,8 @@ torrentAdditionDialog::torrentAdditionDialog(GUI *parent, QBtSession* _BTSession connect(comboLabel, SIGNAL(editTextChanged(QString)), this, SLOT(resetComboLabelIndex(QString))); connect(comboLabel, SIGNAL(editTextChanged(QString)), this, SLOT(updateLabelInSavePath(QString))); connect(comboLabel, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateLabelInSavePath(QString))); + // Important: as a default, it inserts at the bottom which is not desirable + savePathTxt->setInsertPolicy(QComboBox::InsertAtCurrent); // Remember columns width readSettings(); //torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch); @@ -531,6 +533,7 @@ void torrentAdditionDialog::renameSelectedFile() { } void torrentAdditionDialog::on_OkButton_clicked(){ + qDebug() << "void torrentAdditionDialog::on_OkButton_clicked() - ENTER"; if(savePathTxt->currentText().trimmed().isEmpty()){ QMessageBox::critical(0, tr("Empty save path"), tr("Please enter a save path")); return; @@ -623,7 +626,9 @@ void torrentAdditionDialog::renameSelectedFile() { emit torrentPaused(h); } // Close the dialog + qDebug("Closing torrent addition dialog..."); close(); + qDebug("Closed"); } void torrentAdditionDialog::resetComboLabelIndex(QString text) { @@ -647,6 +652,8 @@ void torrentAdditionDialog::renameSelectedFile() { void torrentAdditionDialog::updateSavePathCurrentText() { qDebug("updateSavePathCurrentText() - ENTER"); savePathTxt->setItemText(savePathTxt->currentIndex(), savePathTxt->currentText()); + qDebug("path_history.size() == %d", path_history.size()); + qDebug("savePathTxt->currentIndex() == %d", savePathTxt->currentIndex()); path_history.replace(savePathTxt->currentIndex(), getCurrentTruncatedSavePath()); QString root_folder_or_file_name = ""; getCurrentTruncatedSavePath(&root_folder_or_file_name);