Merge pull request #1192 from PhenomRetroShare/Add_WarningMaxFlatViewFile

Add a warning in ToolTip if Max files reach in flat view mode Dir Tree.
This commit is contained in:
csoler 2018-03-03 16:06:49 +01:00 committed by GitHub
commit b587ac8835
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 3 deletions

View file

@ -163,6 +163,7 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
tree_model = _tree_model ;
flat_model = _flat_model ;
connect(flat_model, SIGNAL(layoutChanged()), this, SLOT(updateDirTreeView()) );
tree_proxyModel = new SFDSortFilterProxyModel(tree_model, this);
tree_proxyModel->setSourceModel(tree_model);
@ -1325,6 +1326,21 @@ void SharedFilesDialog::startFilter()
FilterItems();
}
void SharedFilesDialog::updateDirTreeView()
{
if (model == flat_model)
{
size_t maxSize = 0;
FlatStyle_RDM* flat = dynamic_cast<FlatStyle_RDM*>(flat_model);
if (flat && flat->isMaxRefsTableSize(&maxSize))
{
ui.dirTreeView->setToolTip(tr("Warning: You reach max (%1) files in flat list. No more will be added.").arg(maxSize));
return;
}
}
ui.dirTreeView->setToolTip("");
}
// This macro make the search expand all items that contain the searched text.
// A bug however, makes RS expand everything when nothing is selected, which is a pain.