File: 1006-Fix-handling-of-errors-during-account-validation.patch

package info (click to toggle)
lomiri-dekko-app 0.4.1%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,416 kB
  • sloc: cpp: 26,276; javascript: 4,237; python: 1,082; xml: 379; sh: 126; makefile: 18
file content (54 lines) | stat: -rw-r--r-- 2,609 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 3991f8ae3cab4d08e66c71842e0b4d77a4d2d5e6 Mon Sep 17 00:00:00 2001
From: Guido Berhoerster <guido+debian@berhoerster.name>
Date: Tue, 21 Jan 2025 13:55:42 +0100
Subject: Fix handling of errors during account validation

The actual status gets lost in repeated type conversions while basing back and
forth between QML and C++ code: If an action in the AccountValidator action
fails the failedActionStatus signal is emitted with the
QMailServiceAction::Status passed along as its argument. The signal is handled
in the AccountSetup QML component wherte the argument is received as an opaque
QVariant value and passed back as a quint64 argument to the
MailServiceClient::handleFailure() method. Passing the QVariant to the method
turns it into a 0. The method casts the 0 into a
QMailServiceAction::Status::ErrorCode which is always a and then emits a
clientError signal with the casted result which will always be
QMailServiceAction::Status::ErrNoError. This signal is then by the ErrorsWorker
component which ignores the Client::Error::NoError code.
Fix this by passing only the QMailServiceAction::Status::ErrorCode which is
what MailServiceClient::handleFailure and ErrorsWorker.onClientError seem to be
expecting anyway.

--- lomiri-dekko-app.orig/Dekko/backend/accounts/AccountValidator.cpp
+++ lomiri-dekko-app/Dekko/backend/accounts/AccountValidator.cpp
@@ -121,7 +121,7 @@ void AccountValidator::testFailed(Accoun
     setInProgress(false);
     m_timer->stop();
     emit validationFailed();
-    emit failedActionStatus(status);
+    emit failedActionStatus(status.errorCode);
     cleanUp();
 }
 
--- lomiri-dekko-app.orig/Dekko/backend/accounts/AccountValidator.h
+++ lomiri-dekko-app/Dekko/backend/accounts/AccountValidator.h
@@ -61,7 +61,7 @@ public:
 signals:
     void success();
     void failed(AccountConfiguration::ServiceType service, FailureReason reason);
-    void failedActionStatus(QMailServiceAction::Status status);
+    void failedActionStatus(QMailServiceAction::Status::ErrorCode errorCode);
     void validationFailed(); // qml one
     void inProgressChanged();
 
--- lomiri-dekko-app.orig/Dekko/stores/Accounts/AccountSetup.qml
+++ lomiri-dekko-app/Dekko/stores/Accounts/AccountSetup.qml
@@ -102,7 +102,7 @@ AppListener {
         onFailedActionStatus: {
             // Client knows how to handle this and pass it on to ErrorManager
             // for the popups etc.
-            Client.handleFailure(account.id, status, "Account validation action failed")
+            Client.handleFailure(account.id, errorCode, "Account validation action failed")
         }
     }