summaryrefslogtreecommitdiff
path: root/net-p2p/retroshare
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-10-24 11:15:24 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-10-24 11:15:24 +0300
commit2a4024f4444a3dc0775b7bc0bcea2d2f122ad275 (patch)
tree528d04371fc5d16913c1aeaf3d59bf512af494a6 /net-p2p/retroshare
parentf0d53737e095ee43be5cf40454c5dcbfa4d25888 (diff)
retroshare: updated pgpid ui patch
Diffstat (limited to 'net-p2p/retroshare')
-rw-r--r--net-p2p/retroshare/files/pgpid_gui_abstractitemmodel.patch444
1 files changed, 183 insertions, 261 deletions
diff --git a/net-p2p/retroshare/files/pgpid_gui_abstractitemmodel.patch b/net-p2p/retroshare/files/pgpid_gui_abstractitemmodel.patch
index 5adb04e..fd86955 100644
--- a/net-p2p/retroshare/files/pgpid_gui_abstractitemmodel.patch
+++ b/net-p2p/retroshare/files/pgpid_gui_abstractitemmodel.patch
@@ -1,5 +1,22 @@
+diff --git a/RetroShare.pro b/RetroShare.pro
+index 833173029..d22af1418 100644
+--- a/RetroShare.pro
++++ b/RetroShare.pro
+@@ -56,12 +56,6 @@ retroshare_qml_app {
+ }
+ }
+
+-retroshare_plugins {
+- SUBDIRS += plugins
+- plugins.file = plugins/plugins.pro
+- plugins.depends = retroshare_gui
+- plugins.target = plugins
+-}
+
+ wikipoos {
+ SUBDIRS += pegmarkdown
diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp
-index bdeda264c..d7b864094 100644
+index bdeda264c..bc5ea3e06 100644
--- a/retroshare-gui/src/gui/NetworkDialog.cpp
+++ b/retroshare-gui/src/gui/NetworkDialog.cpp
@@ -71,7 +71,7 @@
@@ -11,7 +28,7 @@ index bdeda264c..d7b864094 100644
/******
* #define NET_DEBUG 1
-@@ -81,85 +81,69 @@ static const unsigned int ROLE_SORT = Qt::UserRole + 1 ;
+@@ -81,85 +81,64 @@ static const unsigned int ROLE_SORT = Qt::UserRole + 1 ;
/** Constructor */
NetworkDialog::NetworkDialog(QWidget *parent)
@@ -27,13 +44,10 @@ index bdeda264c..d7b864094 100644
connect( ui.filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int)));
- connect( ui.onlyTrustedKeys, SIGNAL(clicked()), this, SLOT(securedUpdateDisplay()));
-+// connect( ui.onlyTrustedKeys, SIGNAL(clicked()), this, SLOT(securedUpdateDisplay()));
-+
-+
-+
-+/* compareNetworkRole = new RSTreeWidgetItemCompareRole;
-+ compareNetworkRole->setRole(COLUMN_LAST_USED, ROLE_SORT); */
-+
+
+- /* hide the Tree +/- */
+- ui.connectTreeWidget -> setRootIsDecorated( false );
+- ui.connectTreeWidget -> setColumnCount(6);
+ //list data model
+ float f = QFontMetricsF(font()).height()/14.0 ;
+ PGPIdItemModel = new pgpid_item_model(neighs, f, this);
@@ -42,6 +56,7 @@ index bdeda264c..d7b864094 100644
+ PGPIdItemProxy->setSourceModel(PGPIdItemModel);
+ PGPIdItemProxy->setFilterKeyColumn(COLUMN_PEERNAME);
+ PGPIdItemProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
++ PGPIdItemProxy->setSortRole(Qt::EditRole); //use edit role to get raw data since we do not have edit for this model.
+ ui.connectTreeWidget->setModel(PGPIdItemProxy);
+ ui.connectTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
+ ui.connectTreeWidget->verticalHeader()->hide();
@@ -51,10 +66,7 @@ index bdeda264c..d7b864094 100644
+ ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+ connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) );
+ connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails()));
-
-- /* hide the Tree +/- */
-- ui.connectTreeWidget -> setRootIsDecorated( false );
-- ui.connectTreeWidget -> setColumnCount(6);
++
- compareNetworkRole = new RSTreeWidgetItemCompareRole;
- compareNetworkRole->setRole(COLUMN_LAST_USED, ROLE_SORT);
@@ -100,14 +112,14 @@ index bdeda264c..d7b864094 100644
- headerItem->setTextAlignment(COLUMN_PEER_AUTH_ME, Qt::AlignHCenter | Qt::AlignVCenter);
- headerItem->setTextAlignment(COLUMN_PEERID, Qt::AlignVCenter);
- headerItem->setTextAlignment(COLUMN_LAST_USED, Qt::AlignVCenter);
-+ ui.onlyTrustedKeys->setMinimumWidth(20*f);
-
+-
- headerItem->setText(0,QString()) ;
++ ui.onlyTrustedKeys->setMinimumWidth(20*f);
- ui.connectTreeWidget->sortItems( COLUMN_PEERNAME, Qt::AscendingOrder );
- ui.onlyTrustedKeys->setMinimumWidth(20*f);
--
+
- QMenu *menu = new QMenu();
+/* QMenu *menu = new QMenu();
menu->addAction(ui.actionTabsright);
@@ -128,7 +140,7 @@ index bdeda264c..d7b864094 100644
}
void NetworkDialog::changeEvent(QEvent *e)
-@@ -177,14 +161,14 @@ void NetworkDialog::changeEvent(QEvent *e)
+@@ -177,14 +156,14 @@ void NetworkDialog::changeEvent(QEvent *e)
void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
{
@@ -148,7 +160,7 @@ index bdeda264c..d7b864094 100644
// That's what context menus are made for
RsPeerDetails detail;
-@@ -271,13 +255,17 @@ void NetworkDialog::removeUnusedKeys()
+@@ -271,13 +250,17 @@ void NetworkDialog::removeUnusedKeys()
}
QMessageBox::warning(NULL,tr("Keyring info"),tr("Key removal has failed. Your keyring remains intact.\n\nReported error:")+" "+error_string ) ;
}
@@ -169,7 +181,7 @@ index bdeda264c..d7b864094 100644
rsPeers->removeFriend(peer_id) ;
securedUpdateDisplay();
-@@ -300,27 +288,32 @@ void NetworkDialog::denyFriend()
+@@ -300,27 +283,32 @@ void NetworkDialog::denyFriend()
void NetworkDialog::makeFriend()
{
@@ -213,7 +225,7 @@ index bdeda264c..d7b864094 100644
QList<RetroShareLink> urls;
RetroShareLink link = RetroShareLink::createPerson(peer_id);
-@@ -356,137 +349,39 @@ void NetworkDialog::copyLink()
+@@ -356,225 +344,14 @@ void NetworkDialog::copyLink()
// /* window will destroy itself! */
//}
@@ -222,36 +234,27 @@ index bdeda264c..d7b864094 100644
- insertConnect() ;
-}
-
- /* get the list of Neighbours from the RsIface. */
+-/* get the list of Neighbours from the RsIface. */
-void NetworkDialog::insertConnect()
-{
-+//void NetworkDialog::insertConnect()
-+//{
- // static time_t last_time = 0 ;
-
+-// static time_t last_time = 0 ;
+-
- if (!rsPeers)
- return;
-
-// // Because this is called from a qt signal, there's no limitation between calls.
- time_t now = time(NULL);
-+// if (!rsPeers)
-+// return;
-
+-
- std::list<RsPgpId> neighs; //these are GPG ids
- std::list<RsPgpId>::iterator it;
- rsPeers->getGPGAllList(neighs);
-+ //these are GPG ids
-+// std::list<RsPgpId>::iterator it;
-+// rsPeers->getGPGAllList(neighs);
-
- /* get a link to the table */
+-
+- /* get a link to the table */
- QTreeWidget *connectWidget = ui.connectTreeWidget;
-+// QTreeView *connectWidget = ui.connectTreeWidget;
- /* disable sorting while editing the table */
+- /* disable sorting while editing the table */
- connectWidget->setSortingEnabled(false);
-+// connectWidget->setSortingEnabled(false);
-
- //remove items
+-
+- //remove items
- int index = 0;
- while (index < connectWidget->topLevelItemCount())
- {
@@ -262,14 +265,11 @@ index bdeda264c..d7b864094 100644
- else
- ++index;
- }
-+// int index = 0;
-
+-
- for(it = neighs.begin(); it != neighs.end(); ++it)
- {
-+/* for(it = neighs.begin(); it != neighs.end(); ++it)
-+ {
- #ifdef NET_DEBUG
- std::cerr << "NetworkDialog::insertConnect() inserting gpg key : " << *it << std::endl;
+-#ifdef NET_DEBUG
+- std::cerr << "NetworkDialog::insertConnect() inserting gpg key : " << *it << std::endl;
-#endif
- if (*it == rsPeers->getGPGOwnId()) {
- continue;
@@ -350,91 +350,94 @@ index bdeda264c..d7b864094 100644
-
- item->setText(COLUMN_LAST_USED,lst_used_str) ;
- item->setData(COLUMN_LAST_USED,ROLE_SORT,lst_used_sort_str) ;
-+#endif */
-
- /**
- * Determinated the Background Color
- */
+-
+- /**
+- * Determinated the Background Color
+- */
- QColor backgrndcolor;
-+/* QColor backgrndcolor;
-
- if (detail.accept_connection)
- {
+-
+- if (detail.accept_connection)
+- {
- item -> setText(COLUMN_CHECK, "0");
- item -> setIcon(COLUMN_CHECK,(QIcon(IMAGE_AUTHED)));
- if (detail.ownsign)
- {
- backgrndcolor = backgroundColorOwnSign();
-@@ -498,19 +393,14 @@ void NetworkDialog::insertConnect()
- }
- else
- {
+- if (detail.ownsign)
+- {
+- backgrndcolor = backgroundColorOwnSign();
+- }
+- else
+- {
+- backgrndcolor = backgroundColorAcceptConnection();
+- }
+- }
+- else
+- {
- item -> setText(COLUMN_CHECK, "1");
-
- if (detail.hasSignedMe)
- {
- backgrndcolor = backgroundColorHasSignedMe();
+-
+- if (detail.hasSignedMe)
+- {
+- backgrndcolor = backgroundColorHasSignedMe();
- item -> setIcon(COLUMN_CHECK,(QIcon(IMAGE_DENIED)));
- for(int k=0;k<COLUMN_COUNT;++k)
- item -> setToolTip(k, QString::fromUtf8(detail.name.c_str()) + tr(" has authenticated you. \nRight-click and select 'make friend' to be able to connect."));
- }
- else
- {
- backgrndcolor = backgroundColorDenied();
+- }
+- else
+- {
+- backgrndcolor = backgroundColorDenied();
- item -> setIcon(COLUMN_CHECK,(QIcon(IMAGE_DENIED)));
- }
- }
-
-@@ -520,14 +410,14 @@ void NetworkDialog::insertConnect()
- item -> setBackground(i,QBrush(backgrndcolor));
-
- if( (detail.accept_connection || detail.validLvl >= RS_TRUST_LVL_MARGINAL) || !ui.onlyTrustedKeys->isChecked())
+- }
+- }
+-
+- // Color each Background column in the Network Tab except the first one => 1-9
+- // whith the determinated color
+- for(int i = 0; i <COLUMN_COUNT; ++i)
+- item -> setBackground(i,QBrush(backgrndcolor));
+-
+- if( (detail.accept_connection || detail.validLvl >= RS_TRUST_LVL_MARGINAL) || !ui.onlyTrustedKeys->isChecked())
- connectWidget->addTopLevelItem(item);
- }
-+ connectWidget->addTopLevelItem(item); */
-+// }
-
- // add self to network.
+-
+- // add self to network.
- RsPeerDetails ownGPGDetails;
- rsPeers->getGPGDetails(rsPeers->getGPGOwnId(), ownGPGDetails);
-+// RsPeerDetails ownGPGDetails;
-+// rsPeers->getGPGDetails(rsPeers->getGPGOwnId(), ownGPGDetails);
- /* make a widget per friend */
+- /* make a widget per friend */
- QTreeWidgetItem *self_item;
-+/* QTreeWidgetItem *self_item;
- QList<QTreeWidgetItem *> list = connectWidget->findItems(QString::fromStdString(ownGPGDetails.gpg_id.toStdString()), Qt::MatchExactly, COLUMN_PEERID);
- if (list.size() == 1) {
- self_item = list.front();
-@@ -546,35 +436,26 @@ void NetworkDialog::insertConnect()
- {
- self_item->setBackground(i,backgroundColorSelf()) ;
- }
+- QList<QTreeWidgetItem *> list = connectWidget->findItems(QString::fromStdString(ownGPGDetails.gpg_id.toStdString()), Qt::MatchExactly, COLUMN_PEERID);
+- if (list.size() == 1) {
+- self_item = list.front();
+- } else {
+- self_item = new RSTreeWidgetItem(compareNetworkRole, 0);
+- self_item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
+- }
+- self_item -> setText(COLUMN_CHECK, "0");
+- self_item->setIcon(COLUMN_CHECK,(QIcon(IMAGE_AUTHED)));
+- self_item->setText(COLUMN_PEERNAME, QString::fromUtf8(ownGPGDetails.name.c_str()) + " (" + tr("yourself") + ")");
+- self_item->setText(COLUMN_I_AUTH_PEER,"N/A");
+- self_item->setText(COLUMN_PEERID, QString::fromStdString(ownGPGDetails.gpg_id.toStdString()));
+-
+- // Color each Background column in the Network Tab except the first one => 1-9
+- for(int i=0;i<COLUMN_COUNT;++i)
+- {
+- self_item->setBackground(i,backgroundColorSelf()) ;
+- }
- connectWidget->addTopLevelItem(self_item);
-+ connectWidget->addTopLevelItem(self_item); */
-
- /* enable sorting */
+-
+- /* enable sorting */
- connectWidget->setSortingEnabled(true);
-+// connectWidget->setSortingEnabled(true);
- /* update display */
+- /* update display */
- connectWidget->update();
-
- if (ui.filterLineEdit->text().isEmpty() == false) {
- filterItems(ui.filterLineEdit->text());
- }
-+// connectWidget->update();
-
+-
-}
-+// if (ui.filterLineEdit->text().isEmpty() == false) {
-+// filterItems(ui.filterLineEdit->text());
-+// }
-
+-
-QTreeWidgetItem *NetworkDialog::getCurrentNeighbour()
-{
- if (ui.connectTreeWidget->selectedItems().size() != 0)
- {
- return ui.connectTreeWidget -> currentItem();
- }
-+//}
- return NULL;
-}
@@ -450,7 +453,7 @@ index bdeda264c..d7b864094 100644
void NetworkDialog::on_actionAddFriend_activated()
{
// /* Create a new input dialog, which allows users to create files, too */
-@@ -700,12 +581,14 @@ void NetworkDialog::on_actionCreate_New_Profile_activated()
+@@ -700,44 +477,23 @@ void NetworkDialog::on_actionCreate_New_Profile_activated()
// Settings->endGroup();
// }
@@ -464,30 +467,41 @@ index bdeda264c..d7b864094 100644
}
-void NetworkDialog::filterItems(const QString &text)
-+/*void NetworkDialog::filterItems(const QString &text)
- {
- int filterColumn = ui.filterLineEdit->currentFilter();
+-{
+- int filterColumn = ui.filterLineEdit->currentFilter();
-@@ -713,9 +596,9 @@ void NetworkDialog::filterItems(const QString &text)
- for (int index = 0; index < count; ++index) {
- filterItem(ui.connectTreeWidget->topLevelItem(index), text, filterColumn);
- }
+- int count = ui.connectTreeWidget->topLevelItemCount ();
+- for (int index = 0; index < count; ++index) {
+- filterItem(ui.connectTreeWidget->topLevelItem(index), text, filterColumn);
+- }
-}
-+}*/
-bool NetworkDialog::filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn)
-+/*bool NetworkDialog::filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn)
- {
- bool visible = true;
-
-@@ -740,4 +623,16 @@ bool NetworkDialog::filterItem(QTreeWidgetItem *item, const QString &text, int f
- }
-
- return (visible || visibleChildCount);
-+} */
-+
+void NetworkDialog::updateDisplay()
-+{
+ {
+- bool visible = true;
+-
+- if (text.isEmpty() == false) {
+- if (item->text(filterColumn).contains(text, Qt::CaseInsensitive) == false) {
+- visible = false;
+- }
+- }
+-
+- int visibleChildCount = 0;
+- int count = item->childCount();
+- for (int index = 0; index < count; ++index) {
+- if (filterItem(item->child(index), text, filterColumn)) {
+- ++visibleChildCount;
+- }
+- }
+-
+- if (visible || visibleChildCount) {
+- item->setHidden(false);
+- } else {
+- item->setHidden(true);
+- }
+-
+- return (visible || visibleChildCount);
+ if (!rsPeers)
+ return;
+ //update ids list
@@ -653,10 +667,10 @@ index 3c0fb4c93..833fb542b 100644
</item>
diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp
new file mode 100644
-index 000000000..e6f9eaa90
+index 000000000..f6aa948c0
--- /dev/null
+++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp
-@@ -0,0 +1,375 @@
+@@ -0,0 +1,342 @@
+#include "pgpid_item_model.h"
+#include <retroshare/rspeers.h>
+#include <QIcon>
@@ -666,7 +680,7 @@ index 000000000..e6f9eaa90
+#define IMAGE_TRUSTED ":/images/rs-2.png"
+
+/*TODO:
-+ * using list here for internal data storage is not best options
++ * using list here for internal data storage is not best option
+*/
+pgpid_item_model::pgpid_item_model(std::list<RsPgpId> &neighs_, float &_font_height, QObject *parent)
+ : QAbstractTableModel(parent), neighs(neighs_), font_height(_font_height)
@@ -754,26 +768,6 @@ index 000000000..e6f9eaa90
+ return QVariant();
+}
+
-+/*QModelIndex pgpid_item_model::index(int row, int column, const QModelIndex &parent) const
-+{
-+ return createIndex(row, column);
-+}*/
-+
-+/*QModelIndex pgpid_item_model::parent(const QModelIndex &index) const
-+{
-+ if(index.row() > -1 && index.column() > -1)
-+ return createIndex(-1, -1);
-+ if (!index.isValid())
-+ return QModelIndex();
-+ return QModelIndex();
-+}*/
-+
-+/*bool pgpid_item_model::hasChildren(const QModelIndex &parent) const
-+{
-+ if(parent.column() == -1 && parent.row() == -1)
-+ return true;
-+ return false;
-+} */
+
+int pgpid_item_model::rowCount(const QModelIndex &/*parent*/) const
+{
@@ -785,20 +779,6 @@ index 000000000..e6f9eaa90
+ return COLUMN_COUNT;
+}
+
-+//bool pgpid_item_model::insertRows(int position, int rows, const QModelIndex &/*index*/)
-+//{
-+// beginInsertRows(QModelIndex(), position, position+rows-1);
-+// endInsertRows();
-+// return true;
-+//}
-+
-+//bool pgpid_item_model::removeRows(int position, int rows, const QModelIndex &/*index*/)
-+//{
-+// beginRemoveRows(QModelIndex(), position, position+rows-1);
-+// endRemoveRows();
-+// return true;
-+//}
-+
+
+QVariant pgpid_item_model::data(const QModelIndex &index, int role) const
+{
@@ -818,7 +798,32 @@ index 000000000..e6f9eaa90
+ if (!rsPeers->getGPGDetails(*it, detail))
+ return QVariant();
+ //shit code end
-+ if(role == Qt::DisplayRole)
++ if(role == Qt::EditRole) //some columns return raw data for editrole, used for proper filtering
++ {
++ switch(index.column())
++ {
++ case COLUMN_LAST_USED:
++ return detail.lastUsed;
++ break;
++ case COLUMN_I_AUTH_PEER:
++ {
++ if (detail.ownsign)
++ return RS_TRUST_LVL_ULTIMATE;
++ return detail.trustLvl;
++ }
++ break;
++ case COLUMN_PEER_AUTH_ME:
++ return detail.hasSignedMe;
++ break;
++ case COLUMN_CHECK:
++ return detail.accept_connection;
++ break;
++ default:
++ break;
++ }
++
++ }
++ if(role == Qt::DisplayRole || role == Qt::EditRole)
+ {
+ switch(index.column())
+ {
@@ -870,10 +875,8 @@ index 000000000..e6f9eaa90
+ else
+ lst_used_str = tr("%1 days ago").arg((int)( last_time_used / 86400 )) ;
+
-+// QString lst_used_sort_str = QString::number(detail.lastUsed,'f',10);
+
+ return lst_used_str;
-+// item->setData(COLUMN_LAST_USED,ROLE_SORT,lst_used_sort_str) ;
+ }
+ break;
+ case COLUMN_CHECK:
@@ -950,11 +953,6 @@ index 000000000..e6f9eaa90
+ return QVariant();
+}
+
-+/*void pgpid_item_model::sort(int column, Qt::SortOrder order)
-+{
-+
-+} */
-+
+
+//following code is just a poc, it's still suboptimal, unefficient, but much better then existing rs code
+
@@ -965,27 +963,11 @@ index 000000000..e6f9eaa90
+ size_t old_size = neighs.size(), new_size = 0;
+ std::list<RsPgpId> old_neighs = neighs;
+
-+ //find all bad elements in list
-+ std::list<RsPgpId> bad_elements;
-+ for(std::list<RsPgpId>::iterator it = new_neighs.begin(); it != new_neighs.end(); ++it)
-+ {
-+ if (*it == rsPeers->getGPGOwnId())
-+ bad_elements.push_back(*it);
-+ RsPeerDetails detail;
-+ if (!rsPeers->getGPGDetails(*it, detail))
-+ bad_elements.push_back(*it);
-+
-+ }
-+ //remove all bad elements from list
-+ for(std::list<RsPgpId>::iterator it = bad_elements.begin(); it != bad_elements.end(); ++it)
-+ {
-+ std::list<RsPgpId>::iterator it2 = std::find(new_neighs.begin(), new_neighs.end(), *it);
-+ if(it2 != new_neighs.end())
-+ new_neighs.remove(*it2);
-+ }
+ new_size = new_neighs.size();
+ //set model data to new cleaned up data
+ neighs = new_neighs;
++ neighs.sort();
++ neighs.unique(); //remove possible dups
+
+ //reflect actual row count in model
+ if(old_size < new_size)
@@ -1001,7 +983,6 @@ index 000000000..e6f9eaa90
+ endRemoveRows();
+ }
+ //update data in ui, to avoid unnecessary redraw and ui updates, updating only changed elements
-+ //i guessing what order is unchanged between rsPeers->getGPGAllList() calls
+ //TODO: libretroshare should implement a way to obtain only changed elements via some signalling non-blocking api.
+ {
+ size_t ii1 = 0;
@@ -1034,10 +1015,10 @@ index 000000000..e6f9eaa90
+
diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h
new file mode 100644
-index 000000000..84bae523b
+index 000000000..8dc31d276
--- /dev/null
+++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h
-@@ -0,0 +1,48 @@
+@@ -0,0 +1,40 @@
+#ifndef KEY_ITEM_MODEL_H
+#define KEY_ITEM_MODEL_H
+
@@ -1063,20 +1044,12 @@ index 000000000..84bae523b
+ // Header:
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+
-+ // Basic functionality:
-+// QModelIndex index(int row, int column,
-+// const QModelIndex &parent = QModelIndex()) const override;
-+// QModelIndex parent(const QModelIndex &index) const override;
-+// bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
-+// bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
-+// bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+
-+// void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
+public slots:
+ void data_updated(std::list<RsPgpId> &new_neighs);
+
@@ -1088,10 +1061,10 @@ index 000000000..84bae523b
+#endif // KEY_ITEM_MODEL_H
diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.cpp b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.cpp
new file mode 100644
-index 000000000..5df377f5a
+index 000000000..6fb62dd78
--- /dev/null
+++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.cpp
-@@ -0,0 +1,91 @@
+@@ -0,0 +1,48 @@
+#include "pgpid_item_proxy.h"
+
+//TODO: include only required headers here
@@ -1114,54 +1087,11 @@ index 000000000..5df377f5a
+
+
+pgpid_item_proxy::pgpid_item_proxy(QObject *parent) :
-+ //QAbstractProxyModel(parent)
+ QSortFilterProxyModel(parent)
+{
+
+}
+
-+
-+/*QModelIndex pgpid_item_proxy::mapFromSource(const QModelIndex &sourceIndex) const
-+{
-+ if(sourceIndex.isValid())
-+ return createIndex(sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer());
-+ else
-+ return QModelIndex();
-+}
-+
-+
-+QModelIndex pgpid_item_proxy::mapToSource(const QModelIndex &proxyIndex) const
-+{
-+ if(proxyIndex.isValid())
-+ return sourceModel()->index(proxyIndex.row(), proxyIndex.column());
-+ else
-+ return QModelIndex();}
-+
-+
-+QModelIndex pgpid_item_proxy::index(int row, int column, const QModelIndex &parent) const
-+{
-+ const QModelIndex sourceParent = mapToSource(parent);
-+ const QModelIndex sourceIndex = sourceModel()->index(row, column, sourceParent);
-+ return mapFromSource(sourceIndex);
-+}
-+
-+QModelIndex pgpid_item_proxy::parent(const QModelIndex &child) const
-+{
-+ const QModelIndex sourceIndex = mapToSource(child);
-+ const QModelIndex sourceParent = sourceIndex.parent();
-+ return mapFromSource(sourceParent);
-+}
-+int pgpid_item_proxy::rowCount(const QModelIndex &parent) const
-+{
-+ //TODO:
-+ return sourceModel()->rowCount(parent);
-+}
-+int pgpid_item_proxy::columnCount(const QModelIndex &parent) const
-+{
-+ return sourceModel()->columnCount(parent);
-+}
-+*/
-+
+void pgpid_item_proxy::use_only_trusted_keys(bool val)
+{
+ only_trusted_keys = val;
@@ -1185,30 +1115,22 @@ index 000000000..5df377f5a
+}
diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h
new file mode 100644
-index 000000000..5713ad7c9
+index 000000000..e67eeeee8
--- /dev/null
+++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h
-@@ -0,0 +1,29 @@
+@@ -0,0 +1,21 @@
+#ifndef PGPID_ITEM_PROXY_H
+#define PGPID_ITEM_PROXY_H
+
+#include <QSortFilterProxyModel>
+
+class pgpid_item_proxy :
-+ //public QAbstractProxyModel
+ public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+ pgpid_item_proxy(QObject *parent = nullptr);
-+/* virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
-+ QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
-+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
-+ QModelIndex parent(const QModelIndex &child) const;
-+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
-+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
-+*/
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
+public slots:
+ void use_only_trusted_keys(bool val);
@@ -1232,24 +1154,24 @@ index 2430a1984..8dfa43c48 100644
QObject::connect(notify,SIGNAL(errorOccurred(int,int,const QString&)),w,SLOT(displayErrorMessage(int,int,const QString&))) ;
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
-index 6b3211392..69fbbc93c 100644
+index 6b3211392..40087943a 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
-@@ -558,6 +558,8 @@ HEADERS += rshare.h \
- gui/feeds/SecurityItem.h \
- gui/feeds/SecurityIpItem.h \
+@@ -560,6 +560,8 @@ HEADERS += rshare.h \
gui/feeds/NewsFeedUserNotify.h \
-+ gui/NetworkDialog/pgpid_item_model.h \
-+ gui/NetworkDialog/pgpid_item_proxy.h \
gui/connect/ConnectFriendWizard.h \
gui/connect/ConnectProgressDialog.h \
++ gui/NetworkDialog/pgpid_item_model.h \
++ gui/NetworkDialog/pgpid_item_proxy.h \
gui/groups/CreateGroup.h \
-@@ -911,6 +913,8 @@ SOURCES += main.cpp \
- gui/connect/ConnectProgressDialog.cpp \
+ gui/GetStartedDialog.h \
+ gui/statistics/BWGraph.h \
+@@ -912,6 +914,8 @@ SOURCES += main.cpp \
gui/connect/FriendRecommendDialog.cpp \
gui/groups/CreateGroup.cpp \
-+ gui/NetworkDialog/pgpid_item_model.cpp \
-+ gui/NetworkDialog/pgpid_item_proxy.cpp \
gui/GetStartedDialog.cpp \
++ gui/NetworkDialog/pgpid_item_model.cpp \
++ gui/NetworkDialog/pgpid_item_proxy.cpp \
gui/statistics/BandwidthGraphWindow.cpp \
gui/statistics/BandwidthStatsWidget.cpp \
+ gui/statistics/DhtWindow.cpp \