mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 06:02:41 -04:00
Channels: added demo context menu to channel browser
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@285 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d807a5324f
commit
826860bb2e
6 changed files with 94 additions and 5 deletions
|
@ -20,10 +20,65 @@
|
|||
****************************************************************/
|
||||
|
||||
#include "channelBrowserDialog.h"
|
||||
|
||||
ChannelBrowserDialog::ChannelBrowserDialog(QWidget * parent) : QDialog (parent)
|
||||
const QString ChannelBrowserDialog::IMAGE_QUICKSUBSCRIBE = ":/images/channelsubscribe.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_QUICKUNSUBSCRIBE = ":/images/channeldelete.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_MANAGE_SUB = ":/images/channels.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_MANAGE_CHANNEL = ":/images/channels.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_QUICKDELETE = ":/images/channeldelete.png";
|
||||
|
||||
ChannelBrowserDialog::ChannelBrowserDialog(QWidget * parent)
|
||||
: QDialog (parent), browserContextMenu(0)
|
||||
{
|
||||
setupUi(this);
|
||||
channelTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect( channelTreeWidget, SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(channelTreeWidgetCustumPopupMenu(QPoint)));
|
||||
|
||||
}
|
||||
|
||||
void ChannelBrowserDialog::channelTreeWidgetCustumPopupMenu( QPoint point )
|
||||
{
|
||||
// block the popup if no results available
|
||||
if ((channelTreeWidget->selectedItems()).size() == 0) return;
|
||||
|
||||
// create the menu as required
|
||||
if (browserContextMenu == 0)
|
||||
{
|
||||
// setup the browser context menu
|
||||
browserContextMenu = new QMenu(this);
|
||||
|
||||
// determine the selected channel and adjust the context menu accordingly i.e. no
|
||||
// quick subscribe entry if the channel is already subscribed to etc
|
||||
quickSubscribeAct = new QAction(QIcon(IMAGE_QUICKSUBSCRIBE), tr( "Subscribe" ), this );
|
||||
connect( quickSubscribeAct, SIGNAL( triggered() ), this, SLOT( quickSubscribe() ) );
|
||||
quickUnsubscribeAct = new QAction(QIcon(IMAGE_QUICKUNSUBSCRIBE), tr( "Remove Subscription" ), this );
|
||||
connect( quickUnsubscribeAct, SIGNAL( triggered() ), this, SLOT( quickSubscribe() ) );
|
||||
subscribeToChannelAct = new QAction(QIcon(IMAGE_MANAGE_SUB), tr( "Manage Subscription" ), this );
|
||||
connect( subscribeToChannelAct, SIGNAL( triggered() ), this, SLOT( subscribeToChannel() ) );
|
||||
editChannelAct = new QAction(QIcon(IMAGE_MANAGE_CHANNEL), tr( "Manage Channel" ), this );
|
||||
connect( editChannelAct, SIGNAL( triggered() ), this, SLOT( manageChannel() ) );
|
||||
quickDeleteAct = new QAction(QIcon(IMAGE_QUICKDELETE), tr( "Quick Delete" ), this );
|
||||
connect( quickDeleteAct, SIGNAL( triggered() ), this, SLOT( quickDelete() ) );
|
||||
|
||||
|
||||
|
||||
browserContextMenu->clear();
|
||||
browserContextMenu->addAction( new QAction("NOTE: Entries will be dynamic!!", this));
|
||||
browserContextMenu->addSeparator();
|
||||
browserContextMenu->addAction( quickSubscribeAct);
|
||||
browserContextMenu->addAction( quickUnsubscribeAct);
|
||||
browserContextMenu->addAction( subscribeToChannelAct);
|
||||
browserContextMenu->addSeparator();
|
||||
browserContextMenu->addAction( quickDeleteAct);
|
||||
browserContextMenu->addAction( editChannelAct);
|
||||
}
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point,
|
||||
Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
browserContextMenu->exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
void ChannelBrowserDialog::quickSubscribe(){}
|
||||
void ChannelBrowserDialog::quickUnsubscribe(){}
|
||||
void ChannelBrowserDialog::subscribeToChannel(){}
|
||||
void ChannelBrowserDialog::manageChannel(){}
|
||||
void ChannelBrowserDialog::quickDelete(){}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue