mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-09 14:52:28 -04:00
commit
f30f71db8e
32 changed files with 1011 additions and 716 deletions
|
@ -103,10 +103,8 @@ void GxsResponseTask::streamGxsId(RsGxsId id, StreamBase &stream)
|
||||||
{
|
{
|
||||||
stream << makeKeyValueReference("id", id)
|
stream << makeKeyValueReference("id", id)
|
||||||
<< makeKeyValueReference("gxs_id", id)
|
<< makeKeyValueReference("gxs_id", id)
|
||||||
<< makeKeyValueReference("is_own", vit->mIsOwnId)
|
<< makeKeyValueReference("flags", vit->mFlags)
|
||||||
<< makeKeyValueReference("name", vit->mNickname)
|
<< makeKeyValueReference("name", vit->mNickname);
|
||||||
<< makeKeyValueReference("pgp_linked", vit->mPgpLinked)
|
|
||||||
<< makeKeyValueReference("pgp_known", vit->mPgpKnown);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!details.mPgpLinked)
|
if(!(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
{
|
{
|
||||||
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (id=" << cli->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (id=" << cli->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!details.mPgpLinked)
|
if(!(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
{
|
{
|
||||||
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (ID=" << item->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (ID=" << item->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
||||||
|
|
||||||
|
@ -1727,7 +1727,7 @@ bool DistributedChatService::setIdentityForChatLobby(const ChatLobbyId& lobby_id
|
||||||
|
|
||||||
// Only send a nickname change event if the two Identities are not anonymous
|
// Only send a nickname change event if the two Identities are not anonymous
|
||||||
|
|
||||||
if(rsIdentity->getIdDetails(nick,det1) && rsIdentity->getIdDetails(it->second.gxs_id,det2) && det1.mPgpLinked && det2.mPgpLinked)
|
if(rsIdentity->getIdDetails(nick,det1) && rsIdentity->getIdDetails(it->second.gxs_id,det2) && (det1.mFlags & det2.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
sendLobbyStatusPeerChangedNickname(lobby_id, nick.toStdString()) ;
|
sendLobbyStatusPeerChangedNickname(lobby_id, nick.toStdString()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
#include "retroshare/rsgxscircles.h"
|
#include "retroshare/rsgxscircles.h"
|
||||||
#include "retroshare/rsgrouter.h"
|
#include "retroshare/rsgrouter.h"
|
||||||
|
#include "retroshare/rsidentity.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "rsgixs.h"
|
#include "rsgixs.h"
|
||||||
#include "rsgxsutil.h"
|
#include "rsgxsutil.h"
|
||||||
|
@ -910,7 +911,7 @@ int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, const uin
|
||||||
{
|
{
|
||||||
|
|
||||||
// now check reputation of the message author
|
// now check reputation of the message author
|
||||||
float reputation_threshold = ( (signFlag & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) && !details.mPgpLinked) ? (RsReputations::REPUTATION_THRESHOLD_ANTI_SPAM): (RsReputations::REPUTATION_THRESHOLD_DEFAULT) ;
|
float reputation_threshold = ( (signFlag & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) && !(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED)) ? (RsReputations::REPUTATION_THRESHOLD_ANTI_SPAM): (RsReputations::REPUTATION_THRESHOLD_DEFAULT) ;
|
||||||
|
|
||||||
if(details.mReputation.mOverallReputationScore < reputation_threshold)
|
if(details.mReputation.mOverallReputationScore < reputation_threshold)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,11 @@ extern RsIdentity *rsIdentity;
|
||||||
|
|
||||||
std::string rsIdTypeToString(uint32_t idtype);
|
std::string rsIdTypeToString(uint32_t idtype);
|
||||||
|
|
||||||
|
static const uint32_t RS_IDENTITY_FLAGS_IS_A_CONTACT = 0x0001;
|
||||||
|
static const uint32_t RS_IDENTITY_FLAGS_PGP_LINKED = 0x0002;
|
||||||
|
static const uint32_t RS_IDENTITY_FLAGS_PGP_KNOWN = 0x0004;
|
||||||
|
static const uint32_t RS_IDENTITY_FLAGS_IS_OWN_ID = 0x0008;
|
||||||
|
|
||||||
class GxsReputation
|
class GxsReputation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -115,8 +120,9 @@ class RsGxsIdGroup
|
||||||
time_t mLastUsageTS ;
|
time_t mLastUsageTS ;
|
||||||
|
|
||||||
// Not Serialised - for GUI's benefit.
|
// Not Serialised - for GUI's benefit.
|
||||||
bool mPgpKnown;
|
bool mPgpKnown;
|
||||||
RsPgpId mPgpId;
|
bool mIsAContact; // change that into flags one day
|
||||||
|
RsPgpId mPgpId;
|
||||||
GxsReputation mReputation;
|
GxsReputation mReputation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -154,22 +160,20 @@ class RsRecognTagDetails
|
||||||
bool is_pending;
|
bool is_pending;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class RsIdentityDetails
|
class RsIdentityDetails
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsIdentityDetails()
|
RsIdentityDetails()
|
||||||
:mIsOwnId(false), mPgpLinked(false), mPgpKnown(false), mLastUsageTS(0) { return; }
|
: mFlags(0), mLastUsageTS(0) { return; }
|
||||||
|
|
||||||
RsGxsId mId;
|
RsGxsId mId;
|
||||||
|
|
||||||
// identity details.
|
// identity details.
|
||||||
std::string mNickname;
|
std::string mNickname;
|
||||||
bool mIsOwnId;
|
|
||||||
|
uint32_t mFlags ;
|
||||||
|
|
||||||
// PGP Stuff.
|
// PGP Stuff.
|
||||||
bool mPgpLinked;
|
|
||||||
bool mPgpKnown;
|
|
||||||
RsPgpId mPgpId;
|
RsPgpId mPgpId;
|
||||||
|
|
||||||
// Recogn details.
|
// Recogn details.
|
||||||
|
@ -245,6 +249,8 @@ virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
|
||||||
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
||||||
uint16_t tag_class, uint16_t tag_type, std::string &tag) = 0;
|
uint16_t tag_class, uint16_t tag_type, std::string &tag) = 0;
|
||||||
|
|
||||||
|
virtual bool setAsRegularContact(const RsGxsId& id,bool is_a_contact) = 0 ;
|
||||||
|
|
||||||
// Specific RsIdentity Functions....
|
// Specific RsIdentity Functions....
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
/* We expose these initially for testing / GUI purposes.
|
/* We expose these initially for testing / GUI purposes.
|
||||||
|
|
|
@ -264,6 +264,12 @@ public:
|
||||||
#define RS_DISTANT_CHAT_FLAG_SIGNED 0x0001
|
#define RS_DISTANT_CHAT_FLAG_SIGNED 0x0001
|
||||||
#define RS_DISTANT_CHAT_FLAG_SIGNATURE_OK 0x0002
|
#define RS_DISTANT_CHAT_FLAG_SIGNATURE_OK 0x0002
|
||||||
|
|
||||||
|
// flags to define who we accept to talk to
|
||||||
|
|
||||||
|
#define RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_NONE 0x0000
|
||||||
|
#define RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_EVERYBODY 0x0001
|
||||||
|
#define RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_CONTACT_LIST 0x0002
|
||||||
|
|
||||||
struct DistantChatPeerInfo
|
struct DistantChatPeerInfo
|
||||||
{
|
{
|
||||||
RsGxsId to_id ;
|
RsGxsId to_id ;
|
||||||
|
@ -425,9 +431,9 @@ virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags) = 0;
|
||||||
/* Private distant messages */
|
/* Private distant messages */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
virtual void enableDistantMessaging(bool b) = 0;
|
virtual uint32_t getDistantMessagingPermissionFlags()=0 ;
|
||||||
virtual bool distantMessagingEnabled() = 0;
|
virtual void setDistantMessagingPermissionFlags(uint32_t flags)=0 ;
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* Chat */
|
/* Chat */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
|
@ -279,6 +279,16 @@ bool p3Msgs::getMessageSummaries(std::list<MsgInfoSummary> &msgList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t p3Msgs::getDistantMessagingPermissionFlags()
|
||||||
|
{
|
||||||
|
return mMsgSrv->getDistantMessagingPermissionFlags();
|
||||||
|
}
|
||||||
|
|
||||||
|
void p3Msgs::setDistantMessagingPermissionFlags(uint32_t flags)
|
||||||
|
{
|
||||||
|
return mMsgSrv->setDistantMessagingPermissionFlags(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3Msgs::getMessage(const std::string &mid, MessageInfo &msg)
|
bool p3Msgs::getMessage(const std::string &mid, MessageInfo &msg)
|
||||||
{
|
{
|
||||||
|
@ -298,15 +308,6 @@ bool p3Msgs::MessageSend(MessageInfo &info)
|
||||||
return mMsgSrv->MessageSend(info);
|
return mMsgSrv->MessageSend(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3Msgs::enableDistantMessaging(bool b)
|
|
||||||
{
|
|
||||||
mMsgSrv->enableDistantMessaging(b);
|
|
||||||
}
|
|
||||||
bool p3Msgs::distantMessagingEnabled()
|
|
||||||
{
|
|
||||||
return mMsgSrv->distantMessagingEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool p3Msgs::SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag)
|
bool p3Msgs::SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag)
|
||||||
{
|
{
|
||||||
return mMsgSrv->SystemMessage(title, message, systemFlag);
|
return mMsgSrv->SystemMessage(title, message, systemFlag);
|
||||||
|
|
|
@ -80,8 +80,8 @@ class p3Msgs: public RsMsgs
|
||||||
|
|
||||||
virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags);
|
virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags);
|
||||||
|
|
||||||
virtual void enableDistantMessaging(bool b) ;
|
virtual uint32_t getDistantMessagingPermissionFlags() ;
|
||||||
virtual bool distantMessagingEnabled() ;
|
virtual void setDistantMessagingPermissionFlags(uint32_t flags) ;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* gets avatar from peer, image data in jpeg format
|
* gets avatar from peer, image data in jpeg format
|
||||||
|
|
|
@ -101,6 +101,8 @@ uint32_t RsGxsIdLocalInfoItem::serial_size()
|
||||||
uint32_t s = 8 ; // header
|
uint32_t s = 8 ; // header
|
||||||
s += 4 ; // number of items
|
s += 4 ; // number of items
|
||||||
s += mTimeStamps.size() * (RsGxsId::SIZE_IN_BYTES + 8) ;
|
s += mTimeStamps.size() * (RsGxsId::SIZE_IN_BYTES + 8) ;
|
||||||
|
s += 4 ; // number of contacts
|
||||||
|
s += mContacts.size() * RsGxsId::SIZE_IN_BYTES ;
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -176,6 +178,11 @@ bool RsGxsIdLocalInfoItem::serialise(void *data, uint32_t& size)
|
||||||
ok &= it->first.serialise(data,tlvsize,offset) ;
|
ok &= it->first.serialise(data,tlvsize,offset) ;
|
||||||
ok &= setRawTimeT(data,tlvsize,&offset,it->second) ;
|
ok &= setRawTimeT(data,tlvsize,&offset,it->second) ;
|
||||||
}
|
}
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mContacts.size()) ;
|
||||||
|
|
||||||
|
for(std::set<RsGxsId>::const_iterator it(mContacts.begin());it!=mContacts.end();++it)
|
||||||
|
ok &= (*it).serialise(data,tlvsize,offset) ;
|
||||||
|
|
||||||
if(offset != tlvsize)
|
if(offset != tlvsize)
|
||||||
{
|
{
|
||||||
#ifdef GXSID_DEBUG
|
#ifdef GXSID_DEBUG
|
||||||
|
@ -386,6 +393,19 @@ RsGxsIdLocalInfoItem *RsGxsIdSerialiser::deserialise_GxsIdLocalInfoItem(void *da
|
||||||
item->mTimeStamps[gxsid] = TS ;
|
item->mTimeStamps[gxsid] = TS ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (offset < rssize) // backward compatibility, making that section optional.
|
||||||
|
{
|
||||||
|
ok &= getRawUInt32(data, rssize, &offset, &n) ;
|
||||||
|
RsGxsId gxsid ;
|
||||||
|
|
||||||
|
for(int i=0;ok && i<n;++i)
|
||||||
|
{
|
||||||
|
ok &= gxsid.deserialise(data,rssize,offset) ;
|
||||||
|
|
||||||
|
item->mContacts.insert(gxsid) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (offset != rssize)
|
if (offset != rssize)
|
||||||
{
|
{
|
||||||
#ifdef GXSID_DEBUG
|
#ifdef GXSID_DEBUG
|
||||||
|
|
|
@ -97,6 +97,7 @@ public:
|
||||||
virtual uint32_t serial_size() ;
|
virtual uint32_t serial_size() ;
|
||||||
|
|
||||||
std::map<RsGxsId,time_t> mTimeStamps ;
|
std::map<RsGxsId,time_t> mTimeStamps ;
|
||||||
|
std::set<RsGxsId> mContacts ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -932,7 +932,7 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
if (mIdentities->getIdDetails(*pit, details))
|
if (mIdentities->getIdDetails(*pit, details))
|
||||||
{
|
{
|
||||||
if (details.mPgpLinked && details.mPgpKnown)
|
if ((details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED) &&(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CIRCLES
|
#ifdef DEBUG_CIRCLES
|
||||||
std::cerr << "p3GxsCircles::cache_load_for_token() Is Known -> AllowedPeer: " << *pit;
|
std::cerr << "p3GxsCircles::cache_load_for_token() Is Known -> AllowedPeer: " << *pit;
|
||||||
|
@ -1115,7 +1115,7 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
if (mIdentities->getIdDetails(*pit, details))
|
if (mIdentities->getIdDetails(*pit, details))
|
||||||
{
|
{
|
||||||
if (details.mPgpLinked && details.mPgpKnown)
|
if ((details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED) &&(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN))
|
||||||
{
|
{
|
||||||
cache.addAllowedPeer(details.mPgpId, *pit);
|
cache.addAllowedPeer(details.mPgpId, *pit);
|
||||||
|
|
||||||
|
|
|
@ -248,8 +248,8 @@ void p3GxsReputation::updateIdentityFlags()
|
||||||
}
|
}
|
||||||
it->second.mIdentityFlags = 0 ;
|
it->second.mIdentityFlags = 0 ;
|
||||||
|
|
||||||
if(details.mPgpLinked) it->second.mIdentityFlags |= REPUTATION_IDENTITY_FLAG_PGP_LINKED ;
|
if(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED) it->second.mIdentityFlags |= REPUTATION_IDENTITY_FLAG_PGP_LINKED ;
|
||||||
if(details.mPgpKnown ) it->second.mIdentityFlags |= REPUTATION_IDENTITY_FLAG_PGP_KNOWN ;
|
if(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN ) it->second.mIdentityFlags |= REPUTATION_IDENTITY_FLAG_PGP_KNOWN ;
|
||||||
|
|
||||||
#ifdef DEBUG_REPUTATION
|
#ifdef DEBUG_REPUTATION
|
||||||
std::cerr << " updated flags for " << *rit << " to " << std::hex << it->second.mIdentityFlags << std::dec << std::endl;
|
std::cerr << " updated flags for " << *rit << " to " << std::hex << it->second.mIdentityFlags << std::dec << std::endl;
|
||||||
|
|
|
@ -212,6 +212,25 @@ uint32_t p3IdService::idAuthenPolicy()
|
||||||
|
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
|
bool p3IdService::setAsRegularContact(const RsGxsId& id,bool b)
|
||||||
|
{
|
||||||
|
std::set<RsGxsId>::iterator it = mContacts.find(id) ;
|
||||||
|
|
||||||
|
if(b && (it == mContacts.end()))
|
||||||
|
{
|
||||||
|
mContacts.insert(id) ;
|
||||||
|
slowIndicateConfigChanged() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (!b) &&(it != mContacts.end()))
|
||||||
|
{
|
||||||
|
mContacts.erase(it) ;
|
||||||
|
slowIndicateConfigChanged() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
void p3IdService::slowIndicateConfigChanged()
|
void p3IdService::slowIndicateConfigChanged()
|
||||||
{
|
{
|
||||||
time_t now = time(NULL) ;
|
time_t now = time(NULL) ;
|
||||||
|
@ -250,8 +269,13 @@ bool p3IdService::loadList(std::list<RsItem*>& items)
|
||||||
|
|
||||||
for(std::list<RsItem*>::const_iterator it = items.begin();it!=items.end();++it)
|
for(std::list<RsItem*>::const_iterator it = items.begin();it!=items.end();++it)
|
||||||
if( (lii = dynamic_cast<RsGxsIdLocalInfoItem*>(*it)) != NULL)
|
if( (lii = dynamic_cast<RsGxsIdLocalInfoItem*>(*it)) != NULL)
|
||||||
|
{
|
||||||
for(std::map<RsGxsId,time_t>::const_iterator it2 = lii->mTimeStamps.begin();it2!=lii->mTimeStamps.end();++it2)
|
for(std::map<RsGxsId,time_t>::const_iterator it2 = lii->mTimeStamps.begin();it2!=lii->mTimeStamps.end();++it2)
|
||||||
mKeysTS.insert(*it2) ;
|
mKeysTS.insert(*it2) ;
|
||||||
|
|
||||||
|
mContacts = lii->mContacts ;
|
||||||
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +289,7 @@ bool p3IdService::saveList(bool& cleanup,std::list<RsItem*>& items)
|
||||||
cleanup = true ;
|
cleanup = true ;
|
||||||
RsGxsIdLocalInfoItem *item = new RsGxsIdLocalInfoItem ;
|
RsGxsIdLocalInfoItem *item = new RsGxsIdLocalInfoItem ;
|
||||||
item->mTimeStamps = mKeysTS ;
|
item->mTimeStamps = mKeysTS ;
|
||||||
|
item->mContacts = mContacts ;
|
||||||
|
|
||||||
items.push_back(item) ;
|
items.push_back(item) ;
|
||||||
return true ;
|
return true ;
|
||||||
|
@ -410,6 +435,9 @@ bool p3IdService:: getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
||||||
{
|
{
|
||||||
details = data.details;
|
details = data.details;
|
||||||
details.mLastUsageTS = locked_getLastUsageTS(id) ;
|
details.mLastUsageTS = locked_getLastUsageTS(id) ;
|
||||||
|
|
||||||
|
if(mContacts.find(id) != mContacts.end())
|
||||||
|
details.mFlags |= RS_IDENTITY_FLAGS_IS_A_CONTACT ;
|
||||||
|
|
||||||
// one utf8 symbol can be at most 4 bytes long - would be better to measure real unicode length !!!
|
// 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)
|
if(details.mNickname.length() > RSID_MAXIMUM_NICKNAME_SIZE*4)
|
||||||
|
@ -426,6 +454,9 @@ bool p3IdService:: getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
||||||
details = data.details;
|
details = data.details;
|
||||||
details.mLastUsageTS = locked_getLastUsageTS(id) ;
|
details.mLastUsageTS = locked_getLastUsageTS(id) ;
|
||||||
|
|
||||||
|
if(mContacts.find(id) != mContacts.end())
|
||||||
|
details.mFlags |= RS_IDENTITY_FLAGS_IS_A_CONTACT ;
|
||||||
|
|
||||||
rsReputations->getReputationInfo(id,details.mReputation) ;
|
rsReputations->getReputationInfo(id,details.mReputation) ;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1029,33 +1060,33 @@ bool p3IdService::getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup>
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
std::cerr << "p3IdService::getGroupData() Item is:";
|
std::cerr << "p3IdService::getGroupData() Item is:";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
item->print(std::cerr);
|
item->print(std::cerr);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif // DEBUG_IDS
|
#endif // DEBUG_IDS
|
||||||
RsGxsIdGroup group ;
|
RsGxsIdGroup group ;
|
||||||
item->toGxsIdGroup(group,false) ;
|
item->toGxsIdGroup(group,false) ;
|
||||||
|
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mIdMtx) ;
|
RS_STACK_MUTEX(mIdMtx) ;
|
||||||
group.mLastUsageTS = locked_getLastUsageTS(RsGxsId(group.mMeta.mGroupId)) ;
|
group.mLastUsageTS = locked_getLastUsageTS(RsGxsId(group.mMeta.mGroupId)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode information from serviceString.
|
// Decode information from serviceString.
|
||||||
SSGxsIdGroup ssdata;
|
SSGxsIdGroup ssdata;
|
||||||
if (ssdata.load(group.mMeta.mServiceString))
|
if (ssdata.load(group.mMeta.mServiceString))
|
||||||
{
|
{
|
||||||
group.mPgpKnown = ssdata.pgp.idKnown;
|
group.mPgpKnown = ssdata.pgp.idKnown;
|
||||||
group.mPgpId = ssdata.pgp.pgpId;
|
group.mPgpId = ssdata.pgp.pgpId;
|
||||||
group.mReputation = ssdata.score.rep;
|
group.mReputation = ssdata.score.rep;
|
||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
std::cerr << "p3IdService::getGroupData() Success decoding ServiceString";
|
std::cerr << "p3IdService::getGroupData() Success decoding ServiceString";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "\t mGpgKnown: " << group.mPgpKnown;
|
std::cerr << "\t mGpgKnown: " << group.mPgpKnown;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "\t mGpgId: " << group.mPgpId;
|
std::cerr << "\t mGpgId: " << group.mPgpId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif // DEBUG_IDS
|
#endif // DEBUG_IDS
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1063,13 +1094,15 @@ bool p3IdService::getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup>
|
||||||
group.mPgpKnown = false;
|
group.mPgpKnown = false;
|
||||||
group.mPgpId.clear();
|
group.mPgpId.clear();
|
||||||
|
|
||||||
std::cerr << "p3IdService::getGroupData() Failed to decode ServiceString \""
|
std::cerr << "p3IdService::getGroupData() Failed to decode ServiceString \""
|
||||||
<< group.mMeta.mServiceString << "\"" ;
|
<< group.mMeta.mServiceString << "\"" ;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group.mIsAContact = (mContacts.find(RsGxsId(group.mMeta.mGroupId)) != mContacts.end());
|
||||||
|
|
||||||
groups.push_back(group);
|
groups.push_back(group);
|
||||||
delete(item);
|
delete(item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1600,8 +1633,10 @@ RsGxsIdCache::RsGxsIdCache(const RsGxsIdGroupItem *item, const RsTlvSecurityKey
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif // DEBUG_IDS
|
#endif // DEBUG_IDS
|
||||||
|
|
||||||
details.mIsOwnId = (item->meta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
|
details.mFlags = 0 ;
|
||||||
details.mPgpLinked = (item->meta.mGroupFlags & RSGXSID_GROUPFLAG_REALID);
|
|
||||||
|
if(item->meta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) details.mFlags |= RS_IDENTITY_FLAGS_IS_OWN_ID;
|
||||||
|
if(item->meta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) details.mFlags |= RS_IDENTITY_FLAGS_PGP_LINKED;
|
||||||
|
|
||||||
/* rest must be retrived from ServiceString */
|
/* rest must be retrived from ServiceString */
|
||||||
updateServiceString(item->meta.mServiceString);
|
updateServiceString(item->meta.mServiceString);
|
||||||
|
@ -1610,21 +1645,19 @@ RsGxsIdCache::RsGxsIdCache(const RsGxsIdGroupItem *item, const RsTlvSecurityKey
|
||||||
void RsGxsIdCache::updateServiceString(std::string serviceString)
|
void RsGxsIdCache::updateServiceString(std::string serviceString)
|
||||||
{
|
{
|
||||||
details.mRecognTags.clear();
|
details.mRecognTags.clear();
|
||||||
|
details.mFlags = 0 ;
|
||||||
|
|
||||||
SSGxsIdGroup ssdata;
|
SSGxsIdGroup ssdata;
|
||||||
if (ssdata.load(serviceString))
|
if (ssdata.load(serviceString))
|
||||||
{
|
{
|
||||||
if (details.mPgpLinked)
|
if (details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED)
|
||||||
{
|
{
|
||||||
details.mPgpKnown = ssdata.pgp.idKnown;
|
if(ssdata.pgp.idKnown) details.mFlags |= RS_IDENTITY_FLAGS_PGP_KNOWN ;
|
||||||
if (details.mPgpKnown)
|
|
||||||
{
|
if (details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN)
|
||||||
details.mPgpId = ssdata.pgp.pgpId;
|
details.mPgpId = ssdata.pgp.pgpId;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
details.mPgpId.clear();
|
details.mPgpId.clear();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1680,7 +1713,7 @@ void RsGxsIdCache::updateServiceString(std::string serviceString)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
details.mPgpKnown = false;
|
details.mFlags &= ~RS_IDENTITY_FLAGS_PGP_KNOWN ;
|
||||||
details.mPgpId.clear();
|
details.mPgpId.clear();
|
||||||
//details.mReputation.updateIdScore(false, false);
|
//details.mReputation.updateIdScore(false, false);
|
||||||
//details.mReputation.update();
|
//details.mReputation.update();
|
||||||
|
|
|
@ -265,6 +265,8 @@ virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
|
||||||
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
||||||
uint16_t tag_class, uint16_t tag_type, std::string &tag);
|
uint16_t tag_class, uint16_t tag_type, std::string &tag);
|
||||||
|
|
||||||
|
virtual bool setAsRegularContact(const RsGxsId& id,bool is_a_contact) ;
|
||||||
|
|
||||||
/**************** RsGixs Implementation ***************/
|
/**************** RsGixs Implementation ***************/
|
||||||
|
|
||||||
virtual bool getOwnIds(std::list<RsGxsId> &ownIds);
|
virtual bool getOwnIds(std::list<RsGxsId> &ownIds);
|
||||||
|
@ -495,8 +497,11 @@ std::string genRandomId(int len = 20);
|
||||||
|
|
||||||
std::map<uint32_t, std::set<RsGxsGroupId> > mIdsPendingCache;
|
std::map<uint32_t, std::set<RsGxsGroupId> > mIdsPendingCache;
|
||||||
std::map<uint32_t, std::list<RsGxsGroupId> > mGroupNotPresent;
|
std::map<uint32_t, std::list<RsGxsGroupId> > mGroupNotPresent;
|
||||||
std::map<RsGxsId, std::list<RsPeerId> > mIdsNotPresent;
|
std::map<RsGxsId, std::list<RsPeerId> > mIdsNotPresent;
|
||||||
std::map<RsGxsId,time_t> mKeysTS ;
|
std::map<RsGxsId,time_t> mKeysTS ;
|
||||||
|
|
||||||
|
// keep a list of regular contacts. This is useful to sort IDs, and allow some services to priviledged ids only.
|
||||||
|
std::set<RsGxsId> mContacts;
|
||||||
RsNetworkExchangeService* mNes;
|
RsNetworkExchangeService* mNes;
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
|
|
|
@ -90,6 +90,7 @@ class p3MsgService: public p3Service, public p3Config, public pqiServiceMonitor,
|
||||||
|
|
||||||
void loadWelcomeMsg(); /* startup message */
|
void loadWelcomeMsg(); /* startup message */
|
||||||
|
|
||||||
|
|
||||||
//std::list<RsMsgItem *> &getMsgList();
|
//std::list<RsMsgItem *> &getMsgList();
|
||||||
//std::list<RsMsgItem *> &getMsgOutList();
|
//std::list<RsMsgItem *> &getMsgOutList();
|
||||||
|
|
||||||
|
@ -125,6 +126,8 @@ class p3MsgService: public p3Service, public p3Config, public pqiServiceMonitor,
|
||||||
};
|
};
|
||||||
void enableDistantMessaging(bool b) ;
|
void enableDistantMessaging(bool b) ;
|
||||||
bool distantMessagingEnabled() ;
|
bool distantMessagingEnabled() ;
|
||||||
|
void setDistantMessagingPermissionFlags(uint32_t flags) {}
|
||||||
|
uint32_t getDistantMessagingPermissionFlags() { return 0 ;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sendDistantMsgItem(RsMsgItem *msgitem) ;
|
void sendDistantMsgItem(RsMsgItem *msgitem) ;
|
||||||
|
|
|
@ -235,7 +235,7 @@ static bool trimAnonIds(std::list<RsGxsId>& lst)
|
||||||
RsIdentityDetails idd ;
|
RsIdentityDetails idd ;
|
||||||
|
|
||||||
for(std::list<RsGxsId>::iterator it = lst.begin();it!=lst.end();)
|
for(std::list<RsGxsId>::iterator it = lst.begin();it!=lst.end();)
|
||||||
if(!rsIdentity->getIdDetails(*it,idd) || !idd.mPgpLinked)
|
if(!rsIdentity->getIdDetails(*it,idd) || !(idd.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
{
|
{
|
||||||
it = lst.erase(it) ;
|
it = lst.erase(it) ;
|
||||||
removed= true ;
|
removed= true ;
|
||||||
|
@ -269,7 +269,7 @@ void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
|
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
|
||||||
|
|
||||||
ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
//ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
||||||
ChatLobbyFlags flags(item->data(COLUMN_DATA, ROLE_FLAGS).toUInt());
|
ChatLobbyFlags flags(item->data(COLUMN_DATA, ROLE_FLAGS).toUInt());
|
||||||
|
|
||||||
bool removed = false ;
|
bool removed = false ;
|
||||||
|
@ -725,7 +725,7 @@ void ChatLobbyWidget::subscribeChatLobbyAs()
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
RsGxsId gxs_id(action->data().toString().toStdString());
|
RsGxsId gxs_id(action->data().toString().toStdString());
|
||||||
uint32_t error_code ;
|
//uint32_t error_code ;
|
||||||
|
|
||||||
if(rsMsgs->joinVisibleChatLobby(id,gxs_id))
|
if(rsMsgs->joinVisibleChatLobby(id,gxs_id))
|
||||||
ChatDialog::chatFriend(ChatId(id),true) ;
|
ChatDialog::chatFriend(ChatId(id),true) ;
|
||||||
|
@ -795,7 +795,7 @@ void ChatLobbyWidget::subscribeChatLobbyAtItem(QTreeWidgetItem *item)
|
||||||
if(!rsIdentity->getIdDetails(gxs_id,idd))
|
if(!rsIdentity->getIdDetails(gxs_id,idd))
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if( (flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED) && !idd.mPgpLinked)
|
if( (flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED) && !(idd.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
{
|
{
|
||||||
QMessageBox::warning(NULL,tr("Default identity is anonymous"),tr("You cannot join this lobby with your default identity, since it is anonymous and the lobby forbids it.")) ;
|
QMessageBox::warning(NULL,tr("Default identity is anonymous"),tr("You cannot join this lobby with your default identity, since it is anonymous and the lobby forbids it.")) ;
|
||||||
return ;
|
return ;
|
||||||
|
@ -844,11 +844,13 @@ void ChatLobbyWidget::showBlankPage(ChatLobbyId id)
|
||||||
|
|
||||||
QString text = tr("You're not subscribed to this lobby; Double click-it to enter and chat.") ;
|
QString text = tr("You're not subscribed to this lobby; Double click-it to enter and chat.") ;
|
||||||
|
|
||||||
if(my_ids.empty())
|
if(my_ids.empty())
|
||||||
if( (*it).lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)
|
{
|
||||||
text += "\n\n"+tr("You will need to create a non anonymous identity in order to join this chat lobby.") ;
|
if( (*it).lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)
|
||||||
else
|
text += "\n\n"+tr("You will need to create a non anonymous identity in order to join this chat lobby.") ;
|
||||||
text += "\n\n"+tr("You will need to create an identity in order to join chat lobbies.") ;
|
else
|
||||||
|
text += "\n\n"+tr("You will need to create an identity in order to join chat lobbies.") ;
|
||||||
|
}
|
||||||
|
|
||||||
ui.lobbyInfoLabel->setText(text);
|
ui.lobbyInfoLabel->setText(text);
|
||||||
return ;
|
return ;
|
||||||
|
|
|
@ -81,6 +81,13 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
mIdQueue = NULL;
|
mIdQueue = NULL;
|
||||||
|
|
||||||
|
allItem = new QTreeWidgetItem();
|
||||||
|
allItem->setText(0, tr("All"));
|
||||||
|
|
||||||
|
contactsItem = new QTreeWidgetItem();
|
||||||
|
contactsItem->setText(0, tr("Contacts"));
|
||||||
|
|
||||||
|
|
||||||
/* Setup UI helper */
|
/* Setup UI helper */
|
||||||
mStateHelper = new UIStateHelper(this);
|
mStateHelper = new UIStateHelper(this);
|
||||||
|
@ -123,7 +130,6 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||||
|
|
||||||
/* Connect signals */
|
/* Connect signals */
|
||||||
connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(addIdentity()));
|
connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(addIdentity()));
|
||||||
connect(ui->todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));
|
|
||||||
|
|
||||||
connect(ui->removeIdentity, SIGNAL(triggered()), this, SLOT(removeIdentity()));
|
connect(ui->removeIdentity, SIGNAL(triggered()), this, SLOT(removeIdentity()));
|
||||||
connect(ui->editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
|
connect(ui->editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
|
||||||
|
@ -162,8 +168,7 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||||
QTreeWidgetItem *headerItem = ui->idTreeWidget->headerItem();
|
QTreeWidgetItem *headerItem = ui->idTreeWidget->headerItem();
|
||||||
QString headerText = headerItem->text(RSID_COL_NICKNAME);
|
QString headerText = headerItem->text(RSID_COL_NICKNAME);
|
||||||
ui->filterLineEdit->addFilter(QIcon(), headerText, RSID_COL_NICKNAME, QString("%1 %2").arg(tr("Search"), headerText));
|
ui->filterLineEdit->addFilter(QIcon(), headerText, RSID_COL_NICKNAME, QString("%1 %2").arg(tr("Search"), headerText));
|
||||||
headerText = headerItem->text(RSID_COL_KEYID);
|
ui->filterLineEdit->addFilter(QIcon(), tr("ID"), RSID_COL_KEYID, tr("Search ID"));
|
||||||
ui->filterLineEdit->addFilter(QIcon(), headerItem->text(RSID_COL_KEYID), RSID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText));
|
|
||||||
|
|
||||||
/* Setup tree */
|
/* Setup tree */
|
||||||
ui->idTreeWidget->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder);
|
ui->idTreeWidget->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder);
|
||||||
|
@ -171,6 +176,8 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||||
ui->idTreeWidget->enableColumnCustomize(true);
|
ui->idTreeWidget->enableColumnCustomize(true);
|
||||||
ui->idTreeWidget->setColumnCustomizable(RSID_COL_NICKNAME, false);
|
ui->idTreeWidget->setColumnCustomizable(RSID_COL_NICKNAME, false);
|
||||||
ui->idTreeWidget->setColumnHidden(RSID_COL_IDTYPE, true);
|
ui->idTreeWidget->setColumnHidden(RSID_COL_IDTYPE, true);
|
||||||
|
ui->idTreeWidget->setColumnHidden(RSID_COL_KEYID, true);
|
||||||
|
|
||||||
/* Set initial column width */
|
/* Set initial column width */
|
||||||
int fontWidth = QFontMetricsF(ui->idTreeWidget->font()).width("W");
|
int fontWidth = QFontMetricsF(ui->idTreeWidget->font()).width("W");
|
||||||
ui->idTreeWidget->setColumnWidth(RSID_COL_NICKNAME, 14 * fontWidth);
|
ui->idTreeWidget->setColumnWidth(RSID_COL_NICKNAME, 14 * fontWidth);
|
||||||
|
@ -185,12 +192,6 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||||
mStateHelper->setActive(IDDIALOG_IDDETAILS, false);
|
mStateHelper->setActive(IDDIALOG_IDDETAILS, false);
|
||||||
mStateHelper->setActive(IDDIALOG_REPLIST, false);
|
mStateHelper->setActive(IDDIALOG_REPLIST, false);
|
||||||
|
|
||||||
// Hiding RepList until that part is finished.
|
|
||||||
//ui->treeWidget_RepList->setVisible(false);
|
|
||||||
|
|
||||||
#ifndef UNFINISHED
|
|
||||||
ui->todoPushButton->hide() ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString hlp_str = tr(
|
QString hlp_str = tr(
|
||||||
" <h1><img width=\"32\" src=\":/icons/help_64.png\"> Identities</h1> \
|
" <h1><img width=\"32\" src=\":/icons/help_64.png\"> Identities</h1> \
|
||||||
|
@ -214,9 +215,6 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||||
// load settings
|
// load settings
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
// hide reputation sice it's currently unused
|
|
||||||
//ui->reputationGroupBox->hide();
|
|
||||||
//ui->tweakGroupBox->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IdDialog::~IdDialog()
|
IdDialog::~IdDialog()
|
||||||
|
@ -228,14 +226,6 @@ IdDialog::~IdDialog()
|
||||||
delete(mIdQueue);
|
delete(mIdQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdDialog::todo()
|
|
||||||
{
|
|
||||||
QMessageBox::information(this, "Todo",
|
|
||||||
"<b>Open points:</b><ul>"
|
|
||||||
"<li>Reputation"
|
|
||||||
"</ul>");
|
|
||||||
}
|
|
||||||
|
|
||||||
void IdDialog::processSettings(bool load)
|
void IdDialog::processSettings(bool load)
|
||||||
{
|
{
|
||||||
Settings->beginGroup("IdDialog");
|
Settings->beginGroup("IdDialog");
|
||||||
|
@ -448,10 +438,11 @@ void IdDialog::insertIdList(uint32_t token)
|
||||||
mStateHelper->setLoading(IDDIALOG_IDLIST, false);
|
mStateHelper->setLoading(IDDIALOG_IDLIST, false);
|
||||||
|
|
||||||
int accept = ui->filterComboBox->itemData(ui->filterComboBox->currentIndex()).toInt();
|
int accept = ui->filterComboBox->itemData(ui->filterComboBox->currentIndex()).toInt();
|
||||||
|
|
||||||
RsGxsIdGroup data;
|
RsGxsIdGroup data;
|
||||||
std::vector<RsGxsIdGroup> datavector;
|
std::vector<RsGxsIdGroup> datavector;
|
||||||
std::vector<RsGxsIdGroup>::iterator vit;
|
std::vector<RsGxsIdGroup>::iterator vit;
|
||||||
|
|
||||||
if (!rsIdentity->getGroupData(token, datavector))
|
if (!rsIdentity->getGroupData(token, datavector))
|
||||||
{
|
{
|
||||||
#ifdef ID_DEBUG
|
#ifdef ID_DEBUG
|
||||||
|
@ -464,53 +455,69 @@ void IdDialog::insertIdList(uint32_t token)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// turn that vector into a std::set, to avoid a linear search
|
||||||
|
|
||||||
|
std::map<RsGxsGroupId,RsGxsIdGroup> ids_set ;
|
||||||
|
|
||||||
|
for(uint32_t i=0;i<datavector.size();++i)
|
||||||
|
ids_set[datavector[i].mMeta.mGroupId] = datavector[i] ;
|
||||||
|
|
||||||
mStateHelper->setActive(IDDIALOG_IDLIST, true);
|
mStateHelper->setActive(IDDIALOG_IDLIST, true);
|
||||||
|
|
||||||
RsPgpId ownPgpId = rsPeers->getGPGOwnId();
|
RsPgpId ownPgpId = rsPeers->getGPGOwnId();
|
||||||
|
|
||||||
/* Update existing and remove not existing items */
|
// Update existing and remove not existing items
|
||||||
|
// Also remove items that do not have the correct parent
|
||||||
|
|
||||||
QTreeWidgetItemIterator itemIterator(ui->idTreeWidget);
|
QTreeWidgetItemIterator itemIterator(ui->idTreeWidget);
|
||||||
QTreeWidgetItem *item = NULL;
|
QTreeWidgetItem *item = NULL;
|
||||||
while ((item = *itemIterator) != NULL) {
|
|
||||||
|
while ((item = *itemIterator) != NULL)
|
||||||
|
{
|
||||||
++itemIterator;
|
++itemIterator;
|
||||||
|
std::map<RsGxsGroupId,RsGxsIdGroup>::iterator it = ids_set.find(RsGxsGroupId(item->text(RSID_COL_KEYID).toStdString())) ;
|
||||||
|
|
||||||
for (vit = datavector.begin(); vit != datavector.end(); ++vit)
|
if(it == ids_set.end())
|
||||||
{
|
{
|
||||||
if (vit->mMeta.mGroupId == RsGxsGroupId(item->text(RSID_COL_KEYID).toStdString()))
|
if(item != allItem && item != contactsItem)
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (vit == datavector.end())
|
|
||||||
{
|
|
||||||
delete(item);
|
|
||||||
} else {
|
|
||||||
if (!fillIdListItem(*vit, item, ownPgpId, accept))
|
|
||||||
{
|
|
||||||
delete(item);
|
delete(item);
|
||||||
}
|
|
||||||
datavector.erase(vit);
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTreeWidgetItem *parent_item = item->parent() ;
|
||||||
|
|
||||||
|
if( (parent_item == allItem && it->second.mIsAContact) || (parent_item == contactsItem && !it->second.mIsAContact))
|
||||||
|
{
|
||||||
|
delete item ; // do not remove from the list, so that it is added again in the correct place.
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fillIdListItem(it->second, item, ownPgpId, accept))
|
||||||
|
delete(item);
|
||||||
|
|
||||||
|
ids_set.erase(it); // erase, so it is not considered to be a new item
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert new items */
|
/* Insert new items */
|
||||||
for (vit = datavector.begin(); vit != datavector.end(); ++vit)
|
for (std::map<RsGxsGroupId,RsGxsIdGroup>::const_iterator vit = ids_set.begin(); vit != ids_set.end(); ++vit)
|
||||||
{
|
{
|
||||||
data = (*vit);
|
data = vit->second ;
|
||||||
|
|
||||||
item = NULL;
|
item = NULL;
|
||||||
if (fillIdListItem(*vit, item, ownPgpId, accept))
|
|
||||||
{
|
ui->idTreeWidget->insertTopLevelItem(0, contactsItem );
|
||||||
ui->idTreeWidget->addTopLevelItem(item);
|
ui->idTreeWidget->insertTopLevelItem(0, allItem);
|
||||||
}
|
|
||||||
|
if (fillIdListItem(vit->second, item, ownPgpId, accept))
|
||||||
|
if(vit->second.mIsAContact)
|
||||||
|
contactsItem->addChild(item);
|
||||||
|
else
|
||||||
|
allItem->addChild(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* count items */
|
|
||||||
ui->label_count->setText( "(" + QString::number(ui->idTreeWidget->topLevelItemCount()) + ")" );
|
|
||||||
|
|
||||||
filterIds();
|
filterIds();
|
||||||
|
|
||||||
updateSelection();
|
updateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,7 +923,8 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||||
rsIdentity->getOwnIds(own_identities) ;
|
rsIdentity->getOwnIds(own_identities) ;
|
||||||
|
|
||||||
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
|
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
|
||||||
if (item) {
|
|
||||||
|
if(item != allItem && item != contactsItem) {
|
||||||
uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
|
uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
|
||||||
|
|
||||||
if(!(item_flags & RSID_FILTER_OWNED_BY_YOU))
|
if(!(item_flags & RSID_FILTER_OWNED_BY_YOU))
|
||||||
|
@ -952,7 +960,29 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||||
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
|
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
RsIdentityDetails details;
|
||||||
|
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
|
||||||
|
|
||||||
|
rsIdentity->getIdDetails(RsGxsId(keyId), details);
|
||||||
|
|
||||||
|
QAction *addContact = contextMnu.addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
|
||||||
|
QAction *removeContact = contextMnu.addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
|
||||||
|
|
||||||
|
|
||||||
|
if(details.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT)
|
||||||
|
{
|
||||||
|
addContact->setVisible(false);
|
||||||
|
removeContact->setVisible(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addContact->setVisible(true);
|
||||||
|
removeContact->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
RsReputations::ReputationInfo info ;
|
RsReputations::ReputationInfo info ;
|
||||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||||
rsReputations->getReputationInfo(RsGxsId(Id),info) ;
|
rsReputations->getReputationInfo(RsGxsId(Id),info) ;
|
||||||
|
@ -974,12 +1004,13 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
contextMnu.addAction(ui->editIdentity);
|
||||||
|
contextMnu.addAction(ui->removeIdentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
|
||||||
|
|
||||||
contextMnu.addAction(ui->editIdentity);
|
|
||||||
contextMnu.addAction(ui->removeIdentity);
|
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
@ -1064,3 +1095,34 @@ void IdDialog::unbanPerson()
|
||||||
requestIdDetails();
|
requestIdDetails();
|
||||||
requestIdList();
|
requestIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IdDialog::addtoContacts()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||||
|
|
||||||
|
rsIdentity->setAsRegularContact(RsGxsId(Id),true);
|
||||||
|
|
||||||
|
requestIdList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IdDialog::removefromContacts()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||||
|
|
||||||
|
rsIdentity->setAsRegularContact(RsGxsId(Id),false);
|
||||||
|
|
||||||
|
requestIdList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,109 +1,114 @@
|
||||||
/*
|
/*
|
||||||
* Retroshare Identity.
|
* Retroshare Identity.
|
||||||
*
|
*
|
||||||
* Copyright 2012-2012 by Robert Fernie.
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
* License Version 2.1 as published by the Free Software Foundation.
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU Library General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA.
|
* USA.
|
||||||
*
|
*
|
||||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IDENTITYDIALOG_H
|
#ifndef IDENTITYDIALOG_H
|
||||||
#define IDENTITYDIALOG_H
|
#define IDENTITYDIALOG_H
|
||||||
|
|
||||||
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
||||||
|
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
|
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
#define IMAGE_IDDIALOG ":/icons/friends_128.png"
|
#define IMAGE_IDDIALOG ":/icons/friends_128.png"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class IdDialog;
|
class IdDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UIStateHelper;
|
class UIStateHelper;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|
||||||
class IdDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
|
class IdDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IdDialog(QWidget *parent = 0);
|
IdDialog(QWidget *parent = 0);
|
||||||
~IdDialog();
|
~IdDialog();
|
||||||
|
|
||||||
virtual QIcon iconPixmap() const { return QIcon(IMAGE_IDDIALOG) ; } //MainPage
|
virtual QIcon iconPixmap() const { return QIcon(IMAGE_IDDIALOG) ; } //MainPage
|
||||||
virtual QString pageName() const { return tr("People") ; } //MainPage
|
virtual QString pageName() const { return tr("People") ; } //MainPage
|
||||||
virtual QString helpText() const { return ""; } //MainPage
|
virtual QString helpText() const { return ""; } //MainPage
|
||||||
|
|
||||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void updateDisplay(bool complete);
|
virtual void updateDisplay(bool complete);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void filterComboBoxChanged();
|
void filterComboBoxChanged();
|
||||||
void filterChanged(const QString &text);
|
void filterChanged(const QString &text);
|
||||||
|
|
||||||
void addIdentity();
|
void addIdentity();
|
||||||
void removeIdentity();
|
void removeIdentity();
|
||||||
void editIdentity();
|
void editIdentity();
|
||||||
void chatIdentity();
|
void chatIdentity();
|
||||||
void sendMsg();
|
void sendMsg();
|
||||||
|
|
||||||
|
|
||||||
void updateSelection();
|
void updateSelection();
|
||||||
|
|
||||||
void todo();
|
void modifyReputation();
|
||||||
void modifyReputation();
|
|
||||||
|
/** Create the context popup menu and it's submenus */
|
||||||
/** Create the context popup menu and it's submenus */
|
void IdListCustomPopupMenu( QPoint point );
|
||||||
void IdListCustomPopupMenu( QPoint point );
|
|
||||||
|
void addtoContacts();
|
||||||
void banPerson();
|
void removefromContacts();
|
||||||
void unbanPerson();
|
|
||||||
|
void banPerson();
|
||||||
private:
|
void unbanPerson();
|
||||||
void processSettings(bool load);
|
|
||||||
|
private:
|
||||||
void requestIdDetails();
|
void processSettings(bool load);
|
||||||
void insertIdDetails(uint32_t token);
|
|
||||||
|
void requestIdDetails();
|
||||||
void requestIdList();
|
void insertIdDetails(uint32_t token);
|
||||||
void requestIdData(std::list<RsGxsGroupId> &ids);
|
|
||||||
bool fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept);
|
void requestIdList();
|
||||||
void insertIdList(uint32_t token);
|
void requestIdData(std::list<RsGxsGroupId> &ids);
|
||||||
void filterIds();
|
bool fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept);
|
||||||
|
void insertIdList(uint32_t token);
|
||||||
void requestRepList();
|
void filterIds();
|
||||||
void insertRepList(uint32_t token);
|
|
||||||
|
void requestRepList();
|
||||||
void requestIdEdit(std::string &id);
|
void insertRepList(uint32_t token);
|
||||||
void showIdEdit(uint32_t token);
|
|
||||||
|
void requestIdEdit(std::string &id);
|
||||||
private:
|
void showIdEdit(uint32_t token);
|
||||||
TokenQueue *mIdQueue;
|
|
||||||
UIStateHelper *mStateHelper;
|
private:
|
||||||
|
TokenQueue *mIdQueue;
|
||||||
RsGxsGroupId mId;
|
UIStateHelper *mStateHelper;
|
||||||
|
|
||||||
/* UI - Designer */
|
QTreeWidgetItem *contactsItem;
|
||||||
Ui::IdDialog *ui;
|
QTreeWidgetItem *allItem;
|
||||||
};
|
|
||||||
|
RsGxsGroupId mId;
|
||||||
#endif
|
|
||||||
|
/* UI - Designer */
|
||||||
|
Ui::IdDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -111,13 +111,6 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="todoPushButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Todo</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="helpButton">
|
<widget class="QToolButton" name="helpButton">
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
|
@ -221,6 +214,18 @@
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="indentation">
|
||||||
|
<number>24</number>
|
||||||
|
</property>
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -229,7 +234,7 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Identity name</string>
|
<string>Persons</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
|
@ -713,7 +718,6 @@ p, li { white-space: pre-wrap; }
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>todoPushButton</tabstop>
|
|
||||||
<tabstop>idTreeWidget</tabstop>
|
<tabstop>idTreeWidget</tabstop>
|
||||||
<tabstop>lineEdit_Nickname</tabstop>
|
<tabstop>lineEdit_Nickname</tabstop>
|
||||||
<tabstop>lineEdit_KeyId</tabstop>
|
<tabstop>lineEdit_KeyId</tabstop>
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
|
|
||||||
if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
|
if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
|
||||||
{
|
{
|
||||||
if(gxs_details.mIsOwnId)
|
if(gxs_details.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(NULL,QString("Cannot send message to yourself"),QString("This identity is owned by you. You wouldn't want to send yourself a message right?"));
|
QMessageBox::warning(NULL,QString("Cannot send message to yourself"),QString("This identity is owned by you. You wouldn't want to send yourself a message right?"));
|
||||||
break ;
|
break ;
|
||||||
|
|
|
@ -110,7 +110,7 @@ void CreateLobbyDialog::checkTextFields()
|
||||||
|
|
||||||
rsIdentity->getIdDetails(id,idd) ;
|
rsIdentity->getIdDetails(id,idd) ;
|
||||||
|
|
||||||
if( (!idd.mPgpKnown) && ui->pgp_signed_CB->isChecked())
|
if( (!(idd.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN)) && ui->pgp_signed_CB->isChecked())
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false) ;
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,6 +284,10 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
std::set<RsGxsId> gxsIdsSelected;
|
std::set<RsGxsId> gxsIdsSelected;
|
||||||
if (mShowTypes & SHOW_GXS)
|
if (mShowTypes & SHOW_GXS)
|
||||||
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
|
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
|
||||||
|
|
||||||
|
std::set<RsGxsId> gxsIdsSelected2;
|
||||||
|
if (mShowTypes & SHOW_CONTACTS)
|
||||||
|
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected2,true);
|
||||||
|
|
||||||
// remove old items
|
// remove old items
|
||||||
ui->friendList->clear();
|
ui->friendList->clear();
|
||||||
|
@ -525,6 +529,7 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
// iterate through gpg ids
|
// iterate through gpg ids
|
||||||
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
|
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
|
||||||
{
|
{
|
||||||
|
|
||||||
// we fill the not assigned gpg ids
|
// we fill the not assigned gpg ids
|
||||||
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
|
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
|
||||||
continue;
|
continue;
|
||||||
|
@ -570,6 +575,61 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
setSelected(mListModus, gxsItem, true);
|
setSelected(mListModus, gxsItem, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(mShowTypes & SHOW_CONTACTS)
|
||||||
|
{
|
||||||
|
// iterate through gpg ids
|
||||||
|
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
|
||||||
|
{
|
||||||
|
|
||||||
|
// we fill the not assigned gpg ids
|
||||||
|
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// add equal too, its no problem
|
||||||
|
filledIds.push_back((*gxsIt).toStdString());
|
||||||
|
|
||||||
|
RsIdentityDetails detail;
|
||||||
|
if (!rsIdentity->getIdDetails(RsGxsId(*gxsIt), detail))
|
||||||
|
continue; /* BAD */
|
||||||
|
|
||||||
|
QList<QIcon> icons ;
|
||||||
|
GxsIdDetails::getIcons(detail,icons,GxsIdDetails::ICON_TYPE_AVATAR) ;
|
||||||
|
QIcon identicon = icons.front() ;
|
||||||
|
|
||||||
|
if(detail.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT)
|
||||||
|
{
|
||||||
|
|
||||||
|
// make a widget per friend
|
||||||
|
gxsItem = new RSTreeWidgetItem(mCompareRole, IDTYPE_GXS);
|
||||||
|
|
||||||
|
QString name = QString::fromUtf8(detail.mNickname.c_str());
|
||||||
|
gxsItem->setText(COLUMN_NAME, name + " ("+QString::fromStdString( (*gxsIt).toStdString() )+")");
|
||||||
|
|
||||||
|
//gxsItem->setTextColor(COLUMN_NAME, textColorOnline());
|
||||||
|
gxsItem->setFlags(Qt::ItemIsUserCheckable | gxsItem->flags());
|
||||||
|
gxsItem->setIcon(COLUMN_NAME, identicon);
|
||||||
|
gxsItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.mId.toStdString()));
|
||||||
|
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||||
|
//TODO: online state for gxs items
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 1);
|
||||||
|
gxsItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||||
|
|
||||||
|
if (mListModus == MODUS_CHECK)
|
||||||
|
gxsItem->setCheckState(0, Qt::Unchecked);
|
||||||
|
|
||||||
|
ui->friendList->addTopLevelItem(gxsItem);
|
||||||
|
|
||||||
|
gxsItem->setExpanded(true);
|
||||||
|
|
||||||
|
emit itemAdded(IDTYPE_GXS, QString::fromStdString(detail.mId.toStdString()), gxsItem);
|
||||||
|
|
||||||
|
if (std::find(gxsIdsSelected.begin(), gxsIdsSelected.end(), detail.mId) != gxsIdsSelected.end())
|
||||||
|
setSelected(mListModus, gxsItem, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (groupIt != groupInfoList.end()) {
|
if (groupIt != groupInfoList.end()) {
|
||||||
++groupIt;
|
++groupIt;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -65,7 +65,8 @@ public:
|
||||||
SHOW_GPG = 2,
|
SHOW_GPG = 2,
|
||||||
SHOW_SSL = 4,
|
SHOW_SSL = 4,
|
||||||
SHOW_NON_FRIEND_GPG = 8,
|
SHOW_NON_FRIEND_GPG = 8,
|
||||||
SHOW_GXS =16
|
SHOW_GXS =16,
|
||||||
|
SHOW_CONTACTS =32
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(ShowTypes, ShowType)
|
Q_DECLARE_FLAGS(ShowTypes, ShowType)
|
||||||
|
|
|
@ -160,9 +160,9 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail
|
||||||
chooser->setItemData(index, (type == GXS_ID_DETAILS_TYPE_DONE) ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE);
|
chooser->setItemData(index, (type == GXS_ID_DETAILS_TYPE_DONE) ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE);
|
||||||
chooser->setItemIcon(index, icons.empty() ? QIcon() : icons[0]);
|
chooser->setItemIcon(index, icons.empty() ? QIcon() : icons[0]);
|
||||||
|
|
||||||
std::cerr << "ID=" << details.mId << ", chooser->flags()=" << chooser->flags() << ", pgpLinked=" << details.mPgpLinked ;
|
std::cerr << "ID=" << details.mId << ", chooser->flags()=" << chooser->flags() << ", flags=" << details.mFlags ;
|
||||||
|
|
||||||
if((chooser->flags() & IDCHOOSER_NON_ANONYMOUS) && !(details.mPgpLinked))
|
if((chooser->flags() & IDCHOOSER_NON_ANONYMOUS) && !(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
{
|
{
|
||||||
std::cerr << " - disabling ID - entry = " << index << std::endl;
|
std::cerr << " - disabling ID - entry = " << index << std::endl;
|
||||||
chooser->setEntryEnabled(index,false) ;
|
chooser->setEntryEnabled(index,false) ;
|
||||||
|
|
|
@ -912,11 +912,11 @@ QString nickname ;
|
||||||
QApplication::translate("GxsIdDetails", "Identity Id"),
|
QApplication::translate("GxsIdDetails", "Identity Id"),
|
||||||
QString::fromStdString(details.mId.toStdString()));
|
QString::fromStdString(details.mId.toStdString()));
|
||||||
|
|
||||||
if (details.mPgpLinked)
|
if (details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED)
|
||||||
{
|
{
|
||||||
comment += QString("<br/>%1:%2 ").arg(QApplication::translate("GxsIdDetails", "Authentication"), QApplication::translate("GxsIdDetails", "Signed by"));
|
comment += QString("<br/>%1:%2 ").arg(QApplication::translate("GxsIdDetails", "Authentication"), QApplication::translate("GxsIdDetails", "Signed by"));
|
||||||
|
|
||||||
if (details.mPgpKnown)
|
if (details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN)
|
||||||
{
|
{
|
||||||
/* look up real name */
|
/* look up real name */
|
||||||
std::string authorName = rsPeers->getGPGName(details.mPgpId);
|
std::string authorName = rsPeers->getGPGName(details.mPgpId);
|
||||||
|
@ -962,9 +962,9 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
||||||
{
|
{
|
||||||
// ICON Logic.
|
// ICON Logic.
|
||||||
QIcon baseIcon;
|
QIcon baseIcon;
|
||||||
if (details.mPgpLinked)
|
if (details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED)
|
||||||
{
|
{
|
||||||
if (details.mPgpKnown)
|
if (details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN)
|
||||||
baseIcon = QIcon(IMAGE_PGPKNOWN);
|
baseIcon = QIcon(IMAGE_PGPKNOWN);
|
||||||
else
|
else
|
||||||
baseIcon = QIcon(IMAGE_PGPUNKNOWN);
|
baseIcon = QIcon(IMAGE_PGPUNKNOWN);
|
||||||
|
|
|
@ -266,10 +266,11 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
||||||
ui.respond_to_CB->setFlags(IDCHOOSER_ID_REQUIRED) ;
|
ui.respond_to_CB->setFlags(IDCHOOSER_ID_REQUIRED) ;
|
||||||
|
|
||||||
/* Add filter types */
|
/* Add filter types */
|
||||||
ui.filterComboBox->addItem(tr("All"));
|
ui.filterComboBox->addItem(tr("All addresses (mixed)"));
|
||||||
ui.filterComboBox->addItem(tr("Friend Nodes"));
|
ui.filterComboBox->addItem(tr("Friend Nodes"));
|
||||||
ui.filterComboBox->addItem(tr("Distant peer identities"));
|
ui.filterComboBox->addItem(tr("All people"));
|
||||||
ui.filterComboBox->setCurrentIndex(0);
|
ui.filterComboBox->addItem(tr("My contacts"));
|
||||||
|
ui.filterComboBox->setCurrentIndex(3);
|
||||||
|
|
||||||
connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(changeFormatType(int)));
|
connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(changeFormatType(int)));
|
||||||
connect(ui.comboFont, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &)));
|
connect(ui.comboFont, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &)));
|
||||||
|
@ -2569,6 +2570,11 @@ void MessageComposer::filterComboBoxChanged(int i)
|
||||||
|
|
||||||
case 2: ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GXS) ;
|
case 2: ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GXS) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
|
|
||||||
|
case 3: ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_CONTACTS) ;
|
||||||
|
break ;
|
||||||
|
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>925</width>
|
<width>1679</width>
|
||||||
<height>747</height>
|
<height>951</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -56,14 +56,14 @@
|
||||||
<set>QDockWidget::DockWidgetClosable</set>
|
<set>QDockWidget::DockWidgetClosable</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Contacts</string>
|
<string>Address list:</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="margin">
|
<item>
|
||||||
<number>1</number>
|
<widget class="QComboBox" name="filterComboBox"/>
|
||||||
</property>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="FriendSelectionWidget" name="friendSelectionWidget" native="true">
|
<widget class="FriendSelectionWidget" name="friendSelectionWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
@ -100,25 +100,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addToButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>>> To</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
@ -130,7 +113,20 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>>> Cc</string>
|
<string>Cc</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addToButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>To</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -143,7 +139,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>>> Bcc</string>
|
<string>Bcc</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -160,7 +156,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>>> Recommend</string>
|
<string>Recommend this friend</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -168,23 +164,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="filterComboBox"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1105,8 +1084,8 @@ border-image: url(:/images/closepressed.png)
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>925</width>
|
<width>1679</width>
|
||||||
<height>21</height>
|
<height>37</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1238,8 +1217,6 @@ border-image: url(:/images/closepressed.png)
|
||||||
<tabstop>titleEdit</tabstop>
|
<tabstop>titleEdit</tabstop>
|
||||||
<tabstop>msgText</tabstop>
|
<tabstop>msgText</tabstop>
|
||||||
<tabstop>msgFileList</tabstop>
|
<tabstop>msgFileList</tabstop>
|
||||||
<tabstop>addToButton</tabstop>
|
|
||||||
<tabstop>addCcButton</tabstop>
|
|
||||||
<tabstop>addBccButton</tabstop>
|
<tabstop>addBccButton</tabstop>
|
||||||
<tabstop>addRecommendButton</tabstop>
|
<tabstop>addRecommendButton</tabstop>
|
||||||
<tabstop>comboSize</tabstop>
|
<tabstop>comboSize</tabstop>
|
||||||
|
|
|
@ -100,6 +100,8 @@ ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect(ui.distantChatcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantChatComboBoxChanged(int)));
|
||||||
|
|
||||||
#if QT_VERSION < 0x040600
|
#if QT_VERSION < 0x040600
|
||||||
ui.minimumContrastLabel->hide();
|
ui.minimumContrastLabel->hide();
|
||||||
ui.minimumContrast->hide();
|
ui.minimumContrast->hide();
|
||||||
|
@ -120,6 +122,8 @@ ChatPage::save(QString &/*errmsg*/)
|
||||||
Settings->setValue("EnableItalics", ui.checkBox_enableItalics->isChecked());
|
Settings->setValue("EnableItalics", ui.checkBox_enableItalics->isChecked());
|
||||||
Settings->setValue("MinimumContrast", ui.minimumContrast->value());
|
Settings->setValue("MinimumContrast", ui.minimumContrast->value());
|
||||||
Settings->endGroup();
|
Settings->endGroup();
|
||||||
|
// state of distant Chat combobox
|
||||||
|
Settings->setValue("DistantChat", ui.distantChatcomboBox->currentIndex());
|
||||||
|
|
||||||
Settings->setChatScreenFont(fontTempChat.toString());
|
Settings->setChatScreenFont(fontTempChat.toString());
|
||||||
NotifyQt::getInstance()->notifyChatFontChanged();
|
NotifyQt::getInstance()->notifyChatFontChanged();
|
||||||
|
@ -226,6 +230,10 @@ ChatPage::load()
|
||||||
ui.minimumContrast->setValue(Settings->value("MinimumContrast", 4.5).toDouble());
|
ui.minimumContrast->setValue(Settings->value("MinimumContrast", 4.5).toDouble());
|
||||||
Settings->endGroup();
|
Settings->endGroup();
|
||||||
|
|
||||||
|
// state of distant Chat combobox
|
||||||
|
int index = Settings->value("DistantChat", 0).toInt();
|
||||||
|
ui.distantChatcomboBox->setCurrentIndex(index);
|
||||||
|
|
||||||
fontTempChat.fromString(Settings->getChatScreenFont());
|
fontTempChat.fromString(Settings->getChatScreenFont());
|
||||||
|
|
||||||
ui.sendMessageWithCtrlReturn->setChecked(Settings->getChatSendMessageWithCtrlReturn());
|
ui.sendMessageWithCtrlReturn->setChecked(Settings->getChatSendMessageWithCtrlReturn());
|
||||||
|
@ -493,3 +501,22 @@ void ChatPage::on_btSearch_FoundColor_clicked()
|
||||||
ui.btSearch_FoundColor->setIcon(pix);
|
ui.btSearch_FoundColor->setIcon(pix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatPage::distantChatComboBoxChanged(int i)
|
||||||
|
{
|
||||||
|
switch(i)
|
||||||
|
{
|
||||||
|
case 0: ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case 1: ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case 2: ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,79 +1,81 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* RetroShare is distributed under the following license:
|
* RetroShare is distributed under the following license:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 - 2010 RetroShare Team
|
* Copyright (C) 2006 - 2010 RetroShare Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#ifndef _CHATPAGE_H
|
#ifndef _CHATPAGE_H
|
||||||
#define _CHATPAGE_H
|
#define _CHATPAGE_H
|
||||||
|
|
||||||
#include <retroshare-gui/configpage.h>
|
#include <retroshare-gui/configpage.h>
|
||||||
#include "ui_ChatPage.h"
|
#include "ui_ChatPage.h"
|
||||||
|
|
||||||
class ChatPage : public ConfigPage
|
class ChatPage : public ConfigPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
ChatPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
ChatPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~ChatPage() {}
|
~ChatPage() {}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
virtual bool save(QString &errmsg);
|
virtual bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
virtual QPixmap iconPixmap() const { return QPixmap(":/images/chat_24.png") ; }
|
virtual QPixmap iconPixmap() const { return QPixmap(":/images/chat_24.png") ; }
|
||||||
virtual QString pageName() const { return tr("Chat") ; }
|
virtual QString pageName() const { return tr("Chat") ; }
|
||||||
virtual QString helpText() const { return ""; }
|
virtual QString helpText() const { return ""; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_historyComboBoxVariant_currentIndexChanged(int index);
|
void on_historyComboBoxVariant_currentIndexChanged(int index);
|
||||||
void on_privateComboBoxVariant_currentIndexChanged(int index);
|
void on_privateComboBoxVariant_currentIndexChanged(int index);
|
||||||
void on_publicComboBoxVariant_currentIndexChanged(int index);
|
void on_publicComboBoxVariant_currentIndexChanged(int index);
|
||||||
void on_pushButtonChangeChatFont_clicked();
|
void on_pushButtonChangeChatFont_clicked();
|
||||||
void on_publicList_currentRowChanged(int currentRow);
|
void on_publicList_currentRowChanged(int currentRow);
|
||||||
void on_privateList_currentRowChanged(int currentRow);
|
void on_privateList_currentRowChanged(int currentRow);
|
||||||
void on_historyList_currentRowChanged(int currentRow);
|
void on_historyList_currentRowChanged(int currentRow);
|
||||||
|
|
||||||
void on_cbSearch_WithoutLimit_toggled(bool);
|
void on_cbSearch_WithoutLimit_toggled(bool);
|
||||||
void on_btSearch_FoundColor_clicked();
|
void on_btSearch_FoundColor_clicked();
|
||||||
|
|
||||||
|
void distantChatComboBoxChanged(int);
|
||||||
private:
|
|
||||||
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
|
||||||
void fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
private:
|
||||||
|
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
||||||
QFont fontTempChat;
|
void fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
||||||
|
|
||||||
QString publicStylePath;
|
QFont fontTempChat;
|
||||||
QString publicStyleVariant;
|
|
||||||
QString privateStylePath;
|
QString publicStylePath;
|
||||||
QString privateStyleVariant;
|
QString publicStyleVariant;
|
||||||
QString historyStylePath;
|
QString privateStylePath;
|
||||||
QString historyStyleVariant;
|
QString privateStyleVariant;
|
||||||
|
QString historyStylePath;
|
||||||
QRgb rgbChatSearchFoundColor;
|
QString historyStyleVariant;
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
QRgb rgbChatSearchFoundColor;
|
||||||
Ui::ChatPage ui;
|
|
||||||
};
|
/** Qt Designer generated object */
|
||||||
|
Ui::ChatPage ui;
|
||||||
#endif
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,8 +20,43 @@
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>General</string>
|
<string>General</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<item>
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Distant Chat</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QComboBox" name="distantChatcomboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Everyone</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Contacts</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Nobody</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="distantchatlabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Accept encrypted distant chat from</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
@ -240,7 +275,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
|
|
@ -1,239 +1,269 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* RetroShare is distributed under the following license:
|
* RetroShare is distributed under the following license:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, crypton
|
* Copyright (C) 2006, crypton
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include "rsharesettings.h"
|
#include "rsharesettings.h"
|
||||||
#include "retroshare/rsmsgs.h"
|
#include "retroshare/rsmsgs.h"
|
||||||
|
|
||||||
#include "MessagePage.h"
|
#include "MessagePage.h"
|
||||||
#include "gui/common/TagDefs.h"
|
#include "gui/common/TagDefs.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "NewTag.h"
|
#include "NewTag.h"
|
||||||
|
|
||||||
MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
||||||
: ConfigPage(parent, flags)
|
: ConfigPage(parent, flags)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
m_pTags = new MsgTagType;
|
m_pTags = new MsgTagType;
|
||||||
|
|
||||||
connect (ui.addpushButton, SIGNAL(clicked(bool)), this, SLOT (addTag()));
|
connect (ui.addpushButton, SIGNAL(clicked(bool)), this, SLOT (addTag()));
|
||||||
connect (ui.editpushButton, SIGNAL(clicked(bool)), this, SLOT (editTag()));
|
connect (ui.editpushButton, SIGNAL(clicked(bool)), this, SLOT (editTag()));
|
||||||
connect (ui.deletepushButton, SIGNAL(clicked(bool)), this, SLOT (deleteTag()));
|
connect (ui.deletepushButton, SIGNAL(clicked(bool)), this, SLOT (deleteTag()));
|
||||||
connect (ui.defaultTagButton, SIGNAL(clicked(bool)), this, SLOT (defaultTag()));
|
connect (ui.defaultTagButton, SIGNAL(clicked(bool)), this, SLOT (defaultTag()));
|
||||||
connect (ui.encryptedMsgs_CB, SIGNAL(toggled(bool)), this, SLOT (toggleEnableEncryptedDistantMsgs(bool)));
|
//connect (ui.encryptedMsgs_CB, SIGNAL(toggled(bool)), this, SLOT (toggleEnableEncryptedDistantMsgs(bool)));
|
||||||
|
|
||||||
connect (ui.tags_listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChangedTag(int)));
|
connect (ui.tags_listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChangedTag(int)));
|
||||||
|
|
||||||
ui.editpushButton->setEnabled(false);
|
ui.editpushButton->setEnabled(false);
|
||||||
ui.deletepushButton->setEnabled(false);
|
ui.deletepushButton->setEnabled(false);
|
||||||
|
|
||||||
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
|
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
|
||||||
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
|
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
|
||||||
|
|
||||||
//ui.encryptedMsgs_CB->setEnabled(false) ;
|
connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantMsgsComboBoxChanged(int)));
|
||||||
}
|
|
||||||
|
|
||||||
MessagePage::~MessagePage()
|
//ui.encryptedMsgs_CB->setEnabled(false) ;
|
||||||
{
|
}
|
||||||
delete(m_pTags);
|
|
||||||
}
|
MessagePage::~MessagePage()
|
||||||
|
{
|
||||||
void MessagePage::toggleEnableEncryptedDistantMsgs(bool b)
|
delete(m_pTags);
|
||||||
{
|
}
|
||||||
rsMail->enableDistantMessaging(b) ;
|
|
||||||
}
|
void MessagePage::distantMsgsComboBoxChanged(int i)
|
||||||
|
{
|
||||||
/** Saves the changes on this page */
|
switch(i)
|
||||||
bool
|
{
|
||||||
MessagePage::save(QString &/*errmsg*/)
|
case 0: rsMail->setDistantMessagingPermissionFlags(RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_EVERYBODY |RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_CONTACT_LIST) ;
|
||||||
{
|
break ;
|
||||||
Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
|
|
||||||
Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
|
case 1: rsMail->setDistantMessagingPermissionFlags(RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_CONTACT_LIST) ;
|
||||||
Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());
|
break ;
|
||||||
|
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
case 2: rsMail->setDistantMessagingPermissionFlags(RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_NONE) ;
|
||||||
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
break ;
|
||||||
// check for changed tags
|
|
||||||
std::list<uint32_t>::iterator changedTagId;
|
|
||||||
for (changedTagId = m_changedTagIds.begin(); changedTagId != m_changedTagIds.end(); ++changedTagId) {
|
default: ;
|
||||||
if (*changedTagId == Tag->first) {
|
}
|
||||||
if (Tag->second.first.empty()) {
|
|
||||||
// delete tag
|
}
|
||||||
rsMail->removeMessageTagType(Tag->first);
|
|
||||||
continue;
|
/** Saves the changes on this page */
|
||||||
}
|
bool
|
||||||
|
MessagePage::save(QString &/*errmsg*/)
|
||||||
rsMail->setMessageTagType(Tag->first, Tag->second.first, Tag->second.second);
|
{
|
||||||
break;
|
Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
|
||||||
}
|
Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
|
||||||
}
|
Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());
|
||||||
}
|
|
||||||
|
// state of distant Message combobox
|
||||||
return true;
|
Settings->setValue("DistantMessages", ui.comboBox->currentIndex());
|
||||||
}
|
|
||||||
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
/** Loads the settings for this page */
|
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
||||||
void
|
// check for changed tags
|
||||||
MessagePage::load()
|
std::list<uint32_t>::iterator changedTagId;
|
||||||
{
|
for (changedTagId = m_changedTagIds.begin(); changedTagId != m_changedTagIds.end(); ++changedTagId) {
|
||||||
ui.setMsgToReadOnActivate->setChecked(Settings->getMsgSetToReadOnActivate());
|
if (*changedTagId == Tag->first) {
|
||||||
ui.loadEmbeddedImages->setChecked(Settings->getMsgLoadEmbeddedImages());
|
if (Tag->second.first.empty()) {
|
||||||
ui.openComboBox->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
|
// delete tag
|
||||||
|
rsMail->removeMessageTagType(Tag->first);
|
||||||
ui.encryptedMsgs_CB->setChecked(rsMail->distantMessagingEnabled()) ;
|
continue;
|
||||||
// fill items
|
}
|
||||||
rsMail->getMessageTagTypes(*m_pTags);
|
|
||||||
fillTags();
|
rsMail->setMessageTagType(Tag->first, Tag->second.first, Tag->second.second);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
// fill tags
|
}
|
||||||
void MessagePage::fillTags()
|
}
|
||||||
{
|
|
||||||
ui.tags_listWidget->clear();
|
return true;
|
||||||
|
}
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
|
||||||
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
/** Loads the settings for this page */
|
||||||
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
void
|
||||||
|
MessagePage::load()
|
||||||
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
{
|
||||||
pItemWidget->setTextColor(QColor(Tag->second.second));
|
ui.setMsgToReadOnActivate->setChecked(Settings->getMsgSetToReadOnActivate());
|
||||||
pItemWidget->setData(Qt::UserRole, Tag->first);
|
ui.loadEmbeddedImages->setChecked(Settings->getMsgLoadEmbeddedImages());
|
||||||
}
|
ui.openComboBox->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
|
||||||
}
|
|
||||||
|
// state of filter combobox
|
||||||
void MessagePage::addTag()
|
|
||||||
{
|
uint32_t flags = rsMail->getDistantMessagingPermissionFlags() ;
|
||||||
NewTag TagDlg(*m_pTags);
|
|
||||||
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
if(flags == (RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_CONTACT_LIST | RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_EVERYBODY))
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
ui.comboBox->setCurrentIndex(2);
|
||||||
Tag = m_pTags->types.find(TagDlg.m_nId);
|
else if(flags == RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_CONTACT_LIST)
|
||||||
if (Tag != m_pTags->types.end()) {
|
ui.comboBox->setCurrentIndex(1);
|
||||||
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
else
|
||||||
|
ui.comboBox->setCurrentIndex(0);
|
||||||
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
|
||||||
pItemWidget->setTextColor(QColor(Tag->second.second));
|
// fill items
|
||||||
pItemWidget->setData(Qt::UserRole, TagDlg.m_nId);
|
rsMail->getMessageTagTypes(*m_pTags);
|
||||||
|
fillTags();
|
||||||
m_changedTagIds.push_back(TagDlg.m_nId);
|
}
|
||||||
}
|
|
||||||
}
|
// fill tags
|
||||||
}
|
void MessagePage::fillTags()
|
||||||
|
{
|
||||||
void MessagePage::editTag()
|
ui.tags_listWidget->clear();
|
||||||
{
|
|
||||||
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
if (pItemWidget == NULL) {
|
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
||||||
return;
|
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
||||||
}
|
|
||||||
|
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
||||||
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
pItemWidget->setTextColor(QColor(Tag->second.second));
|
||||||
if (nId == 0) {
|
pItemWidget->setData(Qt::UserRole, Tag->first);
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NewTag TagDlg(*m_pTags, nId);
|
void MessagePage::addTag()
|
||||||
TagDlg.setWindowTitle(tr("Edit Tag"));
|
{
|
||||||
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
NewTag TagDlg(*m_pTags);
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
||||||
Tag = m_pTags->types.find(TagDlg.m_nId);
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
if (Tag != m_pTags->types.end()) {
|
Tag = m_pTags->types.find(TagDlg.m_nId);
|
||||||
if (Tag->first >= RS_MSGTAGTYPE_USER) {
|
if (Tag != m_pTags->types.end()) {
|
||||||
pItemWidget->setText(QString::fromStdString(Tag->second.first));
|
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
||||||
}
|
|
||||||
pItemWidget->setTextColor(QColor(Tag->second.second));
|
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
||||||
|
pItemWidget->setTextColor(QColor(Tag->second.second));
|
||||||
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), TagDlg.m_nId) == m_changedTagIds.end()) {
|
pItemWidget->setData(Qt::UserRole, TagDlg.m_nId);
|
||||||
m_changedTagIds.push_back(TagDlg.m_nId);
|
|
||||||
}
|
m_changedTagIds.push_back(TagDlg.m_nId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagePage::deleteTag()
|
void MessagePage::editTag()
|
||||||
{
|
{
|
||||||
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
||||||
if (pItemWidget == NULL) {
|
if (pItemWidget == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
||||||
if (nId == 0) {
|
if (nId == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nId < RS_MSGTAGTYPE_USER) {
|
NewTag TagDlg(*m_pTags, nId);
|
||||||
// can't delete standard tag item
|
TagDlg.setWindowTitle(tr("Edit Tag"));
|
||||||
return;
|
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
||||||
}
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
|
Tag = m_pTags->types.find(TagDlg.m_nId);
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
if (Tag != m_pTags->types.end()) {
|
||||||
Tag = m_pTags->types.find(nId);
|
if (Tag->first >= RS_MSGTAGTYPE_USER) {
|
||||||
if (Tag != m_pTags->types.end()) {
|
pItemWidget->setText(QString::fromStdString(Tag->second.first));
|
||||||
// erase the text for later delete
|
}
|
||||||
Tag->second.first.erase();
|
pItemWidget->setTextColor(QColor(Tag->second.second));
|
||||||
}
|
|
||||||
|
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), TagDlg.m_nId) == m_changedTagIds.end()) {
|
||||||
ui.tags_listWidget->removeItemWidget(pItemWidget);
|
m_changedTagIds.push_back(TagDlg.m_nId);
|
||||||
delete (pItemWidget);
|
}
|
||||||
|
}
|
||||||
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), nId) == m_changedTagIds.end()) {
|
}
|
||||||
m_changedTagIds.push_back(nId);
|
}
|
||||||
}
|
|
||||||
}
|
void MessagePage::deleteTag()
|
||||||
|
{
|
||||||
void MessagePage::defaultTag()
|
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
||||||
{
|
if (pItemWidget == NULL) {
|
||||||
rsMail->resetMessageStandardTagTypes(*m_pTags);
|
return;
|
||||||
|
}
|
||||||
// add all standard items to changed list
|
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
||||||
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
if (nId == 0) {
|
||||||
if (Tag->first < RS_MSGTAGTYPE_USER) {
|
return;
|
||||||
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), Tag->first) == m_changedTagIds.end()) {
|
}
|
||||||
m_changedTagIds.push_back(Tag->first);
|
|
||||||
}
|
if (nId < RS_MSGTAGTYPE_USER) {
|
||||||
}
|
// can't delete standard tag item
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
fillTags();
|
|
||||||
}
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
|
Tag = m_pTags->types.find(nId);
|
||||||
void MessagePage::currentRowChangedTag(int row)
|
if (Tag != m_pTags->types.end()) {
|
||||||
{
|
// erase the text for later delete
|
||||||
QListWidgetItem *pItemWidget = ui.tags_listWidget->item(row);
|
Tag->second.first.erase();
|
||||||
|
}
|
||||||
bool bEditEnable = false;
|
|
||||||
bool bDeleteEnable = false;
|
ui.tags_listWidget->removeItemWidget(pItemWidget);
|
||||||
|
delete (pItemWidget);
|
||||||
if (pItemWidget) {
|
|
||||||
bEditEnable = true;
|
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), nId) == m_changedTagIds.end()) {
|
||||||
|
m_changedTagIds.push_back(nId);
|
||||||
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
}
|
||||||
|
}
|
||||||
if (nId >= RS_MSGTAGTYPE_USER) {
|
|
||||||
bDeleteEnable = true;
|
void MessagePage::defaultTag()
|
||||||
}
|
{
|
||||||
}
|
rsMail->resetMessageStandardTagTypes(*m_pTags);
|
||||||
|
|
||||||
ui.editpushButton->setEnabled(bEditEnable);
|
// add all standard items to changed list
|
||||||
ui.deletepushButton->setEnabled(bDeleteEnable);
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
}
|
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
||||||
|
if (Tag->first < RS_MSGTAGTYPE_USER) {
|
||||||
|
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), Tag->first) == m_changedTagIds.end()) {
|
||||||
|
m_changedTagIds.push_back(Tag->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fillTags();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagePage::currentRowChangedTag(int row)
|
||||||
|
{
|
||||||
|
QListWidgetItem *pItemWidget = ui.tags_listWidget->item(row);
|
||||||
|
|
||||||
|
bool bEditEnable = false;
|
||||||
|
bool bDeleteEnable = false;
|
||||||
|
|
||||||
|
if (pItemWidget) {
|
||||||
|
bEditEnable = true;
|
||||||
|
|
||||||
|
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
||||||
|
|
||||||
|
if (nId >= RS_MSGTAGTYPE_USER) {
|
||||||
|
bDeleteEnable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.editpushButton->setEnabled(bEditEnable);
|
||||||
|
ui.deletepushButton->setEnabled(bDeleteEnable);
|
||||||
|
}
|
||||||
|
|
|
@ -1,70 +1,71 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* RetroShare is distributed under the following license:
|
* RetroShare is distributed under the following license:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, crypton
|
* Copyright (C) 2006, crypton
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#ifndef MESSAGEPAGE_H
|
#ifndef MESSAGEPAGE_H
|
||||||
#define MESSAGEPAGE_H
|
#define MESSAGEPAGE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <retroshare-gui/configpage.h>
|
#include <retroshare-gui/configpage.h>
|
||||||
#include "ui_MessagePage.h"
|
#include "ui_MessagePage.h"
|
||||||
|
|
||||||
#include "gui/msgs/MessageInterface.h"
|
#include "gui/msgs/MessageInterface.h"
|
||||||
|
|
||||||
class MessagePage : public ConfigPage
|
class MessagePage : public ConfigPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MessagePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
MessagePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~MessagePage();
|
~MessagePage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
virtual bool save(QString &errmsg);
|
virtual bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
virtual QPixmap iconPixmap() const { return QPixmap(":/images/evolution.png") ; }
|
virtual QPixmap iconPixmap() const { return QPixmap(":/images/evolution.png") ; }
|
||||||
virtual QString pageName() const { return tr("Message") ; }
|
virtual QString pageName() const { return tr("Message") ; }
|
||||||
virtual QString helpText() const { return ""; }
|
virtual QString helpText() const { return ""; }
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addTag();
|
void addTag();
|
||||||
void editTag();
|
void editTag();
|
||||||
void deleteTag();
|
void deleteTag();
|
||||||
void defaultTag();
|
void defaultTag();
|
||||||
|
|
||||||
void currentRowChangedTag(int row);
|
void currentRowChangedTag(int row);
|
||||||
void toggleEnableEncryptedDistantMsgs(bool) ;
|
void distantMsgsComboBoxChanged(int);
|
||||||
|
|
||||||
private:
|
|
||||||
void fillTags();
|
private:
|
||||||
|
void fillTags();
|
||||||
/* Pointer for not include of rsmsgs.h */
|
|
||||||
MsgTagType *m_pTags;
|
/* Pointer for not include of rsmsgs.h */
|
||||||
std::list<uint32_t> m_changedTagIds;
|
MsgTagType *m_pTags;
|
||||||
|
std::list<uint32_t> m_changedTagIds;
|
||||||
Ui::MessagePage ui;
|
|
||||||
};
|
Ui::MessagePage ui;
|
||||||
|
};
|
||||||
#endif // !MESSAGEPAGE_H
|
|
||||||
|
#endif // !MESSAGEPAGE_H
|
||||||
|
|
||||||
|
|
|
@ -59,21 +59,30 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Distant messages:</string>
|
<string>Distant messages:</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item>
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QComboBox" name="comboBox">
|
||||||
<property name="text">
|
<item>
|
||||||
<string><html><head/><body><p align="justify">The link below allows people in the network to send encrypted messages to you, using tunnels. To do that, they need your public PGP key, which they will get using the Retroshare discovery system. </p></body></html></string>
|
<property name="text">
|
||||||
</property>
|
<string>Everyone</string>
|
||||||
<property name="wordWrap">
|
</property>
|
||||||
<bool>true</bool>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Contacts</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Nobody</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QCheckBox" name="encryptedMsgs_CB">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Accept encrypted distant messages from everyone</string>
|
<string>Accept encrypted distant messages from</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue