Send report in dev mode if the CB is checked.

This commit is contained in:
dfighter1985 2015-03-03 02:30:39 +01:00
parent a3b7496baf
commit 9a9b2042dd
2 changed files with 29 additions and 12 deletions

View file

@ -34,6 +34,7 @@ QWidget( parent )
{ {
m_developerMode = false; m_developerMode = false;
m_forceSend = false; m_forceSend = false;
m_devSendReport = false;
m_ui.setupUi( this ); m_ui.setupUi( this );
@ -63,6 +64,8 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
if( k == "log" ) if( k == "log" )
{ {
m_fileName = v.c_str(); m_fileName = v.c_str();
if( !QFile::exists( m_fileName ) )
m_fileName.clear();
} }
else else
if( k == "host" ) if( k == "host" )
@ -92,8 +95,8 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
m_ui.reportEdit->hide(); m_ui.reportEdit->hide();
} }
// When no -host specified no custom entry and email fields
if( m_socket->url().isEmpty() ) if( m_socket->url().isEmpty() || m_fileName.isEmpty() )
{ {
m_ui.descriptionEdit->hide(); m_ui.descriptionEdit->hide();
m_ui.emailCB->hide(); m_ui.emailCB->hide();
@ -105,7 +108,7 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
if( m_developerMode ) if( m_developerMode )
{ {
if( !m_socket->url().isEmpty() ) if( !m_socket->url().isEmpty() && !m_fileName.isEmpty() )
{ {
m_ui.emailCB->setEnabled( false ); m_ui.emailCB->setEnabled( false );
@ -172,10 +175,7 @@ void CCrashReportWidget::onLoad()
bool b = f.open( QFile::ReadOnly | QFile::Text ); bool b = f.open( QFile::ReadOnly | QFile::Text );
if( !b ) if( !b )
{ {
QMessageBox::information( this, m_fileName.clear();
tr( "No log file found" ),
tr( "There was no log file found, therefore nothing to report. Exiting..." ) );
close();
return; return;
} }
@ -186,6 +186,18 @@ void CCrashReportWidget::onLoad()
void CCrashReportWidget::onSendClicked() void CCrashReportWidget::onSendClicked()
{ {
if( m_developerMode && !m_devSendReport )
{
close();
return;
}
if( m_socket->url().isEmpty() || m_fileName.isEmpty() )
{
close();
return;
}
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
SCrashReportData data; SCrashReportData data;
@ -216,30 +228,32 @@ void CCrashReportWidget::onSendCBClicked()
} }
m_ui.emailCB->setEnabled( !b ); m_ui.emailCB->setEnabled( !b );
m_devSendReport = !m_devSendReport;
} }
void CCrashReportWidget::onAlwaysIgnoreClicked() void CCrashReportWidget::onAlwaysIgnoreClicked()
{ {
m_returnValue = ERET_ALWAYS_IGNORE; m_returnValue = ERET_ALWAYS_IGNORE;
close(); onSendClicked();
} }
void CCrashReportWidget::onIgnoreClicked() void CCrashReportWidget::onIgnoreClicked()
{ {
m_returnValue = ERET_IGNORE; m_returnValue = ERET_IGNORE;
close(); onSendClicked();
} }
void CCrashReportWidget::onAbortClicked() void CCrashReportWidget::onAbortClicked()
{ {
m_returnValue = ERET_ABORT; m_returnValue = ERET_ABORT;
close(); onSendClicked();
} }
void CCrashReportWidget::onBreakClicked() void CCrashReportWidget::onBreakClicked()
{ {
m_returnValue = ERET_BREAK; m_returnValue = ERET_BREAK;
close(); onSendClicked();
} }
@ -267,7 +281,9 @@ void CCrashReportWidget::onReportFailed()
void CCrashReportWidget::removeAndQuit() void CCrashReportWidget::removeAndQuit()
{ {
if( !m_fileName.isEmpty() )
QFile::remove( m_fileName ); QFile::remove( m_fileName );
close(); close();
} }

View file

@ -73,6 +73,7 @@ private:
CCrashReportSocket *m_socket; CCrashReportSocket *m_socket;
bool m_developerMode; bool m_developerMode;
bool m_forceSend; bool m_forceSend;
bool m_devSendReport;
EReturnValue m_returnValue; EReturnValue m_returnValue;
}; };