void QQmlNetwork::setNetworkError(QNetworkReply::NetworkError networkError)
{
    if (networkError == QNetworkReply::NoError)
    {
        if (m_networkError == NoError)
            return;
        m_networkError = NoError;
        emit networkErrorChanged();
    }
    else if (networkError == QNetworkReply::ConnectionRefusedError)
    {
        if (m_networkError == ConnectionRefused)
            return;
        m_networkError = ConnectionRefused;
        emit networkErrorChanged();
    }
    else if (networkError == QNetworkReply::RemoteHostClosedError)
    {
        if (m_networkError == RemoteHostClosed)
            return;
        m_networkError = RemoteHostClosed;
        emit networkErrorChanged();
    }
    else if (networkError == QNetworkReply::HostNotFoundError)
    {
        if (m_networkError == HostNotFound)
            return;
        m_networkError = HostNotFound;
        emit netwrokErrorChanged();
    }
    else if ( networkError == QNetworkReply::UnknownServerError)
    {
        if (m_networkError == UnknownServer)
            return;
        m_networkError = UnknownServer;
        emit networkErrorChanged();
    }
}
Example #2
0
/**
 * SLOT
 * Is called when a network error occures.
 * @param error
 */
void Battleships::networkConnectionError(const QString &error)
{
    m_networkConnectionError = error;
    emit networkErrorChanged();
    setCurrentView("NetworkErrorDialog");
}