mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-17 01:24:15 -05:00
fixed bug causing passwd request to fail
This commit is contained in:
parent
86b9d6da08
commit
3f21b4bf65
2 changed files with 25 additions and 14 deletions
|
|
@ -110,7 +110,13 @@ NotifyQt::NotifyQt() : cDialog(NULL)
|
||||||
// Catch all events that require toasters and
|
// Catch all events that require toasters and
|
||||||
|
|
||||||
mEventHandlerId = 0;
|
mEventHandlerId = 0;
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject([=](){ handleIncomingEvent(event); }, this ); }, mEventHandlerId); // No event type means we expect to catch all possible events
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
if(event->mType == RsEventType::SYSTEM_ERROR && dynamic_cast<const RsSystemEvent*>(event.get())->mEventCode == RsSystemEventCode::PASSWORD_REQUESTED)
|
||||||
|
sync_handleIncomingEvent(event);
|
||||||
|
else
|
||||||
|
RsQThreadUtils::postToObject([=](){ async_handleIncomingEvent(event); }, this );
|
||||||
|
}, mEventHandlerId); // No event type means we expect to catch all possible events
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
#ifdef TO_REMOVE
|
||||||
// register to allow sending over Qt::QueuedConnection
|
// register to allow sending over Qt::QueuedConnection
|
||||||
|
|
@ -683,7 +689,19 @@ void NotifyQt::enable()
|
||||||
_enabled = true ;
|
_enabled = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyQt::handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
void NotifyQt::sync_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
auto ev6 = dynamic_cast<const RsSystemEvent*>(event.get());
|
||||||
|
|
||||||
|
if(ev6->mEventCode == RsSystemEventCode::PASSWORD_REQUESTED)
|
||||||
|
{
|
||||||
|
std::string password;
|
||||||
|
bool cancelled;
|
||||||
|
graphical_askForPassword(ev6->passwd_request_title, ev6->passwd_request_key_details, ev6->passwd_request_prev_is_bad, password,cancelled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
||||||
{
|
{
|
||||||
static bool already_updated = false ; // these only update once at start because they may already have been set before
|
static bool already_updated = false ; // these only update once at start because they may already have been set before
|
||||||
// the gui is running, then they get updated by callbacks.
|
// the gui is running, then they get updated by callbacks.
|
||||||
|
|
@ -854,15 +872,6 @@ void NotifyQt::handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
||||||
case RsSystemEventCode::GENERAL_ERROR:
|
case RsSystemEventCode::GENERAL_ERROR:
|
||||||
displayErrorMessage(RS_SYS_WARNING,tr("Internal error"),QString::fromUtf8(ev6->mErrorMsg.c_str()));
|
displayErrorMessage(RS_SYS_WARNING,tr("Internal error"),QString::fromUtf8(ev6->mErrorMsg.c_str()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RsSystemEventCode::PASSWORD_REQUESTED:
|
|
||||||
{
|
|
||||||
std::string password;
|
|
||||||
bool cancelled;
|
|
||||||
graphical_askForPassword(ev6->passwd_request_title, ev6->passwd_request_key_details, ev6->passwd_request_prev_is_bad, password,cancelled);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,9 @@ class NotifyQt: public QObject, public NotifyClient
|
||||||
/* so we can update windows */
|
/* so we can update windows */
|
||||||
NetworkDialog *cDialog;
|
NetworkDialog *cDialog;
|
||||||
|
|
||||||
void handleIncomingEvent(std::shared_ptr<const RsEvent> e); /* called by timer */
|
void async_handleIncomingEvent(std::shared_ptr<const RsEvent> e);
|
||||||
|
void sync_handleIncomingEvent(std::shared_ptr<const RsEvent> e);
|
||||||
|
|
||||||
RsEventsHandlerId_t mEventHandlerId;
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue