From 6a62227dba44aae47830e7370e3f3c3d01569924 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 20 Aug 2019 14:57:44 +0200 Subject: [PATCH] cleanup up the code in FriendList, and fixed bug causing own locations not to show --- libretroshare/src/retroshare/rspeers.h | 6 +++--- .../src/gui/common/FriendListModel.cpp | 4 +++- .../src/gui/common/NewFriendList.cpp | 20 ++++--------------- retroshare-gui/src/gui/common/NewFriendList.h | 4 ---- 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h index ab5404859..a8f43452e 100644 --- a/libretroshare/src/retroshare/rspeers.h +++ b/libretroshare/src/retroshare/rspeers.h @@ -460,9 +460,9 @@ public: virtual RsPgpId getGPGId(const RsPeerId& sslId) = 0; virtual bool isKeySupported(const RsPgpId& gpg_ids) = 0; virtual bool getGPGAcceptedList(std::list &gpg_ids) = 0; - virtual bool getGPGSignedList(std::list &gpg_ids) = 0;//friends that we accpet to connect with but we don't want to sign their gpg key - virtual bool getGPGValidList(std::list &gpg_ids) = 0; - virtual bool getGPGAllList(std::list &gpg_ids) = 0; + virtual bool getGPGSignedList(std::list &gpg_ids) = 0;// keys signed by our own PGP key. + virtual bool getGPGValidList(std::list &gpg_ids) = 0;// all PGP keys without filtering + virtual bool getGPGAllList(std::list &gpg_ids) = 0;// all PGP keys as well virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list& ids) = 0; virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "") = 0; diff --git a/retroshare-gui/src/gui/common/FriendListModel.cpp b/retroshare-gui/src/gui/common/FriendListModel.cpp index d90dbedd3..91084afeb 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.cpp +++ b/retroshare-gui/src/gui/common/FriendListModel.cpp @@ -993,7 +993,9 @@ void RsFriendListModel::updateInternalData() HierarchicalNodeInformation hnode ; rsPeers->getPeerDetails(*it,hnode.node_info); - auto it2 = checkProfileIndex(hnode.node_info.gpg_id,pgp_indices,mProfiles,false); + // If the Peer ID belong to our own profile, we add our own profile to the list. Otherwise we do not display it in the friend list. + + auto it2 = checkProfileIndex(hnode.node_info.gpg_id,pgp_indices,mProfiles,hnode.node_info.gpg_id == rsPeers->getGPGOwnId()); if(it2 == pgp_indices.end()) continue; diff --git a/retroshare-gui/src/gui/common/NewFriendList.cpp b/retroshare-gui/src/gui/common/NewFriendList.cpp index 97a90fa10..b982fd637 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.cpp +++ b/retroshare-gui/src/gui/common/NewFriendList.cpp @@ -154,11 +154,7 @@ private: bool m_showOfflineNodes; }; -NewFriendList::NewFriendList(QWidget *parent) : - QWidget(parent), - ui(new Ui::NewFriendList()), - // mCompareRole(new RSTreeWidgetItemCompareRole), - groupsHasChanged(false) +NewFriendList::NewFriendList(QWidget *parent) : QWidget(parent), ui(new Ui::NewFriendList()) { ui->setupUi(this); @@ -220,16 +216,13 @@ NewFriendList::NewFriendList(QWidget *parent) : QHeaderView *h = ui->peerTreeWidget->header(); h->setContextMenuPolicy(Qt::CustomContextMenu); -// QTimer *timer = new QTimer; -// QObject::connect(timer,SIGNAL(timeout()),mModel,SLOT(debug_dump())); -// timer->start(2000); - connect(Shortcut, SIGNAL(activated()), this, SLOT(removefriend())); connect(ui->peerTreeWidget->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumn(int,Qt::SortOrder))); connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(toggleSortByState(bool))); - connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), mModel, SLOT(updateInternalData())); connect(ui->peerTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(peerTreeWidgetCustomPopupMenu())); - connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged())); + + connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), mModel, SLOT(updateInternalData())); + connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), mModel, SLOT(updateInternalData())); connect(ui->actionShowOfflineFriends, SIGNAL(triggered(bool)), this, SLOT(setShowUnconnected(bool))); connect(ui->actionShowState, SIGNAL(triggered(bool)), this, SLOT(setShowState(bool))); @@ -628,11 +621,6 @@ void NewFriendList::createNewGroup() createGrpDialog.exec(); } -void NewFriendList::groupsChanged() -{ - groupsHasChanged = true; -} - static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay) { int avatarWidth = avatar.width(); diff --git a/retroshare-gui/src/gui/common/NewFriendList.h b/retroshare-gui/src/gui/common/NewFriendList.h index 60a4a13ee..658914aad 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.h +++ b/retroshare-gui/src/gui/common/NewFriendList.h @@ -110,7 +110,6 @@ private: // Settings for peer list display bool mShowState; - bool groupsHasChanged; std::set openGroups; std::set openPeers; @@ -123,11 +122,8 @@ private: FriendListSortFilterProxyModel *mProxyModel ; private slots: - void groupsChanged(); void peerTreeWidgetCustomPopupMenu(); - void pastePerson(); - void connectNode(); void configureNode(); void configureProfile();