[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4658 - gnunet-qt/src/plugins/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4658 - gnunet-qt/src/plugins/fs |
Date: |
Sat, 10 Mar 2007 12:44:48 -0700 (MST) |
Author: durner
Date: 2007-03-10 12:44:48 -0700 (Sat, 10 Mar 2007)
New Revision: 4658
Modified:
gnunet-qt/src/plugins/fs/downloadController.cc
gnunet-qt/src/plugins/fs/downloadController.h
gnunet-qt/src/plugins/fs/fs.cc
Log:
fix handling of completed/aborted downloads
Modified: gnunet-qt/src/plugins/fs/downloadController.cc
===================================================================
--- gnunet-qt/src/plugins/fs/downloadController.cc 2007-03-10 09:07:02 UTC
(rev 4657)
+++ gnunet-qt/src/plugins/fs/downloadController.cc 2007-03-10 19:44:48 UTC
(rev 4658)
@@ -27,6 +27,7 @@
#include <math.h>
#include <QFileInfo>
#include <QDir>
+#include <QStandardItem>
#include "gnunet_qt_common.h"
#include "downloadController.h"
@@ -209,17 +210,14 @@
state(idx, FSUI_download_progress);
}
-void GFSDownloadController::completed(GFSEcrsUri uri, QString file)
+void GFSDownloadController::completed(QPersistentModelIndex *idx, GFSEcrsUri
uri, QString file)
{
GFSDownloadList::iterator it;
it = downloadList.find(uri);
if (it != downloadList.end())
- {
fs->searchController()->downloadCompleted(*it, file);
- state(&(*it), FSUI_download_completed);
- downloadList.erase(it);
- }
+ state(idx, FSUI_download_completed);
}
void GFSDownloadController::state(QPersistentModelIndex *idx, FSUI_EventType
type)
@@ -227,9 +225,12 @@
QModelIndex index = downloadModel.index(idx->row(), 2, idx->parent());
downloadModel.setData(index, QVariant(fs->fsuiState(type)), Qt::DisplayRole);
- downloadModel.setData(index,
- QVariant(type == FSUI_download_completed || type == FSUI_download_stopped),
- Qt::UserRole);
+ if (type == FSUI_download_stopped)
+ downloadModel.removeRow(idx->row());
+ else
+ downloadModel.setData(index,
+ QVariant(type == FSUI_download_completed || type ==
FSUI_download_aborted),
+ Qt::UserRole);
}
void GFSDownloadController::clear()
@@ -240,7 +241,13 @@
while(idx.isValid())
{
if (downloadModel.data(idx, Qt::UserRole).toInt() == 1)
- downloadModel.removeRow(row);
+ {
+ QStandardItem *item;
+
+ item = downloadModel.item(idx.row());
+ FSUI_stopDownload(fs->context(), (struct FSUI_DownloadList *)
+ item->data(Qt::UserRole).value<void *>());
+ }
else
idx = downloadModel.index(++row, 2);
}
Modified: gnunet-qt/src/plugins/fs/downloadController.h
===================================================================
--- gnunet-qt/src/plugins/fs/downloadController.h 2007-03-10 09:07:02 UTC
(rev 4657)
+++ gnunet-qt/src/plugins/fs/downloadController.h 2007-03-10 19:44:48 UTC
(rev 4658)
@@ -64,7 +64,7 @@
void progress(QPersistentModelIndex *idx, unsigned long long completed,
unsigned long long total, cron_t eta);
- void completed(GFSEcrsUri uri, QString file);
+ void completed(QPersistentModelIndex *idx, GFSEcrsUri uri, QString file);
void state(QPersistentModelIndex *idx, FSUI_EventType type);
Modified: gnunet-qt/src/plugins/fs/fs.cc
===================================================================
--- gnunet-qt/src/plugins/fs/fs.cc 2007-03-10 09:07:02 UTC (rev 4657)
+++ gnunet-qt/src/plugins/fs/fs.cc 2007-03-10 19:44:48 UTC (rev 4658)
@@ -112,7 +112,8 @@
event->data.DownloadProgress.eta);
break;
case FSUI_download_completed:
- downloadCntrl->completed(event->data.DownloadCompleted.uri,
+ downloadCntrl->completed((QPersistentModelIndex *)
event->data.DownloadCompleted.dc.cctx,
+ event->data.DownloadCompleted.uri,
event->data.DownloadCompleted.filename);
break;
case FSUI_download_error:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4658 - gnunet-qt/src/plugins/fs,
gnunet <=