MailJD nbsp;·nbsp; Test Dashboard nbsp;·nbsp; Coverage
LCOV - code coverage report
Current view: top level - data - DavCredentials.h (source / functions) Coverage Total Hit
Test: MailJD Coverage (Unit + E2E) Lines: 93.3 % 15 14
Test Date: 2026-07-27 17:53:44 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 50.0 % 66 33

             Branch data     Line data    Source code
       1                 :             : #pragma once
       2                 :             : 
       3                 :             : #include <QByteArray>
       4                 :             : #include <QString>
       5                 :             : #include <QUrl>
       6                 :             : 
       7                 :             : namespace DavCredentials {
       8                 :             : 
       9                 :             : // Canonical credential boundary used by both the keyring and settings sync.
      10                 :             : // Only the HTTPS origin (scheme, IDNA host and effective port) and username
      11                 :             : // participate; URL paths intentionally do not, because one DAV account may
      12                 :             : // serve several collections below the same origin.
      13                 :         242 : inline QString canonicalOrigin(const QString &serverUrl) {
      14   [ +  -  +  - ]:         242 :   const QUrl url(serverUrl.trimmed(), QUrl::StrictMode);
      15   [ +  -  +  - ]:         242 :   const QString scheme = url.scheme().toLower();
      16   [ +  -  +  -  :         484 :   const QString host = QString::fromLatin1(QUrl::toAce(url.host())).toLower();
             +  -  +  - ]
      17   [ +  -  +  +  :         959 :   if (!url.isValid() || scheme != QStringLiteral("https") || host.isEmpty() ||
          +  +  +  -  +  
          +  +  +  -  -  
                   -  - ]
      18   [ +  -  -  +  :         477 :       !url.userInfo().isEmpty()) {
          +  +  +  +  -  
                      - ]
      19                 :           7 :     return {};
      20                 :             :   }
      21                 :             : 
      22         [ +  - ]:         235 :   const int port = url.port(443);
      23   [ +  -  -  + ]:         235 :   if (port < 1 || port > 65535)
      24                 :           0 :     return {};
      25         [ +  - ]:         235 :   const QString authorityHost = host.contains(QLatin1Char(':'))
      26   [ -  +  -  -  :         235 :                                     ? QStringLiteral("[%1]").arg(host)
                   -  - ]
      27   [ -  +  -  -  :         235 :                                     : host;
                   -  + ]
      28   [ +  -  +  - ]:         705 :   return QStringLiteral("https://%1:%2").arg(authorityHost).arg(port);
      29                 :         242 : }
      30                 :             : 
      31                 :             : QString accountName(const QString &accountId, const QString &serverUrl,
      32                 :             :                     const QString &username);
      33                 :             : 
      34                 :             : QByteArray readPasswordBlocking(const QString &accountId,
      35                 :             :                                 const QString &serverUrl,
      36                 :             :                                 const QString &username,
      37                 :             :                                 QString *error = nullptr);
      38                 :             : 
      39                 :             : bool writePasswordBlocking(const QString &accountId, const QString &serverUrl,
      40                 :             :                            const QString &username,
      41                 :             :                            const QByteArray &password,
      42                 :             :                            QString *error = nullptr);
      43                 :             : 
      44                 :             : bool deletePasswordBlocking(const QString &accountId, const QString &serverUrl,
      45                 :             :                             const QString &username,
      46                 :             :                             QString *error = nullptr);
      47                 :             : 
      48                 :             : } // namespace DavCredentials
        

Generated by: LCOV version 2.0-1