Improve Contacts: sorting, searching and unread

ChatHandler::handleUnreadMsgs(...) deprecate 'id' field
  in favour of 'chat_id'
IdentityHandler::handleWildcard(...) reduce sleep time from 500 to 50 ms
IdentityHandler::handleWildcard(...) expose 'is_contact' to JSON API
Split contacts list delegate into GxsIdentityDelegate.qml
Update to QtQuick.Controls 2.0 because 1.4 is not supported anymore and
  2.1 is not available yet in Qt 5.7.1
ChatView.qml mark messages as read
Set refreshTimer.triggeredOnStart=true to improve reponsiveness of views
Contacts.qml use a Popup that is available in Controls 2.0 instead of a
  castrated Dialog to display full fingerprint
TrustedNodesView.qml check if locations[*].is_online is an array before
  attempting calling reduce
main.qml added menuentry to shutdown de core
main.qml added menuantry to search contact
This commit is contained in:
Gioacchino Mazzurco 2017-03-24 12:02:13 +01:00
parent 34dc1fac37
commit abe84a4f81
17 changed files with 409 additions and 141 deletions

View file

@ -924,7 +924,7 @@ ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
void ChatHandler::handleMessages(Request &req, Response &resp)
{
/* G10h4ck: Whithout this the request processing won't happen, copied from
* ChatHandler::handleLobbies, is this a work around or is the right whay of
* ChatHandler::handleLobbies, is this a work around or is the right way of
* doing it? */
tick();
@ -1118,7 +1118,8 @@ void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
resp.mDataStream.getStreamToMember();
for(std::map<ChatId, std::list<Msg> >::const_iterator mit = mMsgs.begin(); mit != mMsgs.end(); ++mit)
for( std::map<ChatId, std::list<Msg> >::const_iterator mit = mMsgs.begin();
mit != mMsgs.end(); ++mit )
{
uint32_t count = 0;
for(std::list<Msg>::const_iterator lit = mit->second.begin(); lit != mit->second.end(); ++lit)
@ -1130,7 +1131,10 @@ void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
if(count && (mit2 != mChatInfo.end()))
{
resp.mDataStream.getStreamToMember()
<< makeKeyValue("id", mit->first.toStdString())
#warning @deprecated using "id" as key can cause problems in some JS based \
languages like Qml @see chat_id instead
<< makeKeyValue("id", mit->first.toStdString())
<< makeKeyValue("chat_id", mit->first.toStdString())
<< makeKeyValueReference("unread_count", count)
<< mit2->second;
}
@ -1162,7 +1166,8 @@ void ChatHandler::handleInitiateDistantChatConnexion(Request& req, Response& res
DistantChatPeerId distant_chat_id;
uint32_t error_code;
if(mRsMsgs->initiateDistantChatConnexion(receiver_id, sender_id, distant_chat_id, error_code))
if(mRsMsgs->initiateDistantChatConnexion(receiver_id, sender_id,
distant_chat_id, error_code))
resp.setOk();
else resp.setFail("Failed to initiate distant chat");

View file

@ -61,7 +61,9 @@ protected:
{
case BEGIN:{
RsIdentityParameters params;
req.mStream << makeKeyValueReference("name", params.nickname) << makeKeyValueReference("pgp_linked", params.isPgpLinked);
req.mStream
<< makeKeyValueReference("name", params.nickname)
<< makeKeyValueReference("pgp_linked", params.isPgpLinked);
if(params.nickname == "")
{
@ -141,9 +143,9 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
)
{
#ifdef WINDOWS_SYS
Sleep(500);
Sleep(50);
#else
usleep(500*1000);
usleep(50*1000);
#endif
}
@ -156,14 +158,18 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
RsGxsIdGroup& grp = *vit;
//electron: not very happy about this, i think the flags should stay hidden in rsidentities
bool own = (grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
bool pgp_linked = (grp.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility ) ;
resp.mDataStream.getStreamToMember()
<< makeKeyValueReference("id", grp.mMeta.mGroupId) /// @deprecated using "id" as key can cause problems in some JS based languages like Qml @see gxs_id instead
bool pgp_linked = (grp.mMeta.mGroupFlags &
RSGXSID_GROUPFLAG_REALID_kept_for_compatibility);
resp.mDataStream.getStreamToMember()
#warning @deprecated using "id" as key can cause problems in some JS based \
languages like Qml @see gxs_id instead
<< makeKeyValueReference("id", grp.mMeta.mGroupId)
<< makeKeyValueReference("gxs_id", grp.mMeta.mGroupId)
<< makeKeyValueReference("pgp_id",grp.mPgpId )
<< makeKeyValueReference("name", grp.mMeta.mGroupName)
<< makeKeyValueReference("own", own)
<< makeKeyValueReference("pgp_linked", pgp_linked);
<< makeKeyValueReference("pgp_linked", pgp_linked)
<< makeKeyValueReference("is_contact", grp.mIsAContact);
}
}
else ok = false;