cleanup up the code in FriendList, and fixed bug causing own locations not to show

This commit is contained in:
csoler 2019-08-20 14:57:44 +02:00
parent b26be4db08
commit 6a62227dba
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
4 changed files with 10 additions and 24 deletions

View File

@ -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<RsPgpId> &gpg_ids) = 0;
virtual bool getGPGSignedList(std::list<RsPgpId> &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<RsPgpId> &gpg_ids) = 0;
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;
virtual bool getGPGSignedList(std::list<RsPgpId> &gpg_ids) = 0;// keys signed by our own PGP key.
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;// all PGP keys without filtering
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;// all PGP keys as well
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "") = 0;

View File

@ -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;

View File

@ -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();

View File

@ -110,7 +110,6 @@ private:
// Settings for peer list display
bool mShowState;
bool groupsHasChanged;
std::set<RsNodeGroupId> openGroups;
std::set<RsPgpId> openPeers;
@ -123,11 +122,8 @@ private:
FriendListSortFilterProxyModel *mProxyModel ;
private slots:
void groupsChanged();
void peerTreeWidgetCustomPopupMenu();
void pastePerson();
void connectNode();
void configureNode();
void configureProfile();