From 9017db479726a42fb6121682784c077410e4219d Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 19 Jan 2019 15:54:07 +0100 Subject: [PATCH 1/2] added identity creation time in IdDetails --- libretroshare/src/retroshare/rsidentity.h | 2 + libretroshare/src/services/p3idservice.cc | 1 + retroshare-gui/src/gui/Identity/IdDialog.cpp | 5 + retroshare-gui/src/gui/Identity/IdDialog.ui | 210 ++++++++++--------- 4 files changed, 118 insertions(+), 100 deletions(-) diff --git a/libretroshare/src/retroshare/rsidentity.h b/libretroshare/src/retroshare/rsidentity.h index 6ad72bb18..b7895ad44 100644 --- a/libretroshare/src/retroshare/rsidentity.h +++ b/libretroshare/src/retroshare/rsidentity.h @@ -315,6 +315,7 @@ struct RsIdentityDetails : RsSerializable RsGxsImage mAvatar; + rstime_t mPublishTS; rstime_t mLastUsageTS; std::map mUseCases; @@ -329,6 +330,7 @@ struct RsIdentityDetails : RsSerializable RS_SERIAL_PROCESS(mPgpId); //RS_SERIAL_PROCESS(mReputation); //RS_SERIAL_PROCESS(mAvatar); + RS_SERIAL_PROCESS(mPublishTS); RS_SERIAL_PROCESS(mLastUsageTS); RS_SERIAL_PROCESS(mUseCases); } diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 91b89520b..10650b800 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -703,6 +703,7 @@ bool p3IdService::getIdDetails(const RsGxsId &id, RsIdentityDetails &details) details.mLastUsageTS = it->second.TS ; details.mUseCases = it->second.usage_map ; } + details.mPublishTS = data.mPublishTs; // one utf8 symbol can be at most 4 bytes long - would be better to measure real unicode length !!! if(details.mNickname.length() > RSID_MAXIMUM_NICKNAME_SIZE*4) diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 2f22229d7..47a0f3919 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -175,6 +176,7 @@ IdDialog::IdDialog(QWidget *parent) : mStateHelper->addClear(IDDIALOG_IDLIST, ui->idTreeWidget); mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname); + mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_PublishTS); mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId); mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_Type); mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId); @@ -190,6 +192,7 @@ IdDialog::IdDialog(QWidget *parent) : mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->label_negative); mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname); + mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_PublishTS); mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId); mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_Type); mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId); @@ -200,6 +203,7 @@ IdDialog::IdDialog(QWidget *parent) : mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->usageStatistics_TB); mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname); + mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_PublishTS); mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId); mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_Type); mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId); @@ -1768,6 +1772,7 @@ void IdDialog::insertIdDetails(uint32_t token) /* get GPG Details from rsPeers */ RsPgpId ownPgpId = rsPeers->getGPGOwnId(); + ui->lineEdit_PublishTS->setText(QDateTime::fromSecsSinceEpoch(data.mMeta.mPublishTs).toString(Qt::SystemLocaleShortDate)); ui->lineEdit_Nickname->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE)); ui->lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId.toStdString())); //ui->lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString())); diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index 4e449cfa0..57cb05e0a 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -284,7 +284,7 @@ 0 0 1372 - 1000 + 999 @@ -526,39 +526,25 @@ border-image: url(:/images/closepressed.png) Identity info - - - - - <html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html> + + + + + true true - + Your opinion: - - - - Ban-option: - - - - - - - Qt::Horizontal - - - - + <html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html> @@ -568,7 +554,41 @@ border-image: url(:/images/closepressed.png) - + + + + Last used: + + + + + + + + + + Identity name : + + + + + + + Qt::Horizontal + + + + + + + true + + + true + + + + @@ -625,71 +645,31 @@ p, li { white-space: pre-wrap; } - - - - Auto-Ban all identities signed by the same node - - + + - - - - Friend votes: - - - - - - - - 75 - true - - - - Overall: - - - - - - - true - - - true - - - - + Type: - - - - true - - - true - - - - - - - - + + - Identity name : + Owner node name : - + + + + Owner node ID : + + + + true @@ -699,29 +679,39 @@ p, li { white-space: pre-wrap; } - - + + - Last used: + Ban-option: - - + + - Owner node name : + Friend votes: - - - - Owner node ID : + + + + <html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html> + + + true - - + + + + Auto-Ban all identities signed by the same node + + + + + true @@ -730,17 +720,7 @@ p, li { white-space: pre-wrap; } - - - - Identity ID : - - - - - - - + @@ -883,6 +863,36 @@ p, li { white-space: pre-wrap; } + + + + + 75 + true + + + + Overall: + + + + + + + Identity ID : + + + + + + + Created on : + + + + + + From 0816c44d100ec487870b1b404306c9b9fad4d6f6 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 27 Jan 2019 20:03:23 +0100 Subject: [PATCH 2/2] fixed bug causing link to forum post not to load the post on click if another forum is currently loaed --- .../gui/gxsforums/GxsForumThreadWidget.cpp | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 8c2b7acd7..558715faa 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1500,6 +1500,8 @@ bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId) if(!source_index.isValid()) { + std::cerr << "Cannot navigate to msg " << msgId << " in forum " << mForumGroup.mMeta.mGroupId << ": index unknown. Setting mNavigatePendingMsgId." << std::endl; + mNavigatePendingMsgId = msgId; // not found. That means the forum may not be loaded yet. So we keep that post in mind, for after loading. return true; // we have to return true here, otherwise the caller will intepret the async loading as an error. } @@ -1855,32 +1857,43 @@ void GxsForumThreadWidget::postForumLoading() #endif if(!mNavigatePendingMsgId.isNull() && mThreadModel->getIndexOfMessage(mNavigatePendingMsgId).isValid()) { - mThreadId = mNavigatePendingMsgId; - mNavigatePendingMsgId.clear(); - } + std::cerr << "Pending msg navigation: " << mNavigatePendingMsgId << ". Using it as new thread Id" << std::endl; - QModelIndex source_index = mThreadModel->getIndexOfMessage(mThreadId); - - if(!mThreadId.isNull() && source_index.isValid()) - { + QModelIndex source_index = mThreadModel->getIndexOfMessage(mNavigatePendingMsgId); QModelIndex index = mThreadProxyModel->mapFromSource(source_index); + ui->threadTreeWidget->selectionModel()->setCurrentIndex(index,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); ui->threadTreeWidget->scrollTo(index); -#ifdef DEBUG_FORUMS - std::cerr << " re-selecting index of message " << mThreadId << " to " << source_index.row() << "," << source_index.column() << " " << (void*)source_index.internalPointer() << std::endl; -#endif + + changedThread(index); + mNavigatePendingMsgId.clear(); } - else - { + else + { + + QModelIndex source_index = mThreadModel->getIndexOfMessage(mThreadId); + + if(!mThreadId.isNull() && source_index.isValid()) + { + QModelIndex index = mThreadProxyModel->mapFromSource(source_index); + ui->threadTreeWidget->selectionModel()->setCurrentIndex(index,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + ui->threadTreeWidget->scrollTo(index); #ifdef DEBUG_FORUMS - std::cerr << " previously message " << mThreadId << " not visible anymore -> de-selecting" << std::endl; + std::cerr << " re-selecting index of message " << mThreadId << " to " << source_index.row() << "," << source_index.column() << " " << (void*)source_index.internalPointer() << std::endl; #endif - ui->threadTreeWidget->selectionModel()->clear(); - ui->threadTreeWidget->selectionModel()->reset(); - mThreadId.clear(); - //blank(); - } - // we also need to restore expanded threads + } + else + { +#ifdef DEBUG_FORUMS + std::cerr << " previously message " << mThreadId << " not visible anymore -> de-selecting" << std::endl; +#endif + ui->threadTreeWidget->selectionModel()->clear(); + ui->threadTreeWidget->selectionModel()->reset(); + mThreadId.clear(); + //blank(); + } + // we also need to restore expanded threads + } ui->forumName->setText(QString::fromUtf8(mForumGroup.mMeta.mGroupName.c_str())); ui->threadTreeWidget->sortByColumn(RsGxsForumModel::COLUMN_THREAD_DATE, Qt::DescendingOrder);