mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
FriendSelectionWidget:
- Added sort by state - Moved buttons "All"/"None" into context menu MessageComposer: - Removed double details action
This commit is contained in:
parent
4923c47eb3
commit
176c3abd8c
@ -21,6 +21,7 @@
|
|||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QMenu>
|
||||||
#include "FriendSelectionWidget.h"
|
#include "FriendSelectionWidget.h"
|
||||||
#include "ui_FriendSelectionWidget.h"
|
#include "ui_FriendSelectionWidget.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
@ -44,8 +45,11 @@
|
|||||||
|
|
||||||
#define IDDIALOG_IDLIST 1
|
#define IDDIALOG_IDLIST 1
|
||||||
|
|
||||||
#define ROLE_ID Qt::UserRole
|
#define ROLE_ID Qt::UserRole
|
||||||
#define ROLE_SORT Qt::UserRole + 1
|
#define ROLE_SORT_GROUP Qt::UserRole + 1
|
||||||
|
#define ROLE_SORT_STANDARD_GROUP Qt::UserRole + 2
|
||||||
|
#define ROLE_SORT_NAME Qt::UserRole + 3
|
||||||
|
#define ROLE_SORT_STATE Qt::UserRole + 4
|
||||||
|
|
||||||
#define IMAGE_GROUP16 ":/images/user/group16.png"
|
#define IMAGE_GROUP16 ":/images/user/group16.png"
|
||||||
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
|
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
|
||||||
@ -94,15 +98,17 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
|||||||
connect(ui->friendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
|
connect(ui->friendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
|
||||||
connect(ui->friendList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
connect(ui->friendList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
||||||
connect(ui->friendList, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*,int)));
|
connect(ui->friendList, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*,int)));
|
||||||
connect(ui->selectAll_PB, SIGNAL(clicked()), this, SLOT(selectAll()));
|
connect(ui->friendList, SIGNAL(itemSelectionChanged()), this, SIGNAL(itemSelectionChanged()));
|
||||||
connect(ui->deselectAll_PB, SIGNAL(clicked()), this, SLOT(deselectAll()));
|
|
||||||
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged(int)));
|
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged(int)));
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
||||||
|
|
||||||
mCompareRole = new RSTreeWidgetItemCompareRole;
|
mCompareRole = new RSTreeWidgetItemCompareRole;
|
||||||
mCompareRole->setRole(COLUMN_NAME, ROLE_SORT);
|
mActionSortByState = new QAction(tr("Sort by state"), this);
|
||||||
|
mActionSortByState->setCheckable(true);
|
||||||
|
connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(setSortByState(bool)));
|
||||||
|
ui->friendList->addHeaderContextMenuAction(mActionSortByState);
|
||||||
|
|
||||||
/* initialize list */
|
/* initialize list */
|
||||||
ui->friendList->setColumnCount(COLUMN_COUNT);
|
ui->friendList->setColumnCount(COLUMN_COUNT);
|
||||||
@ -110,6 +116,7 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
|||||||
|
|
||||||
/* sort list by name ascending */
|
/* sort list by name ascending */
|
||||||
ui->friendList->sortItems(COLUMN_NAME, Qt::AscendingOrder);
|
ui->friendList->sortItems(COLUMN_NAME, Qt::AscendingOrder);
|
||||||
|
setSortByState(false);
|
||||||
|
|
||||||
ui->filterLineEdit->setPlaceholderText(tr("Search Friends"));
|
ui->filterLineEdit->setPlaceholderText(tr("Search Friends"));
|
||||||
ui->filterLineEdit->showFilterIcon();
|
ui->filterLineEdit->showFilterIcon();
|
||||||
@ -156,17 +163,6 @@ void FriendSelectionWidget::setModus(Modus modus)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(modus == MODUS_CHECK)
|
|
||||||
{
|
|
||||||
ui->selectAll_PB->setHidden(false) ;
|
|
||||||
ui->deselectAll_PB->setHidden(false) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->selectAll_PB->setHidden(true) ;
|
|
||||||
ui->deselectAll_PB->setHidden(true) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,8 +212,12 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
||||||
item->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id.toStdString()));
|
item->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id.toStdString()));
|
||||||
item->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
|
||||||
|
item->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||||
|
item->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||||
|
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (state != (int) RS_STATUS_OFFLINE) ? 0 : 1);
|
||||||
|
item->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::fillList()
|
void FriendSelectionWidget::fillList()
|
||||||
@ -349,7 +349,11 @@ void FriendSelectionWidget::secured_fillList()
|
|||||||
|
|
||||||
QString groupName = GroupDefs::name(*groupInfo);
|
QString groupName = GroupDefs::name(*groupInfo);
|
||||||
groupItem->setText(COLUMN_NAME, groupName);
|
groupItem->setText(COLUMN_NAME, groupName);
|
||||||
groupItem->setData(COLUMN_DATA, ROLE_SORT, ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? "0 " : "1 ") + groupName);
|
|
||||||
|
groupItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 0);
|
||||||
|
groupItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, (groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? 0 : 1);
|
||||||
|
groupItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 0);
|
||||||
|
groupItem->setData(COLUMN_NAME, ROLE_SORT_NAME, groupName);
|
||||||
|
|
||||||
if (mListModus == MODUS_CHECK) {
|
if (mListModus == MODUS_CHECK) {
|
||||||
groupItem->setCheckState(0, Qt::Unchecked);
|
groupItem->setCheckState(0, Qt::Unchecked);
|
||||||
@ -411,8 +415,12 @@ void FriendSelectionWidget::secured_fillList()
|
|||||||
|
|
||||||
gpgItem->setFlags(Qt::ItemIsUserCheckable | gpgItem->flags());
|
gpgItem->setFlags(Qt::ItemIsUserCheckable | gpgItem->flags());
|
||||||
gpgItem->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
gpgItem->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
||||||
gpgItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.gpg_id.toStdString()));
|
gpgItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.gpg_id.toStdString()));
|
||||||
gpgItem->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
|
||||||
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||||
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||||
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STATE, (state != (int) RS_STATUS_OFFLINE) ? 0 : 1);
|
||||||
|
gpgItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||||
|
|
||||||
if (mListModus == MODUS_CHECK) {
|
if (mListModus == MODUS_CHECK) {
|
||||||
gpgItem->setCheckState(0, Qt::Unchecked);
|
gpgItem->setCheckState(0, Qt::Unchecked);
|
||||||
@ -542,7 +550,12 @@ void FriendSelectionWidget::secured_fillList()
|
|||||||
gxsItem->setFlags(Qt::ItemIsUserCheckable | gxsItem->flags());
|
gxsItem->setFlags(Qt::ItemIsUserCheckable | gxsItem->flags());
|
||||||
gxsItem->setIcon(COLUMN_NAME, identicon);
|
gxsItem->setIcon(COLUMN_NAME, identicon);
|
||||||
gxsItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.mId.toStdString()));
|
gxsItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.mId.toStdString()));
|
||||||
gxsItem->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||||
|
//TODO: online state for gxs items
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 1);
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||||
|
|
||||||
if (mListModus == MODUS_CHECK)
|
if (mListModus == MODUS_CHECK)
|
||||||
gxsItem->setCheckState(0, Qt::Unchecked);
|
gxsItem->setCheckState(0, Qt::Unchecked);
|
||||||
@ -573,6 +586,8 @@ void FriendSelectionWidget::secured_fillList()
|
|||||||
|
|
||||||
mInFillList = false;
|
mInFillList = false;
|
||||||
|
|
||||||
|
ui->friendList->resort();
|
||||||
|
|
||||||
emit contentChanged();
|
emit contentChanged();
|
||||||
}
|
}
|
||||||
void FriendSelectionWidget::updateDisplay(bool)
|
void FriendSelectionWidget::updateDisplay(bool)
|
||||||
@ -658,6 +673,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||||||
switch (idTypeFromItem(item)) {
|
switch (idTypeFromItem(item)) {
|
||||||
case IDTYPE_NONE:
|
case IDTYPE_NONE:
|
||||||
case IDTYPE_GROUP:
|
case IDTYPE_GROUP:
|
||||||
|
case IDTYPE_GXS:
|
||||||
break;
|
break;
|
||||||
case IDTYPE_GPG:
|
case IDTYPE_GPG:
|
||||||
{
|
{
|
||||||
@ -672,6 +688,8 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||||||
item->setTextColor(COLUMN_NAME, color);
|
item->setTextColor(COLUMN_NAME, color);
|
||||||
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(gpgStatus)));
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(gpgStatus)));
|
||||||
|
|
||||||
|
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (gpgStatus != (int) RS_STATUS_OFFLINE) ? 0 : 1);
|
||||||
|
|
||||||
bFoundGPG = true;
|
bFoundGPG = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -689,6 +707,8 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||||||
item->setTextColor(COLUMN_NAME, color);
|
item->setTextColor(COLUMN_NAME, color);
|
||||||
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(status)));
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(status)));
|
||||||
|
|
||||||
|
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (status != (int) RS_STATUS_OFFLINE) ? 0 : 1);
|
||||||
|
|
||||||
bFoundSSL = true;
|
bFoundSSL = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -714,11 +734,48 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->friendList->resort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::contextMenuRequested(const QPoint &pos)
|
void FriendSelectionWidget::addContextMenuAction(QAction *action)
|
||||||
{
|
{
|
||||||
emit customContextMenuRequested(pos);
|
mContextMenuActions.push_back(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::contextMenuRequested(const QPoint &/*pos*/)
|
||||||
|
{
|
||||||
|
QMenu contextMenu(this);
|
||||||
|
|
||||||
|
if (mListModus == MODUS_CHECK) {
|
||||||
|
contextMenu.addAction(QIcon(), tr("Mark all"), this, SLOT(selectAll()));
|
||||||
|
contextMenu.addAction(QIcon(), tr("Mark none"), this, SLOT(deselectAll()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mContextMenuActions.isEmpty()) {
|
||||||
|
bool addSeparator = false;
|
||||||
|
if (!contextMenu.isEmpty()) {
|
||||||
|
// Check for visible action
|
||||||
|
foreach (QAction *action, mContextMenuActions) {
|
||||||
|
if (action->isVisible()) {
|
||||||
|
addSeparator = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addSeparator) {
|
||||||
|
contextMenu.addSeparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMenu.addActions(mContextMenuActions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contextMenu.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMenu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
void FriendSelectionWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||||
@ -1030,3 +1087,28 @@ std::string FriendSelectionWidget::idFromItem(QTreeWidgetItem *item)
|
|||||||
return item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
return item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::setSortByState(bool sort)
|
||||||
|
{
|
||||||
|
// Add changes also in FriendSelectionWidget::sortByState
|
||||||
|
mCompareRole->setRole(COLUMN_NAME, ROLE_SORT_GROUP);
|
||||||
|
mCompareRole->addRole(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP);
|
||||||
|
|
||||||
|
if (sort) {
|
||||||
|
mCompareRole->addRole(COLUMN_NAME, ROLE_SORT_STATE);
|
||||||
|
mCompareRole->addRole(COLUMN_NAME, ROLE_SORT_NAME);
|
||||||
|
|
||||||
|
mActionSortByState->setChecked(true);
|
||||||
|
} else {
|
||||||
|
mCompareRole->addRole(COLUMN_NAME, ROLE_SORT_NAME);
|
||||||
|
mCompareRole->addRole(COLUMN_NAME, ROLE_SORT_STATE);
|
||||||
|
|
||||||
|
mActionSortByState->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->friendList->resort();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FriendSelectionWidget::sortByState()
|
||||||
|
{
|
||||||
|
return mActionSortByState->isChecked();
|
||||||
|
}
|
||||||
|
@ -80,6 +80,8 @@ public:
|
|||||||
int addColumn(const QString &title);
|
int addColumn(const QString &title);
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
|
bool sortByState();
|
||||||
|
|
||||||
int selectedItemCount();
|
int selectedItemCount();
|
||||||
std::string selectedId(IdType &idType);
|
std::string selectedId(IdType &idType);
|
||||||
|
|
||||||
@ -109,6 +111,9 @@ public:
|
|||||||
|
|
||||||
void setTextColorOnline(QColor color) { mTextColorOnline = color; }
|
void setTextColorOnline(QColor color) { mTextColorOnline = color; }
|
||||||
|
|
||||||
|
// Add QAction to context menu (action won't be deleted)
|
||||||
|
void addContextMenuAction(QAction *action);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *e);
|
void changeEvent(QEvent *e);
|
||||||
|
|
||||||
@ -118,9 +123,12 @@ protected:
|
|||||||
signals:
|
signals:
|
||||||
void itemAdded(int idType, const QString &id, QTreeWidgetItem *item);
|
void itemAdded(int idType, const QString &id, QTreeWidgetItem *item);
|
||||||
void contentChanged();
|
void contentChanged();
|
||||||
void customContextMenuRequested(const QPoint &pos);
|
|
||||||
void doubleClicked(int idType, const QString &id);
|
void doubleClicked(int idType, const QString &id);
|
||||||
void itemChanged(int idType, const QString &id, QTreeWidgetItem *item, int column);
|
void itemChanged(int idType, const QString &id, QTreeWidgetItem *item, int column);
|
||||||
|
void itemSelectionChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setSortByState(bool sort);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void groupsChanged(int type);
|
void groupsChanged(int type);
|
||||||
@ -142,6 +150,7 @@ private:
|
|||||||
|
|
||||||
void requestGXSIdList() ;
|
void requestGXSIdList() ;
|
||||||
|
|
||||||
|
private:
|
||||||
bool mStarted;
|
bool mStarted;
|
||||||
RSTreeWidgetItemCompareRole *mCompareRole;
|
RSTreeWidgetItemCompareRole *mCompareRole;
|
||||||
Modus mListModus;
|
Modus mListModus;
|
||||||
@ -150,6 +159,7 @@ private:
|
|||||||
bool mInGpgItemChanged;
|
bool mInGpgItemChanged;
|
||||||
bool mInSslItemChanged;
|
bool mInSslItemChanged;
|
||||||
bool mInFillList;
|
bool mInFillList;
|
||||||
|
QAction *mActionSortByState;
|
||||||
|
|
||||||
/* Color definitions (for standard see qss.default) */
|
/* Color definitions (for standard see qss.default) */
|
||||||
QColor mTextColorOnline;
|
QColor mTextColorOnline;
|
||||||
@ -160,6 +170,7 @@ private:
|
|||||||
|
|
||||||
std::vector<RsGxsGroupId> gxsIds ;
|
std::vector<RsGxsGroupId> gxsIds ;
|
||||||
TokenQueue *mIdQueue ;
|
TokenQueue *mIdQueue ;
|
||||||
|
QList<QAction*> mContextMenuActions;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(FriendSelectionWidget::ShowTypes)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(FriendSelectionWidget::ShowTypes)
|
||||||
|
@ -26,24 +26,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="LineEditClear" name="filterLineEdit"/>
|
<widget class="LineEditClear" name="filterLineEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="selectAll_PB">
|
|
||||||
<property name="text">
|
|
||||||
<string>All</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="deselectAll_PB">
|
|
||||||
<property name="text">
|
|
||||||
<string>None</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="friendList">
|
<widget class="RSTreeWidget" name="friendList">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
@ -80,6 +66,11 @@
|
|||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header location="global">gui/common/LineEditClear.h</header>
|
<header location="global">gui/common/LineEditClear.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>RSTreeWidget</class>
|
||||||
|
<extends>QTreeWidget</extends>
|
||||||
|
<header>gui/common/RSTreeWidget.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -128,6 +128,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
setupEditActions();
|
setupEditActions();
|
||||||
setupViewActions();
|
setupViewActions();
|
||||||
setupInsertActions();
|
setupInsertActions();
|
||||||
|
setupContactActions();
|
||||||
|
|
||||||
m_compareRole = new RSTreeWidgetItemCompareRole;
|
m_compareRole = new RSTreeWidgetItemCompareRole;
|
||||||
m_compareRole->setRole(COLUMN_CONTACT_NAME, ROLE_CONTACT_SORT);
|
m_compareRole->setRole(COLUMN_CONTACT_NAME, ROLE_CONTACT_SORT);
|
||||||
@ -210,8 +211,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
||||||
connect(ui.friendSelectionWidget, SIGNAL(contentChanged()), this, SLOT(buildCompleter()));
|
connect(ui.friendSelectionWidget, SIGNAL(contentChanged()), this, SLOT(buildCompleter()));
|
||||||
connect(ui.friendSelectionWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuMsgSendList(QPoint)));
|
|
||||||
connect(ui.friendSelectionWidget, SIGNAL(doubleClicked(int,QString)), this, SLOT(addTo()));
|
connect(ui.friendSelectionWidget, SIGNAL(doubleClicked(int,QString)), this, SLOT(addTo()));
|
||||||
|
connect(ui.friendSelectionWidget, SIGNAL(itemSelectionChanged()), this, SLOT(friendSelectionChanged()));
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.msgFileList -> setRootIsDecorated( false );
|
ui.msgFileList -> setRootIsDecorated( false );
|
||||||
@ -698,35 +699,6 @@ void MessageComposer::contextMenuFileList(QPoint)
|
|||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::contextMenuMsgSendList(QPoint)
|
|
||||||
{
|
|
||||||
QMenu contextMnu(this);
|
|
||||||
|
|
||||||
int selectedCount = ui.friendSelectionWidget->selectedItemCount();
|
|
||||||
|
|
||||||
FriendSelectionWidget::IdType idType;
|
|
||||||
ui.friendSelectionWidget->selectedId(idType);
|
|
||||||
|
|
||||||
QAction *action = contextMnu.addAction(QIcon(), tr("Add to \"To\""), this, SLOT(addTo()));
|
|
||||||
action->setEnabled(selectedCount);
|
|
||||||
action = contextMnu.addAction(QIcon(), tr("Add to \"CC\""), this, SLOT(addCc()));
|
|
||||||
action->setEnabled(selectedCount);
|
|
||||||
action = contextMnu.addAction(QIcon(), tr("Add to \"BCC\""), this, SLOT(addBcc()));
|
|
||||||
action->setEnabled(selectedCount);
|
|
||||||
action = contextMnu.addAction(QIcon(), tr("Add as Recommend"), this, SLOT(addRecommend()));
|
|
||||||
action->setEnabled(selectedCount);
|
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_FRIENDINFO), tr("Friend Details"), this, SLOT(friendDetails()));
|
|
||||||
action->setEnabled(selectedCount == 1 && idType == FriendSelectionWidget::IDTYPE_SSL);
|
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(), tr("Person Details"), this, SLOT(identityDetails()));
|
|
||||||
action->setEnabled(selectedCount == 1 && idType == FriendSelectionWidget::IDTYPE_GXS);
|
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageComposer::pasteRecommended()
|
void MessageComposer::pasteRecommended()
|
||||||
{
|
{
|
||||||
QList<RetroShareLink> links;
|
QList<RetroShareLink> links;
|
||||||
@ -2009,6 +1981,31 @@ void MessageComposer::setupFormatActions()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageComposer::setupContactActions()
|
||||||
|
{
|
||||||
|
mActionAddTo = new QAction(tr("Add to \"To\""), this);
|
||||||
|
connect(mActionAddTo, SIGNAL(triggered(bool)), this, SLOT(addTo()));
|
||||||
|
mActionAddCC = new QAction(tr("Add to \"CC\""), this);
|
||||||
|
connect(mActionAddCC, SIGNAL(triggered(bool)), this, SLOT(addCc()));
|
||||||
|
mActionAddBCC = new QAction(tr("Add to \"BCC\""), this);
|
||||||
|
connect(mActionAddBCC, SIGNAL(triggered(bool)), this, SLOT(addBcc()));
|
||||||
|
mActionAddRecommend = new QAction(tr("Add as Recommend"), this);
|
||||||
|
connect(mActionAddRecommend, SIGNAL(triggered(bool)), this, SLOT(addRecommend()));
|
||||||
|
mActionContactDetails = new QAction(QIcon(IMAGE_FRIENDINFO), tr("Details"), this);
|
||||||
|
connect(mActionContactDetails, SIGNAL(triggered(bool)), this, SLOT(contactDetails()));
|
||||||
|
|
||||||
|
ui.friendSelectionWidget->addContextMenuAction(mActionAddTo);
|
||||||
|
ui.friendSelectionWidget->addContextMenuAction(mActionAddCC);
|
||||||
|
ui.friendSelectionWidget->addContextMenuAction(mActionAddBCC);
|
||||||
|
ui.friendSelectionWidget->addContextMenuAction(mActionAddRecommend);
|
||||||
|
|
||||||
|
QAction *action = new QAction(this);
|
||||||
|
action->setSeparator(true);
|
||||||
|
ui.friendSelectionWidget->addContextMenuAction(action);
|
||||||
|
|
||||||
|
ui.friendSelectionWidget->addContextMenuAction(mActionContactDetails);
|
||||||
|
}
|
||||||
|
|
||||||
void MessageComposer::textBold()
|
void MessageComposer::textBold()
|
||||||
{
|
{
|
||||||
QTextCharFormat fmt;
|
QTextCharFormat fmt;
|
||||||
@ -2577,6 +2574,27 @@ void MessageComposer::filterComboBoxChanged(int i)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageComposer::friendSelectionChanged()
|
||||||
|
{
|
||||||
|
std::set<RsPeerId> peerIds;
|
||||||
|
ui.friendSelectionWidget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(peerIds, false);
|
||||||
|
|
||||||
|
std::set<RsGxsId> gxsIds;
|
||||||
|
ui.friendSelectionWidget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(gxsIds, false);
|
||||||
|
|
||||||
|
int selectedCount = peerIds.size() + gxsIds.size();
|
||||||
|
|
||||||
|
mActionAddTo->setEnabled(selectedCount);
|
||||||
|
mActionAddCC->setEnabled(selectedCount);
|
||||||
|
mActionAddBCC->setEnabled(selectedCount);
|
||||||
|
mActionAddRecommend->setEnabled(selectedCount);
|
||||||
|
|
||||||
|
FriendSelectionWidget::IdType idType;
|
||||||
|
ui.friendSelectionWidget->selectedId(idType);
|
||||||
|
|
||||||
|
mActionContactDetails->setEnabled(selectedCount == 1 && (idType == FriendSelectionWidget::IDTYPE_SSL || idType == FriendSelectionWidget::IDTYPE_GXS));
|
||||||
|
}
|
||||||
|
|
||||||
void MessageComposer::addTo()
|
void MessageComposer::addTo()
|
||||||
{
|
{
|
||||||
addContact(TO);
|
addContact(TO);
|
||||||
@ -2613,35 +2631,37 @@ void MessageComposer::addRecommend()
|
|||||||
ui.msgText->setFocus(Qt::OtherFocusReason);
|
ui.msgText->setFocus(Qt::OtherFocusReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::friendDetails()
|
void MessageComposer::contactDetails()
|
||||||
{
|
{
|
||||||
FriendSelectionWidget::IdType idType;
|
FriendSelectionWidget::IdType idType;
|
||||||
std::string id = ui.friendSelectionWidget->selectedId(idType);
|
std::string id = ui.friendSelectionWidget->selectedId(idType);
|
||||||
|
|
||||||
if (id.empty() || idType != FriendSelectionWidget::IDTYPE_SSL) {
|
if (id.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfCertDialog::showIt(RsPeerId(id), ConfCertDialog::PageDetails);
|
switch (idType) {
|
||||||
}
|
case FriendSelectionWidget::IDTYPE_NONE:
|
||||||
|
case FriendSelectionWidget::IDTYPE_GROUP:
|
||||||
|
case FriendSelectionWidget::IDTYPE_GPG:
|
||||||
|
break;
|
||||||
|
case FriendSelectionWidget::IDTYPE_SSL:
|
||||||
|
ConfCertDialog::showIt(RsPeerId(id), ConfCertDialog::PageDetails);
|
||||||
|
break;
|
||||||
|
case FriendSelectionWidget::IDTYPE_GXS:
|
||||||
|
{
|
||||||
|
if (RsGxsGroupId(id).isNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void MessageComposer::identityDetails()
|
IdDetailsDialog *dialog = new IdDetailsDialog(RsGxsGroupId(id));
|
||||||
{
|
dialog->show();
|
||||||
FriendSelectionWidget::IdType idType;
|
|
||||||
std::string id = ui.friendSelectionWidget->selectedId(idType);
|
|
||||||
|
|
||||||
if (id.empty() || idType != FriendSelectionWidget::IDTYPE_GXS) {
|
/* Dialog will destroy itself */
|
||||||
return;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RsGxsGroupId(id).isNull()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IdDetailsDialog *dialog = new IdDetailsDialog(RsGxsGroupId(id));
|
|
||||||
dialog->show();
|
|
||||||
|
|
||||||
/* Dialog will destroy itself */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::tagAboutToShow()
|
void MessageComposer::tagAboutToShow()
|
||||||
|
@ -97,7 +97,6 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
/* toggle Contacts DockWidget */
|
/* toggle Contacts DockWidget */
|
||||||
void contextMenuFileList(QPoint);
|
void contextMenuFileList(QPoint);
|
||||||
void contextMenuMsgSendList(QPoint);
|
|
||||||
void pasteRecommended();
|
void pasteRecommended();
|
||||||
void on_contactsdockWidget_visibilityChanged(bool visible);
|
void on_contactsdockWidget_visibilityChanged(bool visible);
|
||||||
void toggleContacts();
|
void toggleContacts();
|
||||||
@ -153,10 +152,10 @@ private slots:
|
|||||||
void addBcc();
|
void addBcc();
|
||||||
void addRecommend();
|
void addRecommend();
|
||||||
void editingRecipientFinished();
|
void editingRecipientFinished();
|
||||||
void friendDetails();
|
void contactDetails();
|
||||||
void identityDetails();
|
|
||||||
|
|
||||||
void peerStatusChanged(const QString& peer_id, int status);
|
void peerStatusChanged(const QString& peer_id, int status);
|
||||||
|
void friendSelectionChanged();
|
||||||
|
|
||||||
void tagAboutToShow();
|
void tagAboutToShow();
|
||||||
void tagSet(int tagId, bool set);
|
void tagSet(int tagId, bool set);
|
||||||
@ -179,6 +178,7 @@ private:
|
|||||||
void setupViewActions();
|
void setupViewActions();
|
||||||
void setupInsertActions();
|
void setupInsertActions();
|
||||||
void setupFormatActions();
|
void setupFormatActions();
|
||||||
|
void setupContactActions();
|
||||||
|
|
||||||
bool load(const QString &f);
|
bool load(const QString &f);
|
||||||
bool maybeSave();
|
bool maybeSave();
|
||||||
@ -222,6 +222,11 @@ private:
|
|||||||
*actionUpperRoman;
|
*actionUpperRoman;
|
||||||
|
|
||||||
QAction *contactSidebarAction;
|
QAction *contactSidebarAction;
|
||||||
|
QAction *mActionAddTo;
|
||||||
|
QAction *mActionAddCC;
|
||||||
|
QAction *mActionAddBCC;
|
||||||
|
QAction *mActionAddRecommend;
|
||||||
|
QAction *mActionContactDetails;
|
||||||
|
|
||||||
QTreeView *channelstreeView;
|
QTreeView *channelstreeView;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user