Fix change current user name failed.

This commit is contained in:
sunwen
2024-05-06 17:44:21 +08:00
parent 29fea313ad
commit 6a48d60458
4 changed files with 11 additions and 1 deletions

View File

@@ -191,13 +191,14 @@ bool AccountFormDialog::updateReferenceData()
warn(tr("User Name can't be empty!")); warn(tr("User Name can't be empty!"));
return false; return false;
} }
User::Current()->setUserName(mNewUserName);
} }
if (!this->mCommentChanged) User::Current()->setUserName(mLeComment->text()); if (!this->mCommentChanged) User::Current()->setUserName(mLeComment->text());
User::Current()->setUserName(mNewUserName);
bool ret = User::Current()->submitChange(); bool ret = User::Current()->submitChange();
if (ret) if (ret)
{ {
hideWarn(); hideWarn();
EventCenter::Default()->triggerEvent(CurrentUserNameChanged, nullptr, nullptr);
LOG_USER_OPERATION("Change User Name") LOG_USER_OPERATION("Change User Name")
} }
else else

View File

@@ -37,6 +37,7 @@ void ChangePasswordFormDialog::initLayout()
layout->addWidget(mLEPasswd); layout->addWidget(mLEPasswd);
auto lblEndline1 = new QLabel(this); auto lblEndline1 = new QLabel(this);
lblEndline1->setObjectName("endline"); lblEndline1->setObjectName("endline");
lblEndline1->setFixedHeight(3);
layout->addWidget(lblEndline1); layout->addWidget(lblEndline1);
//add new password //add new password
@@ -47,6 +48,7 @@ void ChangePasswordFormDialog::initLayout()
layout->addWidget(lblNewPasswd); layout->addWidget(lblNewPasswd);
layout->addWidget(mLENewPasswd); layout->addWidget(mLENewPasswd);
auto lblEndline2 = new QLabel(this); auto lblEndline2 = new QLabel(this);
lblEndline2->setFixedHeight(3);
lblEndline2->setObjectName("endline"); lblEndline2->setObjectName("endline");
layout->addWidget(lblEndline2); layout->addWidget(lblEndline2);
@@ -58,6 +60,7 @@ void ChangePasswordFormDialog::initLayout()
layout->addWidget(lblConfirm); layout->addWidget(lblConfirm);
layout->addWidget(mLEConfirmPasswd); layout->addWidget(mLEConfirmPasswd);
auto lblEndline3 = new QLabel(this); auto lblEndline3 = new QLabel(this);
lblEndline3->setFixedHeight(3);
lblEndline3->setObjectName("endline"); lblEndline3->setObjectName("endline");
layout->addWidget(lblEndline3); layout->addWidget(lblEndline3);

View File

@@ -41,6 +41,7 @@ ADD_EVENT_VALUE(WarningMessageRaise)\
ADD_EVENT_VALUE(ErrorStateActive)\ ADD_EVENT_VALUE(ErrorStateActive)\
ADD_EVENT_VALUE(ErrorStateUnactive)\ ADD_EVENT_VALUE(ErrorStateUnactive)\
ADD_EVENT_VALUE(StartScanProcess)\ ADD_EVENT_VALUE(StartScanProcess)\
ADD_EVENT_VALUE(CurrentUserNameChanged)\

View File

@@ -93,6 +93,11 @@ TopBarWidget::TopBarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent,
connect(EventCenter::Default(), &EventCenter::LoginSuccess, [=](QObject*, QObject* msg) { connect(EventCenter::Default(), &EventCenter::LoginSuccess, [=](QObject*, QObject* msg) {
username->setText(User::Current()->getUserName()); username->setText(User::Current()->getUserName());
}); });
connect(EventCenter::Default(), &EventCenter::CurrentUserNameChanged, [=](QObject*, QObject* msg)
{
username->setText(User::Current()->getUserName());
});
connect(w,&RollingMessageWidget::RollingTimerTriggr,[=](){ connect(w,&RollingMessageWidget::RollingTimerTriggr,[=](){
auto anony = JsonObject::Instance()->getAnonymousMode(); auto anony = JsonObject::Instance()->getAnonymousMode();