added context menu actions for Channels subscribe, unsubscribe and Post to Channel

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2464 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-28 21:59:39 +00:00
parent 323b96cc04
commit 887f9bc446

View File

@ -129,11 +129,44 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint point )
QMenu contextMnu( this );
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), this );
connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) );
QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), this );
connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) );
QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), this );
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), this );
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
contextMnu.clear();
contextMnu.addAction( channeldetailsAct );
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci))
{
return;
}
if (ci.channelFlags & RS_DISTRIB_PUBLISH)
{
contextMnu.addAction( postchannelAct );
contextMnu.addSeparator();
contextMnu.addAction( channeldetailsAct );
}
else if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
{
contextMnu.addAction( unsubscribechannelAct );
contextMnu.addSeparator();
contextMnu.addAction( channeldetailsAct );;
}
else
{
contextMnu.addAction( subscribechannelAct );
contextMnu.addSeparator();
contextMnu.addAction( channeldetailsAct );
}
contextMnu.exec( mevent->globalPos() );