From 29b5983e712a7c5f106aff830be0ec12fcc4994e Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 12 Sep 2012 12:54:40 +0000 Subject: [PATCH] reworked context channel menu to allow unsubscribing from own channels. Removed some irrelevant items. Added warning when publish rights can/cannot be restored. It would be nice to only show the restore publish right entry when the Grp is available. Might be too costly though. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5538 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ChannelFeed.cpp | 50 ++++++++++++-------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 5cabc8dc1..e0588197d 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -180,36 +180,27 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Channel"), &contextMnu); connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) ); - if ((ci.channelFlags & RS_DISTRIB_PUBLISH) && (ci.channelFlags & RS_DISTRIB_ADMIN)) { - contextMnu.addAction( postchannelAct ); - contextMnu.addSeparator(); + if((ci.channelFlags & RS_DISTRIB_ADMIN) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)) contextMnu.addAction( editChannelDetailAct); - contextMnu.addAction( shareKeyAct ); + else contextMnu.addAction( channeldetailsAct ); - } - else if ((ci.channelFlags & RS_DISTRIB_PUBLISH) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)) { - contextMnu.addAction( postchannelAct ); - contextMnu.addSeparator(); - contextMnu.addAction( channeldetailsAct ); - contextMnu.addAction( shareKeyAct ); - contextMnu.addAction( restoreKeysAct ); - contextMnu.addSeparator(); - contextMnu.addAction( autochannelAct ); - contextMnu.addAction( setallasreadchannelAct ); - } else if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) { - contextMnu.addAction( unsubscribechannelAct ); - contextMnu.addSeparator(); - contextMnu.addAction( channeldetailsAct ); - contextMnu.addAction( restoreKeysAct ); - contextMnu.addSeparator(); - contextMnu.addAction( autochannelAct ); - contextMnu.addAction( setallasreadchannelAct ); - } else { + + if((ci.channelFlags & RS_DISTRIB_PUBLISH) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)) + { + contextMnu.addAction( postchannelAct ); + contextMnu.addAction( shareKeyAct ); + } + + if(ci.channelFlags & RS_DISTRIB_SUBSCRIBED) + { + contextMnu.addAction( unsubscribechannelAct ); + contextMnu.addAction( restoreKeysAct ); + contextMnu.addSeparator(); + contextMnu.addAction( autochannelAct ); + contextMnu.addAction( setallasreadchannelAct ); + } + else contextMnu.addAction( subscribechannelAct ); - contextMnu.addSeparator(); - contextMnu.addAction( channeldetailsAct ); - contextMnu.addAction( restoreKeysAct ); - } contextMnu.addSeparator(); QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink())); @@ -285,7 +276,10 @@ void ChannelFeed::createMsg() void ChannelFeed::restoreChannelKeys() { - rsChannels->channelRestoreKeys(mChannelId); + if(rsChannels->channelRestoreKeys(mChannelId)) + QMessageBox::information(NULL,tr("Publish rights restored."),tr("Publish rights have been restored for this channel.")) ; + else + QMessageBox::warning(NULL,tr("Publish not restored."),tr("Publish rights can't be restored for this channel.
You're not the creator of this channel.")) ; } void ChannelFeed::selectChannel(const QString &id)