From 0429baf80737243b6957a370fa5d9016b660244c Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 21 May 2011 18:34:34 +0000 Subject: [PATCH] Added to sort by Age when one day, one week or one month is selected git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4215 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/RemoteDirModel.cpp | 4 ++++ retroshare-gui/src/gui/SharedFilesDialog.cpp | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index df06f3bbb..8807897dd 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -325,6 +325,8 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const return QString::fromUtf8(details.name.c_str()); case 1: return QString() ; + case 2: + return misc::userFriendlyDuration(details.min_age); default: return QString() ; } @@ -433,6 +435,8 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& index,const DirDetails& deta return QString::fromUtf8(details.name.c_str()); case 1: return QString(); + case 2: + return details.min_age; default: return QString(); } diff --git a/retroshare-gui/src/gui/SharedFilesDialog.cpp b/retroshare-gui/src/gui/SharedFilesDialog.cpp index 9cfd53116..cb9b2aca4 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/SharedFilesDialog.cpp @@ -907,10 +907,19 @@ void SharedFilesDialog::indicatorChanged(int index) model->changeAgeIndicator(correct_indicator[index]); localModel->changeAgeIndicator(correct_indicator[index]); - ui.remoteDirTreeView->update(ui.remoteDirTreeView->rootIndex()); - ui.localDirTreeView->update(ui.localDirTreeView->rootIndex()) ; + ui.remoteDirTreeView->update(ui.remoteDirTreeView->rootIndex()); + ui.localDirTreeView->update(ui.localDirTreeView->rootIndex()) ; + + if (correct_indicator[index] != IND_ALWAYS) + { + ui.remoteDirTreeView->sortByColumn(2, Qt::AscendingOrder); + } + else + { + ui.remoteDirTreeView->sortByColumn(0, Qt::AscendingOrder); + } - updateDisplay() ; + updateDisplay() ; } void SharedFilesDialog::filterRegExpChanged()