Tell the user if the report couldn't be sent.

--HG--
branch : feature-crashreport
This commit is contained in:
dfighter1985 2015-02-20 02:54:05 +01:00
parent 14a709449a
commit 72566f1a71
4 changed files with 22 additions and 4 deletions

View file

@ -20,6 +20,7 @@
#include <QNetworkAccessManager>
#include <QUrl>
#include <QNetworkRequest>
#include <QNetworkReply>
namespace
{
@ -37,7 +38,7 @@ QObject( parent )
{
m_pvt = new RCErrorSocketPvt();
connect( &m_pvt->mgr, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onFinished() ) );
connect( &m_pvt->mgr, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onFinished( QNetworkReply* ) ) );
}
RCErrorSocket::~RCErrorSocket()
@ -59,8 +60,11 @@ void RCErrorSocket::sendReport( const RCErrorData &data )
m_pvt->mgr.post( request, params.encodedQuery() );
}
void RCErrorSocket::onFinished()
void RCErrorSocket::onFinished( QNetworkReply *reply )
{
Q_EMIT reportSent();
if( reply->error() != QNetworkReply::NoError )
Q_EMIT reportFailed();
else
Q_EMIT reportSent();
}

View file

@ -24,6 +24,7 @@
#include "rcerror_data.h"
class RCErrorSocketPvt;
class QNetworkReply;
class RCErrorSocket : public QObject
{
@ -37,9 +38,10 @@ public:
Q_SIGNALS:
void reportSent();
void reportFailed();
private Q_SLOTS:
void onFinished();
void onFinished( QNetworkReply *reply );
private:
RCErrorSocketPvt *m_pvt;

View file

@ -39,6 +39,7 @@ QWidget( parent )
connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) );
connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) );
connect( m_socket, SIGNAL( reportFailed() ), this, SLOT( onReportFailed() ) );
}
RCErrorWidget::~RCErrorWidget()
@ -97,3 +98,13 @@ void RCErrorWidget::onReportSent()
close();
}
void RCErrorWidget::onReportFailed()
{
QApplication::setOverrideCursor( Qt::ArrowCursor );
QMessageBox::information( this,
tr( "Report failed" ),
tr( "Failed to send the report..." ) );
close();
}

View file

@ -41,6 +41,7 @@ private Q_SLOTS:
void onCBClicked();
void onReportSent();
void onReportFailed();
private:
Ui::RCErrorWidget m_ui;