report the crash id back to the user
Change-Id: I5cc1e698294a5674d691529af8cc14e4cd87a711 Reviewed-on: https://gerrit.libreoffice.org/25865 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
@@ -82,7 +82,7 @@ std::string generate_json(const std::map<std::string, std::string>& parameters)
|
|||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uploadContent(std::map<std::string, std::string>& parameters)
|
bool uploadContent(std::map<std::string, std::string>& parameters, std::string& response)
|
||||||
{
|
{
|
||||||
CURL* curl = curl_easy_init();
|
CURL* curl = curl_easy_init();
|
||||||
if (!curl)
|
if (!curl)
|
||||||
@@ -175,6 +175,7 @@ bool uploadContent(std::map<std::string, std::string>& parameters)
|
|||||||
|
|
||||||
std::cerr << response_body << " " << error_description << std::endl;
|
std::cerr << response_body << " " << error_description << std::endl;
|
||||||
|
|
||||||
|
response = response_body;
|
||||||
|
|
||||||
if( CURLE_OK != cc )
|
if( CURLE_OK != cc )
|
||||||
return false;
|
return false;
|
||||||
@@ -182,7 +183,7 @@ bool uploadContent(std::map<std::string, std::string>& parameters)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readConfig(const std::string& iniPath)
|
bool readConfig(const std::string& iniPath, std::string& response)
|
||||||
{
|
{
|
||||||
std::ifstream file(iniPath);
|
std::ifstream file(iniPath);
|
||||||
std::map<std::string, std::string> parameters = readStrings(file);
|
std::map<std::string, std::string> parameters = readStrings(file);
|
||||||
@@ -200,7 +201,7 @@ bool readConfig(const std::string& iniPath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return uploadContent(parameters);
|
return uploadContent(parameters, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -20,9 +20,11 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string iniPath(argv[1]);
|
std::string iniPath(argv[1]);
|
||||||
if (!readConfig(iniPath))
|
std::string response;
|
||||||
|
if (!readConfig(iniPath, response))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
std::cout << "Response: " << response << std::endl;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
bool readConfig(const std::string& iniPath);
|
bool readConfig(const std::string& iniPath, std::string& response);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -23,9 +23,13 @@ CrashReportDialog::CrashReportDialog(vcl::Window* pParent):
|
|||||||
{
|
{
|
||||||
get(mpBtnSend, "btn_send");
|
get(mpBtnSend, "btn_send");
|
||||||
get(mpBtnCancel, "btn_cancel");
|
get(mpBtnCancel, "btn_cancel");
|
||||||
|
get(mpBtnClose, "btn_close");
|
||||||
|
get(mpEditPreUpload, "ed_pre");
|
||||||
|
get(mpEditPostUpload, "ed_post");
|
||||||
|
|
||||||
mpBtnSend->SetClickHdl(LINK(this, CrashReportDialog, BtnHdl));
|
mpBtnSend->SetClickHdl(LINK(this, CrashReportDialog, BtnHdl));
|
||||||
mpBtnCancel->SetClickHdl(LINK(this, CrashReportDialog, BtnHdl));
|
mpBtnCancel->SetClickHdl(LINK(this, CrashReportDialog, BtnHdl));
|
||||||
|
mpBtnClose->SetClickHdl(LINK(this, CrashReportDialog, BtnHdl));
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashReportDialog::~CrashReportDialog()
|
CrashReportDialog::~CrashReportDialog()
|
||||||
@@ -37,6 +41,9 @@ void CrashReportDialog::dispose()
|
|||||||
{
|
{
|
||||||
mpBtnSend.clear();
|
mpBtnSend.clear();
|
||||||
mpBtnCancel.clear();
|
mpBtnCancel.clear();
|
||||||
|
mpBtnClose.clear();
|
||||||
|
mpEditPreUpload.clear();
|
||||||
|
mpEditPostUpload.clear();
|
||||||
|
|
||||||
Dialog::dispose();
|
Dialog::dispose();
|
||||||
}
|
}
|
||||||
@@ -59,17 +66,29 @@ IMPL_LINK_TYPED(CrashReportDialog, BtnHdl, Button*, pBtn, void)
|
|||||||
{
|
{
|
||||||
std::string ini_path = CrashReporter::getIniFileName();
|
std::string ini_path = CrashReporter::getIniFileName();
|
||||||
|
|
||||||
readConfig(ini_path);
|
std::string response;
|
||||||
// TODO: moggi: return the id for the user to look it up
|
bool bSuccess = readConfig(ini_path, response);
|
||||||
Close();
|
|
||||||
|
OUString aCrashID = OUString::createFromAscii(response.c_str());
|
||||||
|
|
||||||
|
if (bSuccess)
|
||||||
|
mpEditPostUpload->SetText(mpEditPostUpload->GetText() + " " + aCrashID);
|
||||||
|
else
|
||||||
|
mpEditPostUpload->SetText(mpEditPostUpload->GetText() + " Error!");
|
||||||
|
|
||||||
|
mpBtnClose->Show();
|
||||||
|
mpEditPreUpload->Hide();
|
||||||
|
mpEditPostUpload->Show();
|
||||||
|
mpBtnSend->Hide();
|
||||||
|
mpBtnCancel->Hide();
|
||||||
}
|
}
|
||||||
else if (pBtn == mpBtnCancel.get())
|
else if (pBtn == mpBtnCancel.get())
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
else
|
else if (pBtn == mpBtnClose.get())
|
||||||
{
|
{
|
||||||
assert(false);
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
#include <vcl/dialog.hxx>
|
#include <vcl/dialog.hxx>
|
||||||
#include <vcl/button.hxx>
|
#include <vcl/button.hxx>
|
||||||
|
#include <vcl/fixed.hxx>
|
||||||
|
#include <vcl/edit.hxx>
|
||||||
|
|
||||||
class CrashReportDialog : public Dialog
|
class CrashReportDialog : public Dialog
|
||||||
{
|
{
|
||||||
@@ -27,6 +29,9 @@ private:
|
|||||||
|
|
||||||
VclPtr<Button> mpBtnSend;
|
VclPtr<Button> mpBtnSend;
|
||||||
VclPtr<Button> mpBtnCancel;
|
VclPtr<Button> mpBtnCancel;
|
||||||
|
VclPtr<Button> mpBtnClose;
|
||||||
|
VclPtr<FixedText> mpEditPreUpload;
|
||||||
|
VclPtr<FixedText> mpEditPostUpload;
|
||||||
|
|
||||||
DECL_LINK_TYPED(BtnHdl, Button*, void);
|
DECL_LINK_TYPED(BtnHdl, Button*, void);
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.19.0 -->
|
<!-- Generated with glade 3.18.3 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.12"/>
|
<requires lib="gtk+" version="3.12"/>
|
||||||
<object class="GtkDialog" id="CrashReportDialog">
|
<object class="GtkDialog" id="CrashReportDialog">
|
||||||
@@ -46,15 +46,27 @@
|
|||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="btn_close">
|
||||||
|
<property name="label" translatable="yes">Close</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">0</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label1">
|
<object class="GtkLabel" id="ed_pre">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">We are sorry but it seems that LibreOffice crashed the last time.
|
<property name="label" translatable="yes">We are sorry but it seems that LibreOffice crashed the last time.
|
||||||
@@ -62,6 +74,22 @@
|
|||||||
You can help us fix this issue by sending the crash report to the LibreOffice crash reporting server.</property>
|
You can help us fix this issue by sending the crash report to the LibreOffice crash reporting server.</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="ed_post">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">The crash report was successfully uploaded.
|
||||||
|
You can soon find the report on crashreport.libreoffice.org.
|
||||||
|
The report can be found by</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
@@ -71,4 +99,5 @@ You can help us fix this issue by sending the crash report to the LibreOffice cr
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkActionGroup" id="actiongroup1"/>
|
||||||
</interface>
|
</interface>
|
||||||
|
Reference in New Issue
Block a user