mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-21 04:44:25 -04:00
Added new level gpg id to FriendSelectionWidget (groups, gpg id, ssl id).
Added friend selection to the group dialog for better assigning of friends to groups. Updated english translation. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5881 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0adff2d02a
commit
09f42dbc3c
14 changed files with 505 additions and 235 deletions
|
@ -1592,6 +1592,8 @@ bool p3PeerMgrIMPL::addGroup(RsGroupInfo &groupInfo)
|
||||||
groupItem->PeerId(getOwnId());
|
groupItem->PeerId(getOwnId());
|
||||||
|
|
||||||
groupList.push_back(groupItem);
|
groupList.push_back(groupItem);
|
||||||
|
|
||||||
|
groupInfo.id = groupItem->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_ADD);
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_ADD);
|
||||||
|
|
|
@ -47,6 +47,7 @@ FriendRecommendDialog::FriendRecommendDialog() :
|
||||||
|
|
||||||
ui->recommendList->setHeaderText(tr("Recommend friends"));
|
ui->recommendList->setHeaderText(tr("Recommend friends"));
|
||||||
ui->recommendList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
ui->recommendList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui->recommendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||||
ui->recommendList->start();
|
ui->recommendList->start();
|
||||||
|
|
||||||
ui->toList->setHeaderText(tr("To"));
|
ui->toList->setHeaderText(tr("To"));
|
||||||
|
|
|
@ -60,6 +60,7 @@ CreateChannel::CreateChannel()
|
||||||
/* initialize key share list */
|
/* initialize key share list */
|
||||||
ui.keyShareList->setHeaderText(tr("Contacts:"));
|
ui.keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui.keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||||
ui.keyShareList->start();
|
ui.keyShareList->start();
|
||||||
|
|
||||||
newChannel();
|
newChannel();
|
||||||
|
|
|
@ -45,6 +45,7 @@ ShareKey::ShareKey(QWidget *parent, std::string grpId, int grpType) :
|
||||||
/* initialize key share list */
|
/* initialize key share list */
|
||||||
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui->keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||||
ui->keyShareList->start();
|
ui->keyShareList->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list, in
|
||||||
/* initialize key share list */
|
/* initialize key share list */
|
||||||
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui->keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||||
ui->keyShareList->start();
|
ui->keyShareList->start();
|
||||||
ui->keyShareList->setSelectedSslIds(peer_list, false);
|
ui->keyShareList->setSelectedSslIds(peer_list, false);
|
||||||
|
|
||||||
|
|
|
@ -338,10 +338,9 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
QAction *action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Group"), this, SLOT(editGroup()));
|
contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Group"), this, SLOT(editGroup()));
|
||||||
action->setDisabled(standard);
|
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove Group"), this, SLOT(removeGroup()));
|
QAction *action = contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove Group"), this, SLOT(removeGroup()));
|
||||||
action->setDisabled(standard);
|
action->setDisabled(standard);
|
||||||
|
|
||||||
lobbyMenu = contextMnu.addMenu(QIcon(IMAGE_CHAT), tr("Chat lobbies")) ;
|
lobbyMenu = contextMnu.addMenu(QIcon(IMAGE_CHAT), tr("Chat lobbies")) ;
|
||||||
|
|
|
@ -78,8 +78,10 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent) :
|
||||||
|
|
||||||
started = false;
|
started = false;
|
||||||
listModus = MODUS_SINGLE;
|
listModus = MODUS_SINGLE;
|
||||||
showGroups = true;
|
showTypes = SHOW_GROUP | SHOW_SSL;
|
||||||
inItemChanged = false;
|
inGroupItemChanged = false;
|
||||||
|
inGpgItemChanged = false;
|
||||||
|
inSslItemChanged = false;
|
||||||
|
|
||||||
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)));
|
||||||
|
@ -142,9 +144,9 @@ void FriendSelectionWidget::setModus(Modus modus)
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::setShowGroups(bool show)
|
void FriendSelectionWidget::setShowType(ShowTypes types)
|
||||||
{
|
{
|
||||||
showGroups = show;
|
showTypes = types;
|
||||||
|
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
|
@ -155,6 +157,31 @@ void FriendSelectionWidget::start()
|
||||||
fillList();
|
fillList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, const std::list<StatusInfo> &statusInfo, QColor textColorOnline)
|
||||||
|
{
|
||||||
|
QString name = PeerDefs::nameWithLocation(detail);
|
||||||
|
item->setText(COLUMN_NAME, name);
|
||||||
|
|
||||||
|
int state = RS_STATUS_OFFLINE;
|
||||||
|
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
||||||
|
std::list<StatusInfo>::const_iterator it;
|
||||||
|
for (it = statusInfo.begin(); it != statusInfo.end() ; it++) {
|
||||||
|
if (it->id == detail.id) {
|
||||||
|
state = it->status;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != (int) RS_STATUS_OFFLINE) {
|
||||||
|
item->setTextColor(COLUMN_NAME, textColorOnline);
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
||||||
|
item->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id));
|
||||||
|
item->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
||||||
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::fillList()
|
void FriendSelectionWidget::fillList()
|
||||||
{
|
{
|
||||||
if (!started) {
|
if (!started) {
|
||||||
|
@ -163,10 +190,19 @@ void FriendSelectionWidget::fillList()
|
||||||
|
|
||||||
// get selected items
|
// get selected items
|
||||||
std::list<std::string> sslIdsSelected;
|
std::list<std::string> sslIdsSelected;
|
||||||
|
if (showTypes & SHOW_SSL) {
|
||||||
selectedSslIds(sslIdsSelected, true);
|
selectedSslIds(sslIdsSelected, true);
|
||||||
|
}
|
||||||
|
|
||||||
std::list<std::string> groupIdsSelected;
|
std::list<std::string> groupIdsSelected;
|
||||||
|
if (showTypes & SHOW_GROUP) {
|
||||||
selectedGroupIds(groupIdsSelected);
|
selectedGroupIds(groupIdsSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<std::string> gpgIdsSelected;
|
||||||
|
if (showTypes & SHOW_GPG) {
|
||||||
|
selectedGpgIds(gpgIdsSelected, true);
|
||||||
|
}
|
||||||
|
|
||||||
// remove old items
|
// remove old items
|
||||||
ui->friendList->clear();
|
ui->friendList->clear();
|
||||||
|
@ -176,22 +212,30 @@ void FriendSelectionWidget::fillList()
|
||||||
std::list<RsGroupInfo>::iterator groupIt;
|
std::list<RsGroupInfo>::iterator groupIt;
|
||||||
rsPeers->getGroupInfoList(groupInfoList);
|
rsPeers->getGroupInfoList(groupInfoList);
|
||||||
|
|
||||||
|
std::list<std::string> gpgIds;
|
||||||
|
std::list<std::string>::iterator gpgIt;
|
||||||
|
rsPeers->getGPGAcceptedList(gpgIds);
|
||||||
|
|
||||||
std::list<std::string> sslIds;
|
std::list<std::string> sslIds;
|
||||||
std::list<std::string>::iterator sslIt;
|
std::list<std::string>::iterator sslIt;
|
||||||
|
if ((showTypes & (SHOW_SSL | SHOW_GPG)) == SHOW_SSL) {
|
||||||
rsPeers->getFriendList(sslIds);
|
rsPeers->getFriendList(sslIds);
|
||||||
|
}
|
||||||
|
|
||||||
std::list<StatusInfo> statusInfo;
|
std::list<StatusInfo> statusInfo;
|
||||||
|
std::list<StatusInfo>::iterator statusIt;
|
||||||
rsStatus->getStatusList(statusInfo);
|
rsStatus->getStatusList(statusInfo);
|
||||||
|
|
||||||
std::list<std::string> filledSslIds;
|
std::list<std::string> filledIds; // gpg or ssl id
|
||||||
|
|
||||||
// start with groups
|
// start with groups
|
||||||
groupIt = groupInfoList.begin();
|
groupIt = groupInfoList.begin();
|
||||||
while (true) {
|
while (true) {
|
||||||
QTreeWidgetItem *groupItem = NULL;
|
QTreeWidgetItem *groupItem = NULL;
|
||||||
|
QTreeWidgetItem *gpgItem = NULL;
|
||||||
RsGroupInfo *groupInfo = NULL;
|
RsGroupInfo *groupInfo = NULL;
|
||||||
|
|
||||||
if (showGroups && groupIt != groupInfoList.end()) {
|
if ((showTypes & SHOW_GROUP) && groupIt != groupInfoList.end()) {
|
||||||
groupInfo = &(*groupIt);
|
groupInfo = &(*groupIt);
|
||||||
|
|
||||||
if (groupInfo->peerIds.size() == 0) {
|
if (groupInfo->peerIds.size() == 0) {
|
||||||
|
@ -228,6 +272,102 @@ void FriendSelectionWidget::fillList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showTypes & SHOW_GPG) {
|
||||||
|
// iterate through gpg ids
|
||||||
|
for (gpgIt = gpgIds.begin(); gpgIt != gpgIds.end(); gpgIt++) {
|
||||||
|
if (groupInfo) {
|
||||||
|
// we fill a group, check if gpg id is assigned
|
||||||
|
if (std::find(groupInfo->peerIds.begin(), groupInfo->peerIds.end(), *gpgIt) == groupInfo->peerIds.end()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// we fill the not assigned gpg ids
|
||||||
|
if (std::find(filledIds.begin(), filledIds.end(), *gpgIt) != filledIds.end()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add equal too, its no problem
|
||||||
|
filledIds.push_back(*gpgIt);
|
||||||
|
|
||||||
|
RsPeerDetails detail;
|
||||||
|
if (!rsPeers->getPeerDetails(*gpgIt, detail)) {
|
||||||
|
continue; /* BAD */
|
||||||
|
}
|
||||||
|
|
||||||
|
// make a widget per friend
|
||||||
|
gpgItem = new RSTreeWidgetItem(compareRole, IDTYPE_GPG);
|
||||||
|
|
||||||
|
QString name = QString::fromUtf8(detail.name.c_str());
|
||||||
|
gpgItem->setText(COLUMN_NAME, name);
|
||||||
|
|
||||||
|
sslIds.clear();
|
||||||
|
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
||||||
|
|
||||||
|
int state = RS_STATUS_OFFLINE;
|
||||||
|
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; statusIt++) {
|
||||||
|
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
||||||
|
if (statusIt->status != RS_STATUS_OFFLINE) {
|
||||||
|
state = RS_STATUS_ONLINE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != (int) RS_STATUS_OFFLINE) {
|
||||||
|
gpgItem->setTextColor(COLUMN_NAME, textColorOnline());
|
||||||
|
}
|
||||||
|
|
||||||
|
gpgItem->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
||||||
|
gpgItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.gpg_id));
|
||||||
|
gpgItem->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
||||||
|
|
||||||
|
if (listModus == MODUS_CHECK) {
|
||||||
|
gpgItem->setFlags(Qt::ItemIsUserCheckable | gpgItem->flags());
|
||||||
|
gpgItem->setCheckState(0, Qt::Unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add to the list
|
||||||
|
if (groupItem) {
|
||||||
|
groupItem->addChild(gpgItem);
|
||||||
|
} else {
|
||||||
|
ui->friendList->addTopLevelItem(gpgItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
gpgItem->setExpanded(true);
|
||||||
|
|
||||||
|
if (showTypes & SHOW_SSL) {
|
||||||
|
// iterate through associated ssl ids
|
||||||
|
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
|
||||||
|
RsPeerDetails detail;
|
||||||
|
if (!rsPeers->getPeerDetails(*sslIt, detail)) {
|
||||||
|
continue; /* BAD */
|
||||||
|
}
|
||||||
|
|
||||||
|
// make a widget per friend
|
||||||
|
QTreeWidgetItem *item = new RSTreeWidgetItem(compareRole, IDTYPE_SSL);
|
||||||
|
|
||||||
|
initSslItem(item, detail, statusInfo, textColorOnline());
|
||||||
|
|
||||||
|
if (listModus == MODUS_CHECK) {
|
||||||
|
item->setFlags(Qt::ItemIsUserCheckable | item->flags());
|
||||||
|
item->setCheckState(0, Qt::Unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add to the list
|
||||||
|
gpgItem->addChild(item);
|
||||||
|
|
||||||
|
if (std::find(sslIdsSelected.begin(), sslIdsSelected.end(), detail.id) != sslIdsSelected.end()) {
|
||||||
|
setSelected(listModus, item, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::find(gpgIdsSelected.begin(), gpgIdsSelected.end(), detail.gpg_id) != gpgIdsSelected.end()) {
|
||||||
|
setSelected(listModus, gpgItem, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// iterate through ssl ids
|
// iterate through ssl ids
|
||||||
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
|
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
|
@ -242,38 +382,18 @@ void FriendSelectionWidget::fillList()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we fill the not assigned ssl ids
|
// we fill the not assigned ssl ids
|
||||||
if (std::find(filledSslIds.begin(), filledSslIds.end(), *sslIt) != filledSslIds.end()) {
|
if (std::find(filledIds.begin(), filledIds.end(), *sslIt) != filledIds.end()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add equal too, its no problem
|
// add equal too, its no problem
|
||||||
filledSslIds.push_back(detail.id);
|
filledIds.push_back(detail.id);
|
||||||
|
|
||||||
// make a widget per friend
|
// make a widget per friend
|
||||||
QTreeWidgetItem *item = new RSTreeWidgetItem(compareRole, IDTYPE_SSL);
|
QTreeWidgetItem *item = new RSTreeWidgetItem(compareRole, IDTYPE_SSL);
|
||||||
|
|
||||||
QString name = PeerDefs::nameWithLocation(detail);
|
initSslItem(item, detail, statusInfo, textColorOnline());
|
||||||
item->setText(COLUMN_NAME, name);
|
|
||||||
|
|
||||||
int state = RS_STATUS_OFFLINE;
|
|
||||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
|
||||||
std::list<StatusInfo>::iterator it;
|
|
||||||
for (it = statusInfo.begin(); it != statusInfo.end() ; it++) {
|
|
||||||
if (it->id == detail.id) {
|
|
||||||
state = it->status;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state != (int) RS_STATUS_OFFLINE) {
|
|
||||||
item->setTextColor(COLUMN_NAME, textColorOnline());
|
|
||||||
}
|
|
||||||
|
|
||||||
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
|
||||||
item->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id));
|
|
||||||
item->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
|
||||||
|
|
||||||
if (listModus == MODUS_CHECK) {
|
if (listModus == MODUS_CHECK) {
|
||||||
item->setFlags(Qt::ItemIsUserCheckable | item->flags());
|
item->setFlags(Qt::ItemIsUserCheckable | item->flags());
|
||||||
|
@ -291,6 +411,7 @@ void FriendSelectionWidget::fillList()
|
||||||
setSelected(listModus, item, true);
|
setSelected(listModus, item, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (groupIt != groupInfoList.end()) {
|
if (groupIt != groupInfoList.end()) {
|
||||||
groupIt++;
|
groupIt++;
|
||||||
|
@ -311,22 +432,80 @@ void FriendSelectionWidget::fillList()
|
||||||
|
|
||||||
void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
{
|
{
|
||||||
|
QString gpgId;
|
||||||
|
int gpgStatus = RS_STATUS_OFFLINE;
|
||||||
|
|
||||||
|
if (showTypes & SHOW_GPG) {
|
||||||
|
/* need gpg id and online state */
|
||||||
|
RsPeerDetails detail;
|
||||||
|
if (rsPeers->getPeerDetails(peerId.toStdString(), detail)) {
|
||||||
|
gpgId = QString::fromStdString(detail.gpg_id);
|
||||||
|
|
||||||
|
if (status == (int) RS_STATUS_OFFLINE) {
|
||||||
|
/* try other locations */
|
||||||
|
std::list<std::string> sslIds;
|
||||||
|
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslIds);
|
||||||
|
|
||||||
|
std::list<StatusInfo> statusInfo;
|
||||||
|
std::list<StatusInfo>::iterator statusIt;
|
||||||
|
rsStatus->getStatusList(statusInfo);
|
||||||
|
|
||||||
|
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; statusIt++) {
|
||||||
|
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
||||||
|
if (statusIt->status != RS_STATUS_OFFLINE) {
|
||||||
|
gpgStatus = RS_STATUS_ONLINE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* one location is online */
|
||||||
|
gpgStatus = RS_STATUS_ONLINE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
||||||
QTreeWidgetItem *item;
|
QTreeWidgetItem *item;
|
||||||
while ((item = *itemIterator) != NULL) {
|
while ((item = *itemIterator) != NULL) {
|
||||||
itemIterator++;
|
itemIterator++;
|
||||||
|
|
||||||
|
switch ((IdType) item->type()) {
|
||||||
|
case IDTYPE_NONE:
|
||||||
|
case IDTYPE_GROUP:
|
||||||
|
break;
|
||||||
|
case IDTYPE_GPG:
|
||||||
|
{
|
||||||
|
if (item->data(COLUMN_DATA, ROLE_ID).toString() == gpgId) {
|
||||||
|
QColor color;
|
||||||
|
if (status != (int) RS_STATUS_OFFLINE) {
|
||||||
|
color = textColorOnline();
|
||||||
|
} else {
|
||||||
|
color = ui->friendList->palette().color(QPalette::Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setTextColor(COLUMN_NAME, color);
|
||||||
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(gpgStatus)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDTYPE_SSL:
|
||||||
|
{
|
||||||
if (item->data(COLUMN_DATA, ROLE_ID).toString() == peerId) {
|
if (item->data(COLUMN_DATA, ROLE_ID).toString() == peerId) {
|
||||||
QColor color;
|
QColor color;
|
||||||
if (status != (int) RS_STATUS_OFFLINE) {
|
if (status != (int) RS_STATUS_OFFLINE) {
|
||||||
color = textColorOnline();
|
color = textColorOnline();
|
||||||
|
} else {
|
||||||
|
color = ui->friendList->palette().color(QPalette::Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)));
|
||||||
//break; no break, friend can assigned to groups more than one
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// friend can assigned to groups more than one
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::contextMenuRequested(const QPoint &pos)
|
void FriendSelectionWidget::contextMenuRequested(const QPoint &pos)
|
||||||
|
@ -345,10 +524,6 @@ void FriendSelectionWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*colum
|
||||||
|
|
||||||
void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
|
void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||||
{
|
{
|
||||||
if (inItemChanged) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listModus != MODUS_CHECK) {
|
if (listModus != MODUS_CHECK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -357,17 +532,36 @@ void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showGroups) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
inItemChanged = true;
|
|
||||||
|
|
||||||
switch ((IdType) item->type()) {
|
switch ((IdType) item->type()) {
|
||||||
case IDTYPE_NONE:
|
case IDTYPE_NONE:
|
||||||
break;
|
break;
|
||||||
case IDTYPE_GROUP:
|
case IDTYPE_GROUP:
|
||||||
{
|
{
|
||||||
|
if (inGroupItemChanged || inGpgItemChanged || inSslItemChanged) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
inGroupItemChanged = true;
|
||||||
|
|
||||||
|
bool selected = isSelected(listModus, item);
|
||||||
|
|
||||||
|
int childCount = item->childCount();
|
||||||
|
for (int i = 0; i < childCount; ++i) {
|
||||||
|
setSelected(listModus, item->child(i), selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
inGroupItemChanged = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDTYPE_GPG:
|
||||||
|
{
|
||||||
|
if (inGpgItemChanged) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
inGpgItemChanged = true;
|
||||||
|
|
||||||
|
if (!inSslItemChanged) {
|
||||||
bool selected = isSelected(listModus, item);
|
bool selected = isSelected(listModus, item);
|
||||||
|
|
||||||
int childCount = item->childCount();
|
int childCount = item->childCount();
|
||||||
|
@ -375,14 +569,10 @@ void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||||
setSelected(listModus, item->child(i), selected);
|
setSelected(listModus, item->child(i), selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case IDTYPE_SSL:
|
|
||||||
{
|
|
||||||
QTreeWidgetItem *itemParent = item->parent();
|
|
||||||
if (itemParent == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!inGroupItemChanged) {
|
||||||
|
QTreeWidgetItem *itemParent = item->parent();
|
||||||
|
if (itemParent) {
|
||||||
int childCount = itemParent->childCount();
|
int childCount = itemParent->childCount();
|
||||||
bool foundUnselected = false;
|
bool foundUnselected = false;
|
||||||
for (int index = 0; index < childCount; ++index) {
|
for (int index = 0; index < childCount; ++index) {
|
||||||
|
@ -393,10 +583,36 @@ void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||||
}
|
}
|
||||||
setSelected(listModus, itemParent, !foundUnselected);
|
setSelected(listModus, itemParent, !foundUnselected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inGpgItemChanged = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDTYPE_SSL:
|
||||||
|
{
|
||||||
|
if (inGroupItemChanged || inGpgItemChanged || inSslItemChanged) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
inItemChanged = false;
|
inSslItemChanged = true;
|
||||||
|
|
||||||
|
QTreeWidgetItem *itemParent = item->parent();
|
||||||
|
if (itemParent) {
|
||||||
|
int childCount = itemParent->childCount();
|
||||||
|
bool foundUnselected = false;
|
||||||
|
for (int index = 0; index < childCount; ++index) {
|
||||||
|
if (!isSelected(listModus, itemParent->child(index))) {
|
||||||
|
foundUnselected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setSelected(listModus, itemParent, !foundUnselected);
|
||||||
|
}
|
||||||
|
|
||||||
|
inSslItemChanged = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::filterItems(const QString& text)
|
void FriendSelectionWidget::filterItems(const QString& text)
|
||||||
|
@ -470,15 +686,35 @@ void FriendSelectionWidget::selectedIds(IdType idType, std::list<std::string> &i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDTYPE_GPG:
|
||||||
|
if (idType == IDTYPE_GPG) {
|
||||||
|
if (isSelected(listModus, item)) {
|
||||||
|
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
|
} else {
|
||||||
|
if (!onlyDirectSelected) {
|
||||||
|
QTreeWidgetItem *itemParent = item;
|
||||||
|
while ((itemParent = itemParent->parent()) != NULL) {
|
||||||
|
if (isSelected(listModus, itemParent)) {
|
||||||
|
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case IDTYPE_SSL:
|
case IDTYPE_SSL:
|
||||||
if (idType == IDTYPE_SSL) {
|
if (idType == IDTYPE_SSL) {
|
||||||
if (isSelected(listModus, item)) {
|
if (isSelected(listModus, item)) {
|
||||||
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
} else {
|
} else {
|
||||||
if (!onlyDirectSelected) {
|
if (!onlyDirectSelected) {
|
||||||
QTreeWidgetItem *itemParent = item->parent();
|
QTreeWidgetItem *itemParent = item;
|
||||||
if (itemParent && isSelected(listModus, itemParent)) {
|
while ((itemParent = itemParent->parent()) != NULL) {
|
||||||
|
if (isSelected(listModus, itemParent)) {
|
||||||
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,6 +741,7 @@ void FriendSelectionWidget::setSelectedIds(IdType idType, const std::list<std::s
|
||||||
case IDTYPE_NONE:
|
case IDTYPE_NONE:
|
||||||
break;
|
break;
|
||||||
case IDTYPE_GROUP:
|
case IDTYPE_GROUP:
|
||||||
|
case IDTYPE_GPG:
|
||||||
case IDTYPE_SSL:
|
case IDTYPE_SSL:
|
||||||
if (idType == itemType) {
|
if (idType == itemType) {
|
||||||
if (std::find(ids.begin(), ids.end(), id) != ids.end()) {
|
if (std::find(ids.begin(), ids.end(), id) != ids.end()) {
|
||||||
|
|
|
@ -43,7 +43,8 @@ public:
|
||||||
{
|
{
|
||||||
IDTYPE_NONE,
|
IDTYPE_NONE,
|
||||||
IDTYPE_GROUP,
|
IDTYPE_GROUP,
|
||||||
IDTYPE_SSL
|
IDTYPE_SSL,
|
||||||
|
IDTYPE_GPG
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Modus
|
enum Modus
|
||||||
|
@ -53,21 +54,31 @@ public:
|
||||||
MODUS_CHECK
|
MODUS_CHECK
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ShowType {
|
||||||
|
SHOW_GROUP = 1,
|
||||||
|
SHOW_GPG = 2,
|
||||||
|
SHOW_SSL = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_FLAGS(ShowTypes, ShowType)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FriendSelectionWidget(QWidget *parent = 0);
|
explicit FriendSelectionWidget(QWidget *parent = 0);
|
||||||
~FriendSelectionWidget();
|
~FriendSelectionWidget();
|
||||||
|
|
||||||
void setHeaderText(const QString &text);
|
void setHeaderText(const QString &text);
|
||||||
void setModus(Modus modus);
|
void setModus(Modus modus);
|
||||||
void setShowGroups(bool show);
|
void setShowType(ShowTypes types);
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
int selectedItemCount();
|
int selectedItemCount();
|
||||||
QString selectedId(IdType &idType);
|
QString selectedId(IdType &idType);
|
||||||
void selectedSslIds(std::list<std::string> &sslIds, bool onlyDirectSelected) { selectedIds(IDTYPE_SSL, sslIds, onlyDirectSelected); }
|
void selectedSslIds(std::list<std::string> &sslIds, bool onlyDirectSelected) { selectedIds(IDTYPE_SSL, sslIds, onlyDirectSelected); }
|
||||||
|
void selectedGpgIds(std::list<std::string> &gpgIds, bool onlyDirectSelected) { selectedIds(IDTYPE_GPG, gpgIds, onlyDirectSelected); }
|
||||||
void selectedGroupIds(std::list<std::string> &groupIds) { selectedIds(IDTYPE_GROUP, groupIds, true); }
|
void selectedGroupIds(std::list<std::string> &groupIds) { selectedIds(IDTYPE_GROUP, groupIds, true); }
|
||||||
|
|
||||||
void setSelectedSslIds(const std::list<std::string> &sslIds, bool add) { setSelectedIds(IDTYPE_SSL, sslIds, add); }
|
void setSelectedSslIds(const std::list<std::string> &sslIds, bool add) { setSelectedIds(IDTYPE_SSL, sslIds, add); }
|
||||||
|
void setSelectedGpgIds(const std::list<std::string> &gpgIds, bool add) { setSelectedIds(IDTYPE_GPG, gpgIds, add); }
|
||||||
void setSelectedGroupIds(const std::list<std::string> &groupIds, bool add) { setSelectedIds(IDTYPE_GROUP, groupIds, add); }
|
void setSelectedGroupIds(const std::list<std::string> &groupIds, bool add) { setSelectedIds(IDTYPE_GROUP, groupIds, add); }
|
||||||
|
|
||||||
QColor textColorOnline() const { return mTextColorOnline; }
|
QColor textColorOnline() const { return mTextColorOnline; }
|
||||||
|
@ -99,8 +110,10 @@ private:
|
||||||
bool started;
|
bool started;
|
||||||
RSTreeWidgetItemCompareRole *compareRole;
|
RSTreeWidgetItemCompareRole *compareRole;
|
||||||
Modus listModus;
|
Modus listModus;
|
||||||
bool showGroups;
|
ShowTypes showTypes;
|
||||||
bool inItemChanged;
|
bool inGroupItemChanged;
|
||||||
|
bool inGpgItemChanged;
|
||||||
|
bool inSslItemChanged;
|
||||||
|
|
||||||
/* Color definitions (for standard see qss.default) */
|
/* Color definitions (for standard see qss.default) */
|
||||||
QColor mTextColorOnline;
|
QColor mTextColorOnline;
|
||||||
|
@ -108,4 +121,6 @@ private:
|
||||||
Ui::FriendSelectionWidget *ui;
|
Ui::FriendSelectionWidget *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(FriendSelectionWidget::ShowTypes)
|
||||||
|
|
||||||
#endif // FRIENDSELECTIONWIDGET_H
|
#endif // FRIENDSELECTIONWIDGET_H
|
||||||
|
|
|
@ -55,6 +55,7 @@ CreateForum::CreateForum()
|
||||||
/* initialize key share list */
|
/* initialize key share list */
|
||||||
ui.keyShareList->setHeaderText(tr("Contacts:"));
|
ui.keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui.keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||||
ui.keyShareList->start();
|
ui.keyShareList->start();
|
||||||
|
|
||||||
newForum();
|
newForum();
|
||||||
|
|
|
@ -23,33 +23,53 @@
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
||||||
#include "util/misc.h"
|
|
||||||
|
|
||||||
#include "CreateGroup.h"
|
#include "CreateGroup.h"
|
||||||
#include "gui/common/GroupDefs.h"
|
#include "gui/common/GroupDefs.h"
|
||||||
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
CreateGroup::CreateGroup(const std::string groupId, QWidget *parent)
|
CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent)
|
||||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||||
{
|
{
|
||||||
/* Invoke Qt Designer generated QObject setup routine */
|
/* Invoke Qt Designer generated QObject setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
Settings->loadWidgetInformation(this);
|
||||||
|
|
||||||
|
mIsStandard = false;
|
||||||
|
|
||||||
ui.headerFrame->setHeaderImage(QPixmap(":/images/user/add_group256.png"));
|
ui.headerFrame->setHeaderImage(QPixmap(":/images/user/add_group256.png"));
|
||||||
|
|
||||||
m_groupId = groupId;
|
mGroupId = groupId;
|
||||||
|
|
||||||
if (m_groupId.empty() == false) {
|
/* Initialize friends list */
|
||||||
|
ui.friendList->setHeaderText(tr("Friends"));
|
||||||
|
ui.friendList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui.friendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_GPG);
|
||||||
|
ui.friendList->start();
|
||||||
|
|
||||||
|
if (mGroupId.empty() == false) {
|
||||||
/* edit exisiting group */
|
/* edit exisiting group */
|
||||||
RsGroupInfo groupInfo;
|
RsGroupInfo groupInfo;
|
||||||
if (rsPeers->getGroupInfo(m_groupId, groupInfo)) {
|
if (rsPeers->getGroupInfo(mGroupId, groupInfo)) {
|
||||||
ui.groupname->setText(misc::removeNewLine(groupInfo.name));
|
mIsStandard = (groupInfo.flag & RS_GROUP_FLAG_STANDARD);
|
||||||
|
|
||||||
|
if (mIsStandard) {
|
||||||
|
ui.groupName->setText(GroupDefs::name(groupInfo));
|
||||||
|
} else {
|
||||||
|
ui.groupName->setText(misc::removeNewLine(groupInfo.name));
|
||||||
|
}
|
||||||
|
|
||||||
setWindowTitle(tr("Edit Group"));
|
setWindowTitle(tr("Edit Group"));
|
||||||
ui.headerFrame->setHeaderText(tr("Edit Group"));
|
ui.headerFrame->setHeaderText(tr("Edit Group"));
|
||||||
|
|
||||||
|
ui.groupName->setDisabled(mIsStandard);
|
||||||
|
|
||||||
|
ui.friendList->setSelectedGpgIds(groupInfo.peerIds, false);
|
||||||
} else {
|
} else {
|
||||||
/* Group not found, create new */
|
/* Group not found, create new */
|
||||||
m_groupId.clear();
|
mGroupId.clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui.headerFrame->setHeaderText(tr("Create a Group"));
|
ui.headerFrame->setHeaderText(tr("Create a Group"));
|
||||||
|
@ -60,44 +80,71 @@ CreateGroup::CreateGroup(const std::string groupId, QWidget *parent)
|
||||||
|
|
||||||
std::list<RsGroupInfo>::iterator groupIt;
|
std::list<RsGroupInfo>::iterator groupIt;
|
||||||
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) {
|
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) {
|
||||||
if (m_groupId.empty() || groupIt->id != m_groupId) {
|
if (mGroupId.empty() || groupIt->id != mGroupId) {
|
||||||
usedGroupNames.append(GroupDefs::name(*groupIt));
|
mUsedGroupNames.append(GroupDefs::name(*groupIt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
on_groupname_textChanged(ui.groupname->text());
|
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(changeGroup()));
|
||||||
|
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
connect(ui.groupName, SIGNAL(textChanged(QString)), this, SLOT(groupNameChanged(QString)));
|
||||||
|
|
||||||
|
groupNameChanged(ui.groupName->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
CreateGroup::~CreateGroup()
|
CreateGroup::~CreateGroup()
|
||||||
{
|
{
|
||||||
|
Settings->saveWidgetInformation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGroup::on_groupname_textChanged(QString text)
|
void CreateGroup::groupNameChanged(QString text)
|
||||||
{
|
{
|
||||||
if (text.isEmpty() || usedGroupNames.contains(misc::removeNewLine(text))) {
|
if (text.isEmpty() || mUsedGroupNames.contains(misc::removeNewLine(text))) {
|
||||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGroup::on_buttonBox_accepted()
|
void CreateGroup::changeGroup()
|
||||||
{
|
{
|
||||||
RsGroupInfo groupInfo;
|
RsGroupInfo groupInfo;
|
||||||
|
|
||||||
if (m_groupId.empty()) {
|
if (mGroupId.empty()) {
|
||||||
// add new group
|
// add new group
|
||||||
groupInfo.name = misc::removeNewLine(ui.groupname->text()).toUtf8().constData();
|
groupInfo.name = misc::removeNewLine(ui.groupName->text()).toUtf8().constData();
|
||||||
if (rsPeers->addGroup(groupInfo)) {
|
if (!rsPeers->addGroup(groupInfo)) {
|
||||||
close();
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rsPeers->getGroupInfo(m_groupId, groupInfo) == true) {
|
if (rsPeers->getGroupInfo(mGroupId, groupInfo) == true) {
|
||||||
groupInfo.name = misc::removeNewLine(ui.groupname->text()).toUtf8().constData();
|
if (!mIsStandard) {
|
||||||
if (rsPeers->editGroup(m_groupId, groupInfo)) {
|
groupInfo.name = misc::removeNewLine(ui.groupName->text()).toUtf8().constData();
|
||||||
close();
|
if (!rsPeers->editGroup(mGroupId, groupInfo)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::list<std::string> gpgIds;
|
||||||
|
ui.friendList->selectedGpgIds(gpgIds, true);
|
||||||
|
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
for (it = groupInfo.peerIds.begin(); it != groupInfo.peerIds.end(); ++it) {
|
||||||
|
std::list<std::string>::iterator gpgIt = std::find(gpgIds.begin(), gpgIds.end(), *it);
|
||||||
|
if (gpgIt == gpgIds.end()) {
|
||||||
|
rsPeers->assignPeerToGroup(groupInfo.id, *it, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpgIds.erase(gpgIt);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (it = gpgIds.begin(); it != gpgIds.end(); ++it) {
|
||||||
|
rsPeers->assignPeerToGroup(groupInfo.id, *it, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
|
|
@ -19,39 +19,32 @@
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _CREATEGROUP_H
|
#ifndef _CREATEGROUP_H
|
||||||
#define _CREATEGROUP_H
|
#define _CREATEGROUP_H
|
||||||
|
|
||||||
#include "ui_CreateGroup.h"
|
#include "ui_CreateGroup.h"
|
||||||
|
|
||||||
|
|
||||||
class CreateGroup : public QDialog
|
class CreateGroup : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
CreateGroup(const std::string groupId, QWidget *parent = 0);
|
CreateGroup(const std::string &groupId, QWidget *parent = 0);
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
~CreateGroup();
|
~CreateGroup();
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void changeGroup();
|
||||||
|
void groupNameChanged(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_groupId;
|
std::string mGroupId;
|
||||||
|
QStringList mUsedGroupNames;
|
||||||
QStringList usedGroupNames;
|
bool mIsStandard;
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::CreateGroup ui;
|
Ui::CreateGroup ui;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_buttonBox_accepted();
|
|
||||||
void on_groupname_textChanged(QString );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>386</width>
|
<width>386</width>
|
||||||
<height>158</height>
|
<height>298</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -27,77 +27,55 @@
|
||||||
<widget class="HeaderFrame" name="headerFrame"/>
|
<widget class="HeaderFrame" name="headerFrame"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QFrame" name="frame_2">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<layout class="QGridLayout">
|
<layout class="QHBoxLayout" name="groupLayout">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<property name="margin">
|
||||||
<widget class="QLabel" name="label">
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="groupLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Group Name</string>
|
<string>Group Name</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item>
|
||||||
<widget class="QLineEdit" name="groupname">
|
<widget class="QLineEdit" name="groupName">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enter a name for your group</string>
|
<string>Enter a name for your group</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" rowspan="2">
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="FriendSelectionWidget" name="friendList" native="true">
|
||||||
<property name="orientation">
|
<property name="sizePolicy">
|
||||||
<enum>Qt::Vertical</enum>
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>208</width>
|
|
||||||
<height>21</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -110,24 +88,13 @@
|
||||||
<header>gui/common/HeaderFrame.h</header>
|
<header>gui/common/HeaderFrame.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>FriendSelectionWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/FriendSelectionWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections/>
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>CreateGroup</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>338</x>
|
|
||||||
<y>116</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>192</x>
|
|
||||||
<y>78</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -209,6 +209,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
||||||
/* initialize friends list */
|
/* initialize friends list */
|
||||||
ui.friendSelectionWidget->setHeaderText(tr("Send To:"));
|
ui.friendSelectionWidget->setHeaderText(tr("Send To:"));
|
||||||
ui.friendSelectionWidget->setModus(FriendSelectionWidget::MODUS_MULTI);
|
ui.friendSelectionWidget->setModus(FriendSelectionWidget::MODUS_MULTI);
|
||||||
|
ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||||
ui.friendSelectionWidget->start();
|
ui.friendSelectionWidget->start();
|
||||||
|
|
||||||
QActionGroup *grp = new QActionGroup(this);
|
QActionGroup *grp = new QActionGroup(this);
|
||||||
|
|
|
@ -2787,6 +2787,10 @@ p, li { white-space: pre-wrap; }
|
||||||
<source>Edit Group</source>
|
<source>Edit Group</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Friends</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CreateLobbyDialog</name>
|
<name>CreateLobbyDialog</name>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue