* @brief Returns true when either a username or a password is stored for host:port. */
| 73 | * @brief Returns true when either a username or a password is stored for host:port. |
| 74 | */ |
| 75 | bool MQTT::CredentialVault::hasCredentials(const QString& host, quint16 port) const |
| 76 | { |
| 77 | if (host.isEmpty()) |
| 78 | return false; |
| 79 | |
| 80 | const auto key = settingsKey(host, port); |
| 81 | m_settings.beginGroup(QStringLiteral("mqtt/credentials")); |
| 82 | const bool present = m_settings.contains(key + QStringLiteral("/user")) |
| 83 | || m_settings.contains(key + QStringLiteral("/pass")); |
| 84 | m_settings.endGroup(); |
| 85 | |
| 86 | return present; |
| 87 | } |
| 88 | |
| 89 | //-------------------------------------------------------------------------------------------------- |
| 90 | // Mutations |
no test coverage detected