mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 09:03:51 -05:00
fixed copy file link in channel post files
This commit is contained in:
parent
afba23882e
commit
a782122742
2 changed files with 22 additions and 13 deletions
|
|
@ -411,7 +411,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
||||||
connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder)));
|
connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder)));
|
||||||
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
|
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
|
||||||
|
|
||||||
connect(ui->channelPostFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
|
connect(ui->channelPostFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelPostFilesContextMenu(QPoint)));
|
||||||
connect(ui->channelFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
|
connect(ui->channelFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
|
||||||
|
|
||||||
connect(ui->postsTree->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(showPostDetails()));
|
connect(ui->postsTree->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(showPostDetails()));
|
||||||
|
|
@ -1344,13 +1344,26 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
||||||
|
|
||||||
showPostDetails();
|
showPostDetails();
|
||||||
}
|
}
|
||||||
|
void GxsChannelPostsWidgetWithModel::showChannelFilesContextMenu(QPoint p)
|
||||||
void GxsChannelPostsWidgetWithModel::showChannelFilesContextMenu(QPoint /*p*/)
|
|
||||||
{
|
{
|
||||||
QMenu contextMnu(this) ;
|
QModelIndex index = ui->channelFiles_TV->indexAt(p);
|
||||||
|
|
||||||
QAction *action = contextMnu.addAction(QIcon(), tr("Copy Retroshare link"), this, SLOT(copyChannelFilesLink()));
|
if(!index.isValid())
|
||||||
action->setData(QVariant::fromValue(sender()));
|
return;
|
||||||
|
|
||||||
|
QMenu contextMnu(this) ;
|
||||||
|
contextMnu.addAction(QIcon(), tr("Copy Retroshare link"), this, SLOT(copyChannelFilesLink()))->setData(QVariant::fromValue(index));
|
||||||
|
contextMnu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
void GxsChannelPostsWidgetWithModel::showChannelPostFilesContextMenu(QPoint p)
|
||||||
|
{
|
||||||
|
QModelIndex index = ui->channelPostFiles_TV->indexAt(p);
|
||||||
|
|
||||||
|
if(!index.isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QMenu contextMnu(this) ;
|
||||||
|
contextMnu.addAction(QIcon(), tr("Copy Retroshare link"), this, SLOT(copyChannelFilesLink()))->setData(QVariant::fromValue(index));
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1358,16 +1371,11 @@ void GxsChannelPostsWidgetWithModel::copyChannelFilesLink()
|
||||||
{
|
{
|
||||||
// Block the popup if no results available
|
// Block the popup if no results available
|
||||||
QAction *action = dynamic_cast<QAction*>(sender());
|
QAction *action = dynamic_cast<QAction*>(sender());
|
||||||
RSTreeView *tree = dynamic_cast<RSTreeView*>(action->data().value<QWidget*>());
|
|
||||||
|
|
||||||
QModelIndexList sel = tree->selectionModel()->selection().indexes();
|
|
||||||
|
|
||||||
if(sel.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
QModelIndex s = action->data().toModelIndex();
|
||||||
ChannelPostFileInfo file;
|
ChannelPostFileInfo file;
|
||||||
|
|
||||||
if(!static_cast<RsGxsChannelPostFilesModel*>(tree->model())->getFileData(sel.front(),file))
|
if(!static_cast<const RsGxsChannelPostFilesModel*>(s.model())->getFileData(s,file))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(file.mName.c_str()), file.mSize, QString::fromStdString(file.mHash.toStdString()));
|
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(file.mName.c_str()), file.mSize, QString::fromStdString(file.mHash.toStdString()));
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,7 @@ public slots:
|
||||||
void sortColumnPostFiles(int col,Qt::SortOrder so);
|
void sortColumnPostFiles(int col,Qt::SortOrder so);
|
||||||
void updateCommentsCount(int n);
|
void updateCommentsCount(int n);
|
||||||
void showChannelFilesContextMenu(QPoint p);
|
void showChannelFilesContextMenu(QPoint p);
|
||||||
|
void showChannelPostFilesContextMenu(QPoint p);
|
||||||
void copyChannelFilesLink();
|
void copyChannelFilesLink();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue