From 887f9bc4465028c3c54817d2d13f214ba292f6de Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 28 Feb 2010 21:59:39 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/ChannelFeed.cpp | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 7bc11a78d..ef1dc96ff 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -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() );