~ubuntu-branches/ubuntu/wily/ktp-kded-integration-module/wily

« back to all changes in this revision

Viewing changes to error-handler.cpp

  • Committer: Package Import Robot
  • Author(s): Howard Chan
  • Date: 2013-08-06 22:07:21 UTC
  • mfrom: (1.2.10)
  • Revision ID: package-import@ubuntu.com-20130806220721-n6b4oi5xs1e9xmdi
Tags: 0.6.3-0ubuntu1
* New upstream release (LP: #1208837)
* Bump on libktpcommoninternalsprivate-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        if (!error.shown() && error.errorTime().secsTo(QDateTime::currentDateTime()) > 20) {
140
140
            switch (error.connectionStatusReason()) {
141
141
            case Tp::ConnectionStatusReasonNetworkError:
142
 
                errorMessage += i18nc("%1 is the account name", "Could not connect %1. There was a network error, check your connection", account->displayName()) + QLatin1Char('\n');
 
142
                errorMessage += i18nc("%1 is the account name", "Could not connect %1. There was a network error, check your connection", account->displayName()) + QLatin1String("<br>");
143
143
                break;
144
144
            default:
145
145
                if (error.connectionError() == QLatin1String(TP_QT_ERROR_CANCELLED)) {
146
146
                    break;
147
147
                }
148
148
                if (error.connectionErrorDetails().hasServerMessage()) {
149
 
                    errorMessage += i18nc("%1 is the account name, %2 the error message", "There was a problem while trying to connect %1 - %2", account->displayName(), error.connectionErrorDetails().serverMessage()) + QLatin1Char('\n');
 
149
                    errorMessage += i18nc("%1 is the account name, %2 the error message", "There was a problem while trying to connect %1 - %2", account->displayName(), error.connectionErrorDetails().serverMessage()) + QLatin1String("<br>");
150
150
                } else {
151
 
                    errorMessage += i18nc("%1 is the account name, %2 the error message", "There was a problem while trying to connect %1 - %2", account->displayName(), KTp::ErrorDictionary::displayVerboseErrorMessage(error.connectionError())) + QLatin1Char('\n');
 
151
                    errorMessage += i18nc("%1 is the account name, %2 the error message", "There was a problem while trying to connect %1 - %2", account->displayName(), KTp::ErrorDictionary::displayVerboseErrorMessage(error.connectionError())) + QLatin1String("<br>");
152
152
                }
153
153
                break;
154
154
            }
158
158
    }
159
159
 
160
160
    if (!errorMessage.isEmpty()) {
161
 
        if (errorMessage.endsWith(QLatin1Char('\n'))) {
162
 
            errorMessage.chop(1);
 
161
        if (errorMessage.endsWith(QLatin1String("<br>"))) {
 
162
            errorMessage.chop(4);
163
163
        }
164
164
 
165
165
        showMessageToUser(errorMessage, ErrorHandler::SystemMessageError);
179
179
        //if this is the first error for this account, store the details of the error to show
180
180
        if (account->connectionStatusReason() == Tp::ConnectionStatusReasonRequested) {
181
181
            m_errorMap.remove(account);
182
 
        }
183
 
 
184
 
        if (!m_errorMap.contains(account)) {
 
182
        } else if (!m_errorMap.contains(account)) {
185
183
            m_errorMap.insert(account, ConnectionError(account->connectionStatusReason(), account->connectionError(), account->connectionErrorDetails()));
186
184
            QTimer::singleShot(30 * 1000, this, SLOT(showErrorNotification())); //a timer is kept per account because we want to show 30 seconds after the first still valid error.
187
185
        }