Tell the user if the report couldn't be sent.
This commit is contained in:
parent
52bb68f547
commit
31907ca35f
4 changed files with 22 additions and 4 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,7 @@ QObject( parent )
|
||||||
{
|
{
|
||||||
m_pvt = new RCErrorSocketPvt();
|
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()
|
RCErrorSocket::~RCErrorSocket()
|
||||||
|
@ -59,8 +60,11 @@ void RCErrorSocket::sendReport( const RCErrorData &data )
|
||||||
m_pvt->mgr.post( request, params.encodedQuery() );
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "rcerror_data.h"
|
#include "rcerror_data.h"
|
||||||
|
|
||||||
class RCErrorSocketPvt;
|
class RCErrorSocketPvt;
|
||||||
|
class QNetworkReply;
|
||||||
|
|
||||||
class RCErrorSocket : public QObject
|
class RCErrorSocket : public QObject
|
||||||
{
|
{
|
||||||
|
@ -37,9 +38,10 @@ public:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void reportSent();
|
void reportSent();
|
||||||
|
void reportFailed();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onFinished();
|
void onFinished( QNetworkReply *reply );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RCErrorSocketPvt *m_pvt;
|
RCErrorSocketPvt *m_pvt;
|
||||||
|
|
|
@ -39,6 +39,7 @@ QWidget( parent )
|
||||||
connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) );
|
connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) );
|
||||||
|
|
||||||
connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) );
|
connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) );
|
||||||
|
connect( m_socket, SIGNAL( reportFailed() ), this, SLOT( onReportFailed() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
RCErrorWidget::~RCErrorWidget()
|
RCErrorWidget::~RCErrorWidget()
|
||||||
|
@ -97,3 +98,13 @@ void RCErrorWidget::onReportSent()
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RCErrorWidget::onReportFailed()
|
||||||
|
{
|
||||||
|
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||||
|
|
||||||
|
QMessageBox::information( this,
|
||||||
|
tr( "Report failed" ),
|
||||||
|
tr( "Failed to send the report..." ) );
|
||||||
|
|
||||||
|
close();
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ private Q_SLOTS:
|
||||||
void onCBClicked();
|
void onCBClicked();
|
||||||
|
|
||||||
void onReportSent();
|
void onReportSent();
|
||||||
|
void onReportFailed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::RCErrorWidget m_ui;
|
Ui::RCErrorWidget m_ui;
|
||||||
|
|
Loading…
Reference in a new issue