mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 01:10:19 -05:00
made GxsIdChooser to auto update when identities are added/created/modified
This commit is contained in:
parent
302e87e476
commit
2d024c0d6f
@ -25,6 +25,7 @@
|
|||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "gui/Identity/IdEditDialog.h"
|
#include "gui/Identity/IdEditDialog.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
||||||
@ -76,6 +77,24 @@ GxsIdChooser::GxsIdChooser(QWidget *parent)
|
|||||||
/* Connect signals */
|
/* Connect signals */
|
||||||
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(myCurrentIndexChanged(int)));
|
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(myCurrentIndexChanged(int)));
|
||||||
connect(this, SIGNAL(activated(int)), this, SLOT(indexActivated(int)));
|
connect(this, SIGNAL(activated(int)), this, SLOT(indexActivated(int)));
|
||||||
|
|
||||||
|
// also capture identity creation/deletion events so as to update the UI accordingly
|
||||||
|
|
||||||
|
mEventHandlerId = 0;
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
|
||||||
|
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId, RsEventType::GXS_IDENTITY );
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdChooser::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
if(event->mType != RsEventType::GXS_IDENTITY) return;
|
||||||
|
|
||||||
|
const RsGxsIdentityEvent *fe = dynamic_cast<const RsGxsIdentityEvent*>(event.get());
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateDisplay(true);
|
||||||
|
update(); // Qt flush
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdChooser::setFlags(uint32_t flags)
|
void GxsIdChooser::setFlags(uint32_t flags)
|
||||||
@ -86,6 +105,7 @@ void GxsIdChooser::setFlags(uint32_t flags)
|
|||||||
|
|
||||||
GxsIdChooser::~GxsIdChooser()
|
GxsIdChooser::~GxsIdChooser()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdChooser::fillDisplay(bool complete)
|
void GxsIdChooser::fillDisplay(bool complete)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#ifndef _GXS_ID_CHOOSER_H
|
#ifndef _GXS_ID_CHOOSER_H
|
||||||
#define _GXS_ID_CHOOSER_H
|
#define _GXS_ID_CHOOSER_H
|
||||||
|
|
||||||
|
#include "retroshare/rsevents.h"
|
||||||
#include "gui/common/RSComboBox.h"
|
#include "gui/common/RSComboBox.h"
|
||||||
|
|
||||||
#include "retroshare/rsgxsifacetypes.h"
|
#include "retroshare/rsgxsifacetypes.h"
|
||||||
@ -78,6 +79,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void loadPrivateIds();
|
void loadPrivateIds();
|
||||||
void setDefaultItem();
|
void setDefaultItem();
|
||||||
|
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||||
|
|
||||||
uint32_t mFlags;
|
uint32_t mFlags;
|
||||||
RsGxsId mDefaultId;
|
RsGxsId mDefaultId;
|
||||||
@ -86,6 +88,8 @@ private:
|
|||||||
|
|
||||||
std::set<RsGxsId> mConstraintIdsSet ; // leave empty if all allowed
|
std::set<RsGxsId> mConstraintIdsSet ; // leave empty if all allowed
|
||||||
// RsGxsUpdateBroadcastBase *mBase;
|
// RsGxsUpdateBroadcastBase *mBase;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -585,7 +585,7 @@ QVariant RsMessageModel::userRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col)
|
|||||||
{
|
{
|
||||||
switch(col)
|
switch(col)
|
||||||
{
|
{
|
||||||
case COLUMN_THREAD_AUTHOR: return QVariant(QString::fromStdString(fmpe.from.toStdString()));
|
case COLUMN_THREAD_AUTHOR: return displayRole(fmpe,col);
|
||||||
case COLUMN_THREAD_MSGID: return QVariant(QString::fromStdString(fmpe.msgId));
|
case COLUMN_THREAD_MSGID: return QVariant(QString::fromStdString(fmpe.msgId));
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@ -627,6 +627,7 @@ void MessageWidget::fill(const std::string &msgId)
|
|||||||
case MsgAddress::MSG_ADDRESS_MODE_TO: to_text += link.toHtml() + " "; break;
|
case MsgAddress::MSG_ADDRESS_MODE_TO: to_text += link.toHtml() + " "; break;
|
||||||
case MsgAddress::MSG_ADDRESS_MODE_CC: cc_text += link.toHtml() + " "; break;
|
case MsgAddress::MSG_ADDRESS_MODE_CC: cc_text += link.toHtml() + " "; break;
|
||||||
case MsgAddress::MSG_ADDRESS_MODE_BCC: bcc_text += link.toHtml() + " "; break;
|
case MsgAddress::MSG_ADDRESS_MODE_BCC: bcc_text += link.toHtml() + " "; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,7 +881,7 @@ void MessageWidget::sendInvite()
|
|||||||
if (!rsMail->getMessage(currMsgId, mi))
|
if (!rsMail->getMessage(currMsgId, mi))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!mi.from.type()==MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
if(mi.from.type()!=MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((QMessageBox::question(this, tr("Send invite?"),tr("Do you really want send a invite with your Certificate?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Cancel))== QMessageBox::Yes)
|
if ((QMessageBox::question(this, tr("Send invite?"),tr("Do you really want send a invite with your Certificate?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Cancel))== QMessageBox::Yes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user