ShareKey::ShareKey(QWidget *parent, Qt::WFlags flags, std::string grpId, int grpType) : QDialog(parent, flags), mGrpId(grpId), mGrpType(grpType) { ui = new Ui::ShareKey(); ui->setupUi(this); ui->headerFrame->setHeaderImage(QPixmap(":/images/user/agt_forum64.png")); ui->headerFrame->setHeaderText(tr("Share Channel")); connect( ui->buttonBox, SIGNAL(accepted()), this, SLOT(shareKey())); connect( ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); /* initialize key share list */ ui->keyShareList->setHeaderText(tr("Contacts:")); ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK); ui->keyShareList->start(); }
GroupShareKey::GroupShareKey(QWidget *parent, const RsGxsGroupId &grpId, int grpType) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mGrpId(grpId), mGrpType(grpType) { ui = new Ui::ShareKey(); ui->setupUi(this); ui->headerFrame->setHeaderImage(QPixmap(":/images/user/agt_forum64.png")); ui->headerFrame->setHeaderText(tr("Share")); connect( ui->buttonBox, SIGNAL(accepted()), this, SLOT(shareKey())); connect( ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); /* initialize key share list */ ui->keyShareList->setHeaderText(tr("Contacts:")); ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK); ui->keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL); ui->keyShareList->start(); setTyp(); }
void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ ) { if (mChannelId.empty()) { return; } uint32_t subscribeFlags = ui.treeWidget->subscribeFlags(QString::fromStdString(mChannelId)); QMenu contextMnu(this); bool isAdmin = IS_GROUP_ADMIN(subscribeFlags); bool isPublisher = IS_GROUP_PUBLISHER(subscribeFlags); bool isSubscribed = IS_GROUP_SUBSCRIBED(subscribeFlags); bool autoDownload = rsGxsChannels->getChannelAutoDownload(mChannelId); if (isPublisher) { QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), &contextMnu); connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) ); contextMnu.addAction( postchannelAct ); contextMnu.addSeparator(); } if (isSubscribed) { QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu); connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) ); contextMnu.addAction( setallasreadchannelAct ); contextMnu.addSeparator(); QAction *autoAct = new QAction(QIcon(":/images/redled.png"), tr( "Disable Auto-Download" ), &contextMnu); QAction *noautoAct = new QAction(QIcon(":/images/start.png"),tr( "Enable Auto-Download" ), &contextMnu); connect( autoAct , SIGNAL( triggered() ), this, SLOT( toggleAutoDownload() ) ); connect( noautoAct , SIGNAL( triggered() ), this, SLOT( toggleAutoDownload() ) ); contextMnu.addAction( autoAct ); contextMnu.addAction( noautoAct ); autoAct->setEnabled(autoDownload); noautoAct->setEnabled(!autoDownload); QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu); connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) ); contextMnu.addAction( unsubscribechannelAct ); } else { QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), &contextMnu); connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) ); contextMnu.addAction( subscribechannelAct ); } if (isAdmin) { QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu); connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) ); contextMnu.addAction( editChannelDetailAct); } else { QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu); connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) ); contextMnu.addAction( channeldetailsAct ); } if (isPublisher) { QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), &contextMnu); connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) ); contextMnu.addAction( restoreKeysAct ); } else { QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Channel"), &contextMnu); connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) ); contextMnu.addAction( shareKeyAct ); } contextMnu.addSeparator(); QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink())); action->setEnabled(!mChannelId.empty()); contextMnu.exec(QCursor::pos()); #if 0 ChannelInfo ci; if (!rsChannels->getChannelInfo(mChannelId, ci)) { return; } QMenu contextMnu(this); QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), &contextMnu); connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) ); QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), &contextMnu); connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) ); QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu); connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) ); QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu); connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) ); bool autoDl = false; rsChannels->channelGetAutoDl(mChannelId, autoDl); QAction *autochannelAct = autoDl? (new QAction(QIcon(":/images/redled.png"), tr( "Disable Auto-Download" ), &contextMnu)) : (new QAction(QIcon(":/images/start.png"),tr( "Enable Auto-Download" ), &contextMnu)) ; connect( autochannelAct , SIGNAL( triggered() ), this, SLOT( toggleAutoDownload() ) ); QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu); connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) ); QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), &contextMnu); connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) ); QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu); connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) ); 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_ADMIN) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)) contextMnu.addAction( editChannelDetailAct); else contextMnu.addAction( channeldetailsAct ); 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(); QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink())); action->setEnabled(!mChannelId.empty()); contextMnu.exec(QCursor::pos()); #endif }
void GxsForumsDialog::forumListCustomPopupMenu(QPoint /*point*/) { int subscribeFlags = ui.forumTreeWidget->subscribeFlags(QString::fromStdString(mForumId)); QMenu contextMnu(this); #ifdef DEBUG_FORUMS std::cerr << "GxsForumsDialog::forumListCustomPopupMenu()"; std::cerr << std::endl; std::cerr << " mForumId: " << mForumId; std::cerr << std::endl; std::cerr << " subscribeFlags: " << subscribeFlags; std::cerr << std::endl; std::cerr << " IS_GROUP_SUBSCRIBED(): " << IS_GROUP_SUBSCRIBED(subscribeFlags); std::cerr << std::endl; std::cerr << " IS_GROUP_ADMIN(): " << IS_GROUP_ADMIN(subscribeFlags); std::cerr << std::endl; std::cerr << std::endl; #endif QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum())); action->setDisabled (mForumId.empty() || IS_GROUP_SUBSCRIBED(subscribeFlags)); action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum())); action->setEnabled (!mForumId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags)); if (!Settings->getForumOpenAllInNewTab()) { action = contextMnu.addAction(QIcon(""), tr("Open in new tab"), this, SLOT(openInNewTab())); if (mForumId.empty() || forumThreadWidget(mForumId)) { action->setEnabled(false); } } contextMnu.addSeparator(); contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum())); action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails())); action->setEnabled (!mForumId.empty ()); action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails())); action->setEnabled (!mForumId.empty () && IS_GROUP_ADMIN(subscribeFlags)); QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu); connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) ); shareKeyAct->setEnabled(!mForumId.empty() && IS_GROUP_ADMIN(subscribeFlags)); contextMnu.addAction( shareKeyAct); QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu); connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) ); restoreKeysAct->setEnabled(!mForumId.empty() && !IS_GROUP_ADMIN(subscribeFlags)); contextMnu.addAction( restoreKeysAct); action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink())); action->setEnabled(!mForumId.empty()); contextMnu.addSeparator(); action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsRead())); action->setEnabled (!mForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags)); action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnread())); action->setEnabled (!mForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags)); contextMnu.exec(QCursor::pos()); }
void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) { ChannelInfo ci; if (!rsChannels->getChannelInfo(mChannelId, ci)) { return; } QMenu contextMnu(this); QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), &contextMnu); connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) ); QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), &contextMnu); connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) ); QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu); connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) ); QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu); connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) ); bool autoDl = false; rsChannels->channelGetAutoDl(mChannelId, autoDl); QAction *autochannelAct = autoDl? (new QAction(QIcon(":/images/redled.png"), tr( "Disable Auto-Download" ), &contextMnu)) : (new QAction(QIcon(":/images/start.png"),tr( "Enable Auto-Download" ), &contextMnu)) ; connect( autochannelAct , SIGNAL( triggered() ), this, SLOT( toggleAutoDownload() ) ); QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu); connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) ); QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), &contextMnu); connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) ); QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu); connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) ); 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_ADMIN) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)) contextMnu.addAction( editChannelDetailAct); else contextMnu.addAction( channeldetailsAct ); 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(); QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink())); action->setEnabled(!mChannelId.empty()); #ifdef CHAN_DEBUG contextMnu.addSeparator(); action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData())); action->setEnabled (!mChannelId.empty() && (ci.channelFlags & RS_DISTRIB_PUBLISH)); #endif contextMnu.exec(QCursor::pos()); }