diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 6a61bb33a..235b0014a 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -126,6 +126,12 @@ TransfersDialog::TransfersDialog(QWidget *parent) _header->resizeSection ( PRIORITY, 100 ); _header->resizeSection ( REMAINING, 100 ); + connect(_header, SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSortIndicator(int, Qt::SortOrder))); + + // set default column and sort order + _sortCol = 0; + _sortOrder = Qt::AscendingOrder; + // Set Upload list model ULListModel = new QStandardItemModel(0,7); ULListModel->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name")); @@ -614,6 +620,9 @@ void TransfersDialog::insertTransfers() delUploadItem(i); } + ui.downloadList->sortByColumn(_sortCol, _sortOrder); + /* disable for performance issues, enable after insert all transfers */ + ui.downloadList->setSortingEnabled(false); /* get the download and upload lists */ std::list downHashes; @@ -799,6 +808,8 @@ void TransfersDialog::insertTransfers() if (firstSelIdx.isValid()) ui.downloadList->scrollTo(firstSelIdx); + ui.downloadList->setSortingEnabled(true); + for(it = upHashes.begin(); it != upHashes.end(); it++) { FileInfo info; @@ -1261,6 +1272,11 @@ void TransfersDialog::rootisnotdecorated() ui.downloadList->setRootIsDecorated(false); } +void TransfersDialog::saveSortIndicator(int logicalIndex, Qt::SortOrder order) +{ + _sortCol = logicalIndex;; + _sortOrder = order; +} double TransfersDialog::getProgress(int row, QStandardItemModel *model) { diff --git a/retroshare-gui/src/gui/TransfersDialog.h b/retroshare-gui/src/gui/TransfersDialog.h index 8573816d9..78b0152cf 100644 --- a/retroshare-gui/src/gui/TransfersDialog.h +++ b/retroshare-gui/src/gui/TransfersDialog.h @@ -87,6 +87,9 @@ class TransfersDialog : public MainPage void priorityHigh(); void priorityAuto(); + /** save sort indicator for next transfers display */ + void saveSortIndicator(int logicalIndex, Qt::SortOrder order); + signals: void playFiles(QStringList files); @@ -106,6 +109,9 @@ class TransfersDialog : public MainPage QString status, icon, name; qlonglong completed, remaining; + int _sortCol; + Qt::SortOrder _sortOrder; + /** Create the actions on the tray menu or menubar */ void createActions();