@@ -52,8 +52,12 @@ void AuthFlow::cancelFromAgent() {
5252
5353 qCDebug (logPolkitState) << " cancelling authentication request from agent" ;
5454
55+ // Session cancel can immediately call the cancel handler, which also
56+ // performs property updates.
57+ Qt::beginPropertyUpdateGroup ();
5558 this ->bIsCancelled = true ;
5659 this ->currentSession ->cancel ();
60+ Qt::endPropertyUpdateGroup ();
5761
5862 emit this ->authenticationRequestCancelled ();
5963
@@ -67,18 +71,24 @@ void AuthFlow::submit(const QString& value) {
6771
6872 this ->currentSession ->respond (value);
6973
74+ Qt::beginPropertyUpdateGroup ();
7075 this ->bIsResponseRequired = false ;
7176 this ->bInputPrompt = QString ();
7277 this ->bResponseVisible = false ;
78+ Qt::endPropertyUpdateGroup ();
7379}
7480
7581void AuthFlow::cancelAuthenticationRequest () {
7682 if (!this ->currentSession ) return ;
7783
7884 qCDebug (logPolkitState) << " cancelling authentication request by user request" ;
7985
86+ // Session cancel can immediately call the cancel handler, which also
87+ // performs property updates.
88+ Qt::beginPropertyUpdateGroup ();
8089 this ->bIsCancelled = true ;
8190 this ->currentSession ->cancel ();
91+ Qt::endPropertyUpdateGroup ();
8292
8393 this ->mRequest ->cancel (" Authentication request cancelled by user." );
8494}
@@ -101,48 +111,50 @@ void AuthFlow::setupSession() {
101111 this ->currentSession ->initiate ();
102112}
103113
104- void AuthFlow::clearState () {
105- this ->bIsResponseRequired = false ;
106- this ->bInputPrompt = QString {};
107- this ->bResponseVisible = false ;
108- this ->bSupplementaryMessage = QString {};
109- this ->bSupplementaryIsError = false ;
110- }
111-
112114void AuthFlow::request (const QString& message, bool echo) {
115+ Qt::beginPropertyUpdateGroup ();
113116 this ->bIsResponseRequired = true ;
114117 this ->bInputPrompt = message;
115118 this ->bResponseVisible = echo;
119+ Qt::endPropertyUpdateGroup ();
116120}
117121
118122void AuthFlow::completed (bool gainedAuthorization) {
119123 qCDebug (logPolkitState) << " authentication session completed, gainedAuthorization ="
120124 << gainedAuthorization << " , isCancelled =" << this ->bIsCancelled .value ();
121125
122126 if (gainedAuthorization) {
127+ Qt::beginPropertyUpdateGroup ();
123128 this ->bIsCompleted = true ;
124129 this ->bIsSuccessful = true ;
130+ Qt::endPropertyUpdateGroup ();
131+
125132 this ->mRequest ->complete ();
126133
127134 emit this ->authenticationSucceeded ();
128135 } else if (this ->bIsCancelled .value ()) {
136+ Qt::beginPropertyUpdateGroup ();
129137 this ->bIsCompleted = true ;
130138 this ->bIsSuccessful = false ;
139+ Qt::endPropertyUpdateGroup ();
131140 } else {
132141 emit this ->authenticationFailed ();
133142
134- this ->clearState ();
135143 this ->setupSession ();
136144 }
137145}
138146
139147void AuthFlow::showError (const QString& message) {
148+ Qt::beginPropertyUpdateGroup ();
140149 this ->bSupplementaryMessage = message;
141150 this ->bSupplementaryIsError = true ;
151+ Qt::endPropertyUpdateGroup ();
142152}
143153
144154void AuthFlow::showInfo (const QString& message) {
155+ Qt::beginPropertyUpdateGroup ();
145156 this ->bSupplementaryMessage = message;
146157 this ->bSupplementaryIsError = false ;
158+ Qt::endPropertyUpdateGroup ();
147159}
148160} // namespace qs::service::polkit
0 commit comments