fixed auto-expanding of nodes in friend list

This commit is contained in:
csoler 2017-03-01 21:18:16 +01:00
parent 91f2cf720f
commit 006e5423db
2 changed files with 31 additions and 31 deletions

View file

@ -122,6 +122,8 @@ FriendList::FriendList(QWidget *parent) :
connect(ui->peerTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(peerTreeWidgetCustomPopupMenu())); connect(ui->peerTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(peerTreeWidgetCustomPopupMenu()));
connect(ui->peerTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(chatfriend(QTreeWidgetItem *))); connect(ui->peerTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(chatfriend(QTreeWidgetItem *)));
connect(ui->peerTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(expandItem(QTreeWidgetItem *)));
connect(ui->peerTreeWidget, SIGNAL(itemCollapsed(QTreeWidgetItem *)), this, SLOT(collapseItem(QTreeWidgetItem *)));
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged())); connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged()));
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(insertPeers())); connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(insertPeers()));
@ -1267,40 +1269,36 @@ bool FriendList::getExpandedPeers(std::set<RsPgpId> &peers) const
return true; return true;
} }
///** Open a QFileDialog to browse for export a file. */ void FriendList::collapseItem(QTreeWidgetItem *item)
//void FriendList::exportfriend() {
//{ switch (item->type())
// QTreeWidgetItem *c = getCurrentPeer(); {
case TYPE_GROUP:
//#ifdef FRIENDS_DEBUG openGroups.erase(RsNodeGroupId(getRsId(item))) ;
// std::cerr << "FriendList::exportfriend()" << std::endl; break;
//#endif case TYPE_GPG:
// if (!c) openPeers.erase(RsPgpId(getRsId(item))) ;
// { default:
//#ifdef FRIENDS_DEBUG break;
// std::cerr << "FriendList::exportfriend() None Selected -- sorry" << std::endl; }
//#endif }
// return; void FriendList::expandItem(QTreeWidgetItem *item)
// } {
switch (item->type())
// std::string id = getPeerRsCertId(c); {
case TYPE_GROUP:
// if (misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT, tr("Save Certificate"), tr("Certificates (*.pqi)"), fileName)) openGroups.insert(RsNodeGroupId(getRsId(item))) ;
// { break;
//#ifdef FRIENDS_DEBUG case TYPE_GPG:
// std::cerr << "FriendList::exportfriend() Saving to: " << fileName.toStdString() << std::endl; openPeers.insert(RsPgpId(getRsId(item))) ;
//#endif default:
// if (rsPeers) break;
// { }
// rsPeers->saveCertificateToFile(id, fileName.toUtf8().constData()); }
// }
// }
//}
void FriendList::chatfriendproxy() void FriendList::chatfriendproxy()
{ {
chatfriend(getCurrentPeer()); chatfriend(getCurrentPeer());
} }
/** /**

View file

@ -101,6 +101,8 @@ public slots:
private slots: private slots:
void peerTreeColumnVisibleChanged(int column, bool visible); void peerTreeColumnVisibleChanged(int column, bool visible);
void peerTreeItemCollapsedExpanded(QTreeWidgetItem *item); void peerTreeItemCollapsedExpanded(QTreeWidgetItem *item);
void collapseItem(QTreeWidgetItem *item);
void expandItem(QTreeWidgetItem *item);
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);