From 48b16a068f50028386059388798fe073c1c3c7b4 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Mar 2015 22:33:46 +0000 Subject: [PATCH] prevent GXS id chooser from emitting signals when initialised git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-LobbiesWithGXSIds@7984 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/chat/distributedchat.cc | 2 +- retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp | 6 +++--- retroshare-gui/src/gui/gxs/GxsIdChooser.cpp | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index b5722ab98..4f5b70c15 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -1630,7 +1630,7 @@ bool DistributedChatService::setIdentityForChatLobby(const ChatLobbyId& lobby_id return false; } - if (it->second.gxs_id != nick) + if (!it->second.gxs_id.isNull() && it->second.gxs_id != nick) { changed = true; } diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index fbf7e515c..5eb35b93f 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -100,11 +100,11 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi ownIdChooser = new GxsIdChooser() ; ownIdChooser->loadIds(IDCHOOSER_ID_REQUIRED,current_id) ; - connect(ownIdChooser,SIGNAL(currentIndexChanged(int)),this,SLOT(changeNickname())) ; - getChatWidget()->addChatBarWidget(ownIdChooser) ; - unsubscribeButton = new QToolButton ; + connect(ownIdChooser,SIGNAL(currentIndexChanged(int)),this,SLOT(changeNickname())) ; + + unsubscribeButton = new QToolButton ; unsubscribeButton->setMinimumSize(QSize(28,28)) ; unsubscribeButton->setMaximumSize(QSize(28,28)) ; unsubscribeButton->setText(QString()) ; diff --git a/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp b/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp index 22c2e4ccf..25088c8b1 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdChooser.cpp @@ -122,6 +122,10 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail return; } + // this prevents the objects that depend on what's in the combo-box to activate and + // perform any change.Only user-changes should cause this. + chooser->blockSignals(true) ; + QString text = GxsIdDetails::getNameForType(type, details); QString id = QString::fromStdString(details.mId.toStdString()); @@ -156,7 +160,9 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail chooser->setItemData(index, (type == GXS_ID_DETAILS_TYPE_DONE) ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE); chooser->setItemIcon(index, icons.empty() ? QIcon() : icons[0]); - chooser->model()->sort(0); + chooser->model()->sort(0); + + chooser->blockSignals(false) ; } void GxsIdChooser::loadPrivateIds(uint32_t token)