clear downloads which are in queue directly from custom menu cancel action (until now they were remaining in queue when for ex all list was selected for a clear and a separate action was needed for them)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1537 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-08-14 20:48:53 +00:00
parent 0f5e003f18
commit 8f0c7fbdfe
2 changed files with 27 additions and 13 deletions

View File

@ -905,31 +905,39 @@ QString TransfersDialog::getPeerName(const std::string& id) const
void TransfersDialog::cancel()
{
QString queryWrn2;
QString queryWrn2;
queryWrn2.clear();
queryWrn2.append(tr("Are you sure that you want to cancel and delete these files?"));
if ((QMessageBox::question(this, tr("RetroShare"),queryWrn2,QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok))== QMessageBox::Ok)
{
for(int i = 0; i <= DLListModel->rowCount(); i++)
{
if(selection->isRowSelected(i, QModelIndex()))
{
std::string id = getID(i, DLListModel).toStdString();
#ifdef UNUSED
QString qname = getFileName(i, DLListModel);
/* XXX -> Should not have to 'trim' filename ... something wrong here..
* but otherwise, not exact filename .... BUG
*/
std::string name = (qname.trimmed()).toStdString();
#endif
rsFiles->FileCancel(id); /* hash */
QVector<QString> pri;
pri << "Low" << "Normal" << "High" << "Auto";
QString priority = getPriority(i, DLListModel).trimmed();
std::string id = getID(i, DLListModel).toStdString();
if (pri.indexOf(priority) >= 0)
{
/* for file that is just in dwl queue */
rsFiles->clearDownload(id);
}
else
{
#ifdef UNUSED
QString qname = getFileName(i, DLListModel);
/* XXX -> Should not have to 'trim' filename ... something wrong here..
* but otherwise, not exact filename .... BUG
*/
std::string name = (qname.trimmed()).toStdString();
#endif
rsFiles->FileCancel(id); /* hash */
}
}
}
}
else
return;
@ -1276,6 +1284,11 @@ QString TransfersDialog::getID(int row, QStandardItemModel *model)
return model->data(model->index(row, ID), Qt::DisplayRole).toString();
}
QString TransfersDialog::getPriority(int row, QStandardItemModel *model)
{
return model->data(model->index(row, PRIORITY), Qt::DisplayRole).toString();
}
qlonglong TransfersDialog::getFileSize(int row, QStandardItemModel *model)
{
bool ok = false;

View File

@ -161,6 +161,7 @@ class TransfersDialog : public MainPage
QString getFileName(int row, QStandardItemModel *model);
QString getStatus(int row, QStandardItemModel *model);
QString getID(int row, QStandardItemModel *model);
QString getPriority(int row, QStandardItemModel *model);
qlonglong getFileSize(int row, QStandardItemModel *model);
qlonglong getTransfered(int row, QStandardItemModel *model);
qlonglong getRemainingTime(int row, QStandardItemModel *model);