diff --git a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp index b1a5e405a..71e1c2c75 100644 --- a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp +++ b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp @@ -181,16 +181,8 @@ RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName, RsColl mCollectionModel = new RsCollectionModel(*mCollection); ui._fileEntriesTW->setModel(mCollectionModel); -#ifdef TO_REMOVE - ui._fileEntriesTW->setColumnCount(COLUMN_COUNT) ; - - QTreeWidgetItem *headerItem = ui._fileEntriesTW->headerItem(); - headerItem->setText(COLUMN_FILE, tr("File")); - headerItem->setText(COLUMN_FILEPATH, tr("File Path")); - headerItem->setText(COLUMN_SIZE, tr("Size")); - headerItem->setText(COLUMN_HASH, tr("Hash")); - headerItem->setText(COLUMN_FILEC, tr("File Count")); -#endif + connect(mCollectionModel,SIGNAL(sizesChanged()),this,SLOT(updateSizes())); + updateSizes(); // forced because it's only called when the collection is changed, or when the model is created. bool wrong_chars = !updateList(); @@ -638,8 +630,8 @@ void RsCollectionDialog::directoryLoaded(QString dirLoaded) */ void RsCollectionDialog::updateSizes() { - ui._selectedFiles_TL->setText(QString::number(mCollection->count())); - ui._totalSize_TL->setText(misc::friendlyUnit(mCollection->size())); + ui._selectedFiles_TL->setText(QString::number(mCollectionModel->totalSelected())); + ui._totalSize_TL->setText(misc::friendlyUnit(mCollectionModel->totalSize())); } /** diff --git a/retroshare-gui/src/gui/common/RsCollectionModel.cpp b/retroshare-gui/src/gui/common/RsCollectionModel.cpp index 91cea236e..bdf6c7abe 100644 --- a/retroshare-gui/src/gui/common/RsCollectionModel.cpp +++ b/retroshare-gui/src/gui/common/RsCollectionModel.cpp @@ -264,16 +264,31 @@ bool RsCollectionModel::setData(const QModelIndex& index,const QVariant& value,i } else { - std::function recursSetCheckFlag = [&](RsFileTree::DirIndex i,bool s) -> void + std::function recursSetCheckFlag = [&](RsFileTree::DirIndex index,bool s) -> void { - mDirInfos[i].check_state = (s)?SELECTED:UNSELECTED; - auto& dir_data(mCollection.fileTree().directoryData(i)); + mDirInfos[index].check_state = (s)?SELECTED:UNSELECTED; + auto& dir_data(mCollection.fileTree().directoryData(index)); + + mDirInfos[index].total_size = 0; + mDirInfos[index].total_count = 0; for(uint32_t i=0;i