added interactive update of dir entries when browsing files from an online friend

This commit is contained in:
mr-alice 2016-09-11 17:52:12 +02:00
parent 3718e7e3e8
commit c1e538ff13
9 changed files with 136 additions and 57 deletions

View file

@ -80,6 +80,11 @@ void RetroshareDirModel::treeStyle()
peerIcon = QIcon(":/images/user/identity16.png");
}
void TreeStyle_RDM::updateRef(const QModelIndex& indx) const
{
rsFiles->requestDirUpdate(indx.internalPointer()) ;
}
bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
{

View file

@ -78,6 +78,8 @@ class RetroshareDirModel : public QAbstractItemModel
bool requestDirDetails(void *ref, bool remote,DirDetails& d) const;
virtual void update() {}
virtual void updateRef(const QModelIndex&) const =0;
public:
virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
virtual QStringList mimeTypes () const;
@ -167,7 +169,9 @@ class TreeStyle_RDM: public RetroshareDirModel
virtual ~TreeStyle_RDM() ;
protected:
/* These are all overloaded Virtual Functions */
virtual void updateRef(const QModelIndex&) const ;
/* These are all overloaded Virtual Functions */
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -203,7 +207,8 @@ class FlatStyle_RDM: public RetroshareDirModel
void updateRefs() ;
protected:
virtual void postMods();
virtual void updateRef(const QModelIndex&) const {}
virtual void postMods();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;

View file

@ -228,6 +228,7 @@ RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
ui.checkButton->hide() ;
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadRemoteSelected()));
connect(ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), this, SLOT( expanded(const QModelIndex & ) ) );
// load settings
processSettings(true);
@ -366,7 +367,6 @@ void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
}
// connect( ui.dirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), this, SLOT( collapsed(const QModelIndex & ) ) );
// connect( ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), this, SLOT( expanded(const QModelIndex & ) ) );
ui.dirTreeView->setModel(proxyModel);
ui.dirTreeView->update();
@ -517,6 +517,13 @@ QModelIndexList SharedFilesDialog::getSelected()
return proxyList ;
}
void RemoteSharedFilesDialog::expanded(const QModelIndex& indx)
{
std::cerr << "Expanding at " << indx.row() << " and " << indx.column() << " ref=" << indx.internalPointer() << ", pointer at 1: " << proxyModel->mapToSource(indx).internalPointer() << std::endl;
model->updateRef(proxyModel->mapToSource(indx)) ;
}
void RemoteSharedFilesDialog::downloadRemoteSelected()
{
/* call back to the model (which does all the interfacing? */

View file

@ -196,6 +196,7 @@ class RemoteSharedFilesDialog : public SharedFilesDialog
private slots:
void downloadRemoteSelected();
void expanded(const QModelIndex& indx);
};
#endif