~ubuntu-branches/ubuntu/utopic/unity-scope-click/utopic-proposed

« back to all changes in this revision

Viewing changes to libclickscope/click/download-manager.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Rodney Dawes
  • Date: 2014-09-25 13:44:55 UTC
  • mfrom: (1.1.74)
  • Revision ID: package-import@ubuntu.com-20140925134455-536ym4bqoxitl275
Tags: 0.1.1+14.10.20140925-0ubuntu1
[ Rodney Dawes ]
Invalidate the local token and show login error when token is
invalid. (LP: #1373493)

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
        credentialsService->getCredentials();
74
74
    }
75
75
 
 
76
    void invalidateCredentialsFromService()
 
77
    {
 
78
        credentialsService->invalidateCredentials();
 
79
    }
 
80
 
76
81
    QSharedPointer<click::network::AccessManager> nam;
77
82
    QSharedPointer<click::CredentialsService> credentialsService;
78
83
    QSharedPointer<udm::Manager> systemDownloadManager;
248
253
 
249
254
void click::DownloadManager::handleNetworkError(QNetworkReply::NetworkError error)
250
255
{
251
 
    qDebug() << "error in network request for click token: " << error << impl->reply->errorString();
 
256
    switch (error) {
 
257
        case QNetworkReply::ContentAccessDenied:
 
258
        case QNetworkReply::ContentOperationNotPermittedError:
 
259
        case QNetworkReply::AuthenticationRequiredError:
 
260
            impl->invalidateCredentialsFromService();
 
261
            emit credentialsNotFound();
 
262
            break;
 
263
        default:
 
264
            qDebug() << "error in network request for click token: " << error << impl->reply->errorString();
 
265
            emit clickTokenFetchError(QString("Network Error"));
 
266
            break;
 
267
    }
252
268
    impl->reply.reset();
253
 
    emit clickTokenFetchError(QString("Network Error"));
254
269
}
255
270
 
256
271
void click::DownloadManager::getAllDownloadsWithMetadata(const QString &key, const QString &value,