Added Phenom's patch AddGxsIdDeleting_v0.6_7328.patch

Changed some context menu icons for GxsGroupFrameDialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7337 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-05-06 17:15:20 +00:00
parent d2bd938e82
commit a9dcd24ba7
17 changed files with 275 additions and 71 deletions

View File

@ -53,13 +53,13 @@
#define MSG_CLEANUP_PERIOD 60*5 // 5 minutes
#define INTEGRITY_CHECK_PERIOD 60*30 // 30 minutes
RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns,
RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs,
uint32_t authenPolicy, uint32_t messageStorePeriod)
: mGenMtx("GenExchange"),
mDataStore(gds),
mNetService(ns),
mSerialiser(serviceSerialiser),
RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns,
RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs,
uint32_t authenPolicy, uint32_t messageStorePeriod)
: mGenMtx("GenExchange"),
mDataStore(gds),
mNetService(ns),
mSerialiser(serviceSerialiser),
mServType(servType),
mGixs(gixs),
mAuthenPolicy(authenPolicy),
@ -130,12 +130,14 @@ void RsGenExchange::tick()
publishGrps();
publishMsgs();
processGroupUpdatePublish();
processRecvdData();
if(!mNotifications.empty())
processGroupUpdatePublish();
processGroupDelete();
processRecvdData();
if(!mNotifications.empty())
{
notifyChanges(mNotifications);
mNotifications.clear();
@ -1029,18 +1031,18 @@ bool RsGenExchange::subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId,
setGroupSubscribeFlags(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED,
(GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED | GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED));
return true;
}
bool RsGenExchange::getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats)
{
return false;
}
bool RsGenExchange::getServiceStatistic(const uint32_t& token, GxsServiceStatistic& stats)
{
return false;
}
return true;
}
bool RsGenExchange::getGroupStatistic(const uint32_t& /*token*/, GxsGroupStatistic& /*stats*/)
{
return false;
}
bool RsGenExchange::getServiceStatistic(const uint32_t& /*token*/, GxsServiceStatistic& /*stats*/)
{
return false;
}
bool RsGenExchange::updated(bool willCallGrpChanged, bool willCallMsgChanged)
{
@ -1457,12 +1459,23 @@ void RsGenExchange::updateGroup(uint32_t& token, RsGxsGrpItem* grpItem)
#ifdef GEN_EXCH_DEBUG
std::cerr << "RsGenExchange::updateGroup() token: " << token;
std::cerr << std::endl;
#endif
}
void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
{
#endif
}
void RsGenExchange::deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem)
{
RsStackMutex stack(mGenMtx);
token = mDataAccess->generatePublicToken();
mGroupDeletePublish.push_back(GroupDeletePublish(grpItem, token));
#ifdef GEN_EXCH_DEBUG
std::cerr << "RsGenExchange::deleteGroup() token: " << token;
std::cerr << std::endl;
#endif
}
void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
{
RsStackMutex stack(mGenMtx);
token = mDataAccess->generatePublicToken();
mMsgsToPublish.insert(std::make_pair(token, msgItem));
@ -1944,12 +1957,60 @@ void RsGenExchange::processGroupUpdatePublish()
delete meta;
}
mGroupUpdatePublish.clear();
}
bool RsGenExchange::checkKeys(const RsTlvSecurityKeySet& keySet)
{
mGroupUpdatePublish.clear();
}
void RsGenExchange::processGroupDelete()
{
RsStackMutex stack(mGenMtx);
// get keys for group delete publish
typedef std::pair<bool, RsGxsGroupId> GrpNote;
std::map<uint32_t, GrpNote> toNotify;
std::vector<GroupDeletePublish>::iterator vit = mGroupDeletePublish.begin();
for(; vit != mGroupDeletePublish.end(); vit++)
{
GroupDeletePublish& gdp = *vit;
uint32_t token = gdp.mToken;
const RsGxsGroupId& groupId = gdp.grpItem->meta.mGroupId;
std::vector<RsGxsGroupId> gprIds;
gprIds.push_back(groupId);
mDataStore->removeGroups(gprIds);
toNotify.insert(std::make_pair(
token, GrpNote(true, RsGxsGroupId())));
}
std::list<RsGxsGroupId> grpDeleted;
std::map<uint32_t, GrpNote>::iterator mit = toNotify.begin();
for(; mit != toNotify.end(); mit++)
{
GrpNote& note = mit->second;
uint8_t status = note.first ? RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
: RsTokenService::GXS_REQUEST_V2_STATUS_FAILED;
mGrpNotify.insert(std::make_pair(mit->first, note.second));
mDataAccess->updatePublicRequestStatus(mit->first, status);
if(note.first)
grpDeleted.push_back(note.second);
}
if(!grpDeleted.empty())
{
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH);
gc->mGrpIdList = grpDeleted;
mNotifications.push_back(gc);
}
mGroupDeletePublish.clear();
}
bool RsGenExchange::checkKeys(const RsTlvSecurityKeySet& keySet)
{
typedef std::map<std::string, RsTlvSecurityKey> keyMap;
const keyMap& allKeys = keySet.keys;
keyMap::const_iterator cit = allKeys.begin();

View File

@ -526,22 +526,30 @@ protected:
* Ownership of item passes to this rsgenexchange \n
* @param token
* @param grpItem
*/
void publishGroup(uint32_t& token, RsGxsGrpItem* grpItem);
/*!
* Updates an existing group item \n
* This will induce a related change message \n
*/
void publishGroup(uint32_t& token, RsGxsGrpItem* grpItem);
/*!
* Updates an existing group item \n
* This will induce a related change message \n
* Ownership of item passes to this rsgenexchange \n
* @param token
* @param grpItem
*/
void updateGroup(uint32_t& token, RsGxsGrpItem* grpItem);
public:
/*!
* Enables publication of a message item \n
*/
void updateGroup(uint32_t& token, RsGxsGrpItem* grpItem);
/*!
* Deletes an existing group item \n
* This will induce a related change message \n
* Ownership of item passes to this rsgenexchange \n
* @param token
* @param grpItem
*/
void deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem);
public:
/*!
* Enables publication of a message item \n
* Setting mOrigMsgId meta member to blank \n
* leads to this msg being an original msg \n
* if mOrigMsgId is not blank the msgId then this msg is \n
@ -651,12 +659,14 @@ private:
void processRecvdGroups();
void publishGrps();
void processGroupUpdatePublish();
void publishMsgs();
/*!
void processGroupUpdatePublish();
void processGroupDelete();
void publishMsgs();
/*!
* processes msg local meta changes
*/
void processMsgMetaChanges();
@ -864,9 +874,11 @@ private:
private:
std::vector<GroupUpdate> mGroupUpdates, mPeersGroupUpdate;
std::vector<GroupUpdatePublish> mGroupUpdatePublish;
};
#endif // RSGENEXCHANGE_H
std::vector<GroupUpdatePublish> mGroupUpdatePublish;
std::vector<GroupDeletePublish> mGroupDeletePublish;
};
#endif // RSGENEXCHANGE_H

View File

@ -148,4 +148,13 @@ public:
uint32_t mToken;
};
class GroupDeletePublish
{
public:
GroupDeletePublish(RsGxsGrpItem* item, uint32_t token)
: grpItem(item), mToken(token) {}
RsGxsGrpItem* grpItem;
uint32_t mToken;
};
#endif /* GXSUTIL_H_ */

View File

@ -217,6 +217,7 @@ virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
virtual bool createIdentity(uint32_t& token, RsIdentityParameters &params) = 0;
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
const std::string &tag, RsRecognTagDetails &details) = 0;

View File

@ -352,8 +352,20 @@ bool p3IdService::updateIdentity(uint32_t& token, RsGxsIdGroup &group)
return false;
}
bool p3IdService::deleteIdentity(uint32_t& token, RsGxsIdGroup &group)
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteIdentity()";
std::cerr << std::endl;
#endif
bool p3IdService::parseRecognTag(const RsGxsId &id, const std::string &nickname,
deleteGroup(token, group);
return false;
}
bool p3IdService::parseRecognTag(const RsGxsId &id, const std::string &nickname,
const std::string &tag, RsRecognTagDetails &details)
{
#ifdef DEBUG_RECOGN
@ -823,6 +835,74 @@ bool p3IdService::updateGroup(uint32_t& token, RsGxsIdGroup &group)
return true;
}
bool p3IdService::deleteGroup(uint32_t& token, RsGxsIdGroup &group)
{
RsGxsId id = RsGxsId(group.mMeta.mGroupId.toStdString());
RsGxsIdGroupItem* item = new RsGxsIdGroupItem();
item->group = group;
item->meta = group.mMeta;
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Deleting RsGxsId: " << id;
std::cerr << std::endl;
#endif
RsGenExchange::deleteGroup(token, item);
// if its in the cache - clear it.
{
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
if (mPublicKeyCache.erase(id))
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Removed from PublicKeyCache";
std::cerr << std::endl;
#endif
}
else
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Not in PublicKeyCache";
std::cerr << std::endl;
#endif
}
if (mPrivateKeyCache.erase(id))
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Removed from PrivateKeyCache";
std::cerr << std::endl;
#endif
}
else
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Not in PrivateKeyCache";
std::cerr << std::endl;
#endif
}
std::list<RsGxsId>::iterator lit = std::find( mOwnIds.begin(), mOwnIds.end(), id);
if (lit != mOwnIds.end())
{
mOwnIds.remove((RsGxsId)*lit);
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Removed from OwnIds";
std::cerr << std::endl;
#endif
}
else
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Not in OwnIds";
std::cerr << std::endl;
#endif
}
}
return true;
}
/************************************************************************************/
/************************************************************************************/
/************************************************************************************/

View File

@ -242,6 +242,7 @@ virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &grou
// These are local - and not exposed via RsIdentity.
virtual bool createGroup(uint32_t& token, RsGxsIdGroup &group);
virtual bool updateGroup(uint32_t& token, RsGxsIdGroup &group);
virtual bool deleteGroup(uint32_t& token, RsGxsIdGroup &group);
//virtual bool createMsg(uint32_t& token, RsGxsIdOpinion &opinion);
/**************** RsIdentity External Interface.
@ -266,6 +267,7 @@ virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
virtual bool createIdentity(uint32_t& token, RsIdentityParameters &params);
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group);
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group);
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
const std::string &tag, RsRecognTagDetails &details);

View File

@ -127,7 +127,9 @@ IdDialog::IdDialog(QWidget *parent)
/* Connect signals */
connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(addIdentity()));
connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));
connect(ui.toolButton_Delete, SIGNAL(clicked()), this, SLOT(removeIdentity()));
connect(ui.toolButton_EditId, SIGNAL(clicked()), this, SLOT(editIdentity()));
connect(ui.removeIdentity, SIGNAL(triggered()), this, SLOT(removeIdentity()));
connect(ui.editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
connect(ui.treeWidget_IdList, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection()));
@ -171,7 +173,7 @@ void IdDialog::todo()
{
QMessageBox::information(this, "Todo",
"<b>Open points:</b><ul>"
"<li>Delete ID"
// "<li>Delete ID"
"<li>Reputation"
"<li>Load/save settings"
"</ul>");
@ -494,10 +496,10 @@ void IdDialog::insertIdDetails(uint32_t token)
if (isOwnId)
{
mStateHelper->setWidgetEnabled(ui.toolButton_Reputation, false);
// No Delete Ids yet!
mStateHelper->setWidgetEnabled(ui.toolButton_Delete, /*true*/ false);
mStateHelper->setWidgetEnabled(ui.toolButton_Delete, true);
mStateHelper->setWidgetEnabled(ui.toolButton_EditId, true);
ui.editIdentity->setEnabled(true);
ui.removeIdentity->setEnabled(true);
}
else
{
@ -506,6 +508,7 @@ void IdDialog::insertIdDetails(uint32_t token)
mStateHelper->setWidgetEnabled(ui.toolButton_Delete, false);
mStateHelper->setWidgetEnabled(ui.toolButton_EditId, false);
ui.editIdentity->setEnabled(false);
ui.removeIdentity->setEnabled(false);
}
/* now fill in the reputation information */
@ -618,6 +621,25 @@ void IdDialog::addIdentity()
dlg.exec();
}
void IdDialog::removeIdentity()
{
QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem();
if (!item)
{
std::cerr << "IdDialog::editIdentity() Invalid item";
std::cerr << std::endl;
return;
}
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
uint32_t dummyToken = 0;
RsGxsIdGroup group;
group.mMeta.mGroupId=RsGxsGroupId(keyId);
rsIdentity->deleteIdentity(dummyToken, group);
}
void IdDialog::editIdentity()
{
QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem();
@ -661,6 +683,7 @@ void IdDialog::requestRepList(const RsGxsGroupId &aboutId)
void IdDialog::insertRepList(uint32_t token)
{
Q_UNUSED(token)
mStateHelper->setLoading(IDDIALOG_REPLIST, false);
#if 0
@ -738,6 +761,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
QMenu contextMnu( this );
contextMnu.addAction(ui.editIdentity);
contextMnu.addAction(ui.removeIdentity);
contextMnu.exec(QCursor::pos());
}
}

View File

@ -53,6 +53,7 @@ private slots:
void filterChanged(const QString &text);
void addIdentity();
void removeIdentity();
void editIdentity();
void updateSelection();

View File

@ -682,6 +682,15 @@
<string>Edit Identity</string>
</property>
</action>
<action name="removeIdentity">
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/delete.png</normaloff>:/images/delete.png</iconset>
</property>
<property name="text">
<string>Delete Identity</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -152,7 +152,7 @@
#define IMAGE_MINIMIZE ":/images/window_nofullscreen.png"
#define IMAGE_MAXIMIZE ":/images/window_fullscreen.png"
#define IMG_HELP ":/images/help24.png"
#define IMAGE_NEWSFEED ":/images/newsfeed128.png"
#define IMAGE_NEWSFEED ":/images/newsfeed/news-feed-32.png"
#define IMAGE_PLUGINS ":/images/extension_32.png"
#define IMAGE_NOONLINE ":/images/logo/logo_24_0.png"
#define IMAGE_ONEONLINE ":/images/logo/logo_24_1.png"

View File

@ -42,6 +42,8 @@
#define IMAGE_INFO ":/images/info16.png"
//#define IMAGE_GROUPAUTHD ":/images/konv_message2.png"
#define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_EDIT ":/images/edit_16.png"
#define IMAGE_SHARE ":/images/share-icon-16.png"
#define TOKEN_TYPE_LISTING 1
#define TOKEN_TYPE_SUBSCRIBE_CHANGE 2
@ -230,10 +232,10 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint /*point*/)
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Details"), this, SLOT(showGroupDetails()));
action->setEnabled (!mGroupId.isNull());
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Details"), this, SLOT(editGroupDetails()));
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Details"), this, SLOT(editGroupDetails()));
action->setEnabled (!mGroupId.isNull() && isAdmin);
action = contextMnu.addAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share"), this, SLOT(shareKey()));
action = contextMnu.addAction(QIcon(IMAGE_SHARE), tr("Share"), this, SLOT(shareKey()));
action->setEnabled(!mGroupId.isNull() && isAdmin);
if (!mGroupId.isNull() && isPublisher && !isAdmin) {

View File

@ -674,7 +674,10 @@
<file>images/tags/dev-patcher.png</file>
<file>images/tags/developer.png</file>
<file>images/circles/circles_32.png</file>
<file>images/circles/circles_64.png</file>
<file>images/circles/circles_64.png</file>
<file>images/newsfeed/news-feed-32.png</file>
<file>images/newsfeed/news-feed-notify-32.png</file>
<file>images/share-icon-16.png</file>
<file>help/version.html</file>
<file>images/view-certificate-sign-48.png</file>
</qresource>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB