From 15de12f6dd459a25f483d8cfa96cda43e8c983cb Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 26 Aug 2009 05:26:43 +0000 Subject: [PATCH] - Several fixes due to new column sorting code --- src/downloadingTorrents.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index b4e530463..63690ac60 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -172,13 +172,13 @@ void DownloadingTorrents::pauseTorrent(QString hash) { } QString DownloadingTorrents::getHashFromRow(unsigned int row) const { - Q_ASSERT(row < (unsigned int)DLListModel->rowCount()); - return DLListModel->data(DLListModel->index(row, HASH)).toString(); + Q_ASSERT(row < (unsigned int)proxyModel->rowCount()); + return proxyModel->data(proxyModel->index(row, HASH)).toString(); } // Show torrent properties dialog void DownloadingTorrents::showProperties(const QModelIndex &index) { - showPropertiesFromHash(DLListModel->data(DLListModel->index(index.row(), HASH)).toString()); + showPropertiesFromHash(getHashFromRow(index.row())); } void DownloadingTorrents::showPropertiesFromHash(QString hash) { @@ -209,7 +209,7 @@ void DownloadingTorrents::on_actionSet_download_limit_triggered() { foreach(const QModelIndex &index, selectedIndexes) { if(index.column() == NAME) { // Get the file hash - hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); + hashes << getHashFromRow(index.row()); } } Q_ASSERT(hashes.size() > 0); @@ -222,7 +222,7 @@ void DownloadingTorrents::on_actionSet_upload_limit_triggered() { foreach(const QModelIndex &index, selectedIndexes) { if(index.column() == NAME) { // Get the file hash - hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); + hashes << getHashFromRow(index.row()); } } Q_ASSERT(hashes.size() > 0); @@ -243,7 +243,7 @@ void DownloadingTorrents::forceRecheck() { QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); foreach(const QModelIndex &index, selectedIndexes){ if(index.column() == NAME){ - QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); + QString hash = getHashFromRow(index.row()); QTorrentHandle h = BTSession->getTorrentHandle(hash); if(h.is_valid() && h.has_metadata()) h.force_recheck(); @@ -262,7 +262,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint&) { foreach(const QModelIndex &index, selectedIndexes) { if(index.column() == NAME) { // Get the file name - QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); + QString hash = getHashFromRow(index.row()); // Get handle and pause the torrent h = BTSession->getTorrentHandle(hash); if(!h.is_valid()) continue; @@ -494,7 +494,7 @@ QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{ foreach(const QModelIndex &index, selectedIndexes) { if(index.column() == NAME) { // Get the file hash - QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); + QString hash = getHashFromRow(index.row()); res << hash; if(only_one) break; }