scroll to previously selected item(s) at next redisplay

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1533 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-08-13 23:22:26 +00:00
parent 04db41a45c
commit 98eb6b835d

View File

@ -588,6 +588,8 @@ void TransfersDialog::insertTransfers()
}
}
/* view will be scrolled to first selected index */
QModelIndex firstSelIdx;
/* get expanded donwload items */
std::list<std::string> expandedIds;
@ -673,6 +675,8 @@ void TransfersDialog::insertTransfers()
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash)) {
selection->select(DLListModel->index(dlCount, NAME),
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
if (!firstSelIdx.isValid())
firstSelIdx = DLListModel->index(dlCount, NAME);
}
/* expand last expanded items */
@ -705,7 +709,7 @@ void TransfersDialog::insertTransfers()
sources = QString("rShare v") + QString::fromStdString(vit->second);
}
if (info.downloadStatus == FT_STATE_COMPLETE) {
if (pit->status == FT_STATE_COMPLETE) {
status = tr("Complete");
} else {
status = tr("Unknown");
@ -781,11 +785,16 @@ void TransfersDialog::insertTransfers()
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), dit->hash)) {
selection->select(DLListModel->index(dlCount, NAME),
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
if (!firstSelIdx.isValid())
firstSelIdx = DLListModel->index(dlCount, NAME);
}
dlCount++;
}
/* scroll to first selected index if any */
if (firstSelIdx.isValid())
ui.downloadList->scrollTo(firstSelIdx);
for(it = upHashes.begin(); it != upHashes.end(); it++)
{