mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-17 11:54:28 -05:00
Added Context menus for Edit Circle or Add/Remove Member
Changed for OK Button renaming to Create (New Mode) or Update(Edit Mode)
This commit is contained in:
parent
cecaf31f7d
commit
4116f4b5cc
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
|
||||
#include <algorithm>
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
@ -64,6 +65,9 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
|
||||
connect(ui.treeWidget_IdList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
|
||||
connect(ui.treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(MembershipListCustomPopupMenu(QPoint)));
|
||||
|
||||
connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
|
||||
//connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||
@ -120,6 +124,7 @@ void CreateCircleDialog::editNewId(bool isExternal)
|
||||
{
|
||||
setupForExternalCircle();
|
||||
ui.headerFrame->setHeaderText(tr("Create New Circle"));
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -152,6 +157,7 @@ void CreateCircleDialog::setupForExternalCircle()
|
||||
|
||||
/* show distribution line */
|
||||
ui.groupBox_title->setTitle(tr("Circle Details"));
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Update"));
|
||||
ui.frame_PgpTypes->show();
|
||||
ui.frame_Distribution->show();
|
||||
ui.idChooserLabel->show();
|
||||
@ -697,10 +703,39 @@ void CreateCircleDialog::filterIds()
|
||||
ui.treeWidget_IdList->filterItems(filterColumn, text);
|
||||
}
|
||||
|
||||
void CreateCircleDialog::createNewGxsId()
|
||||
void CreateCircleDialog::createNewGxsId()
|
||||
{
|
||||
IdEditDialog dlg(this);
|
||||
dlg.setupNewId(false);
|
||||
dlg.exec();
|
||||
//ui.idChooser->setDefaultId(dlg.getLastIdName());
|
||||
}
|
||||
|
||||
void CreateCircleDialog::IdListCustomPopupMenu( QPoint )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem();
|
||||
if (item) {
|
||||
|
||||
contextMnu.addAction(QIcon(":/images/edit_add24.png"), tr("Add Member"), this, SLOT(addMember()));
|
||||
|
||||
}
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void CreateCircleDialog::MembershipListCustomPopupMenu( QPoint )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QTreeWidgetItem *item = ui.treeWidget_membership->currentItem();
|
||||
if (item) {
|
||||
|
||||
contextMnu.addAction(QIcon(":/images/delete.png"), tr("Remove Member"), this, SLOT(removeMember()));
|
||||
|
||||
}
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,10 @@ private slots:
|
||||
void createCircle();
|
||||
void filterChanged(const QString &text);
|
||||
void createNewGxsId();
|
||||
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void IdListCustomPopupMenu( QPoint point );
|
||||
void MembershipListCustomPopupMenu( QPoint point);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -49,6 +49,9 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_membership">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -186,6 +189,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="RSTreeWidget" name="treeWidget_IdList">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -248,6 +248,8 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||
connect(ui->pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
|
||||
connect(ui->pushButton_editCircle, SIGNAL(clicked()), this, SLOT(editExistingCircle()));
|
||||
connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
||||
connect(ui->treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CircleListCustomPopupMenu(QPoint)));
|
||||
|
||||
|
||||
/* Setup TokenQueue */
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
@ -370,6 +372,20 @@ void IdDialog::editExistingCircle()
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void IdDialog::CircleListCustomPopupMenu( QPoint )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QTreeWidgetItem *item = ui->treeWidget_membership->currentItem();
|
||||
if (item) {
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Circle"), this, SLOT(editExistingCircle()));
|
||||
|
||||
}
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
static void set_item_background(QTreeWidgetItem *item, uint32_t type)
|
||||
{
|
||||
QBrush brush;
|
||||
|
@ -78,6 +78,7 @@ private slots:
|
||||
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void IdListCustomPopupMenu( QPoint point );
|
||||
void CircleListCustomPopupMenu( QPoint point);
|
||||
|
||||
void circle_selected();
|
||||
private:
|
||||
|
@ -249,6 +249,9 @@
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="treeWidget_membership">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user