windows and os x crash reports sent and shown

This commit is contained in:
John Preston 2016-01-30 21:38:33 +03:00
parent 12716a8c40
commit d28483fad4
5 changed files with 39 additions and 28 deletions

View file

@ -44,6 +44,8 @@ AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));
prepare();
setAcceptDrops(true);
}
void AboutBox::hideAll() {
@ -105,6 +107,30 @@ void AboutBox::paintEvent(QPaintEvent *e) {
paintTitle(p, qsl("Telegram Desktop"));
}
QString _getCrashReportFile(const QMimeData *m) {
if (!m || m->urls().size() != 1) return QString();
QString file(m->urls().at(0).toLocalFile());
if (file.startsWith(qsl("/.file/id="))) file = psConvertFileUrl(file);
return file.endsWith(qstr(".telegramcrash"), Qt::CaseInsensitive) ? file : QString();
}
void AboutBox::dragEnterEvent(QDragEnterEvent *e) {
if (!_getCrashReportFile(e->mimeData()).isEmpty()) {
e->setDropAction(Qt::CopyAction);
e->accept();
}
}
void AboutBox::dropEvent(QDropEvent *e) {
if (!_getCrashReportFile(e->mimeData()).isEmpty()) {
e->acceptProposedAction();
psExecTelegram(_getCrashReportFile(e->mimeData()));
App::quit();
}
}
QString telegramFaqLink() {
QString result = qsl("https://telegram.org/faq");
if (cLang() > languageDefault && cLang() < languageCount) {

View file

@ -31,7 +31,10 @@ public:
void resizeEvent(QResizeEvent *e);
void keyPressEvent(QKeyEvent *e);
void paintEvent(QPaintEvent *e);
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
public slots:
void onVersion();

View file

@ -4804,22 +4804,7 @@ void HistoryWidget::onDocumentSelect() {
}
}
QString _getCrashReportFile(const QMimeData *m) {
if (!m || m->urls().size() != 1) return QString();
QString file(m->urls().at(0).toLocalFile());
if (file.startsWith(qsl("/.file/id="))) file = psConvertFileUrl(file);
return file.endsWith(qstr(".telegramcrash"), Qt::CaseInsensitive) ? file : QString();
}
void HistoryWidget::dragEnterEvent(QDragEnterEvent *e) {
if (!_peer && !_getCrashReportFile(e->mimeData()).isEmpty()) {
e->setDropAction(Qt::CopyAction);
e->accept();
return;
}
if (!_history) return;
if (_peer && (_peer->isChannel() && !_peer->asChannel()->canPublish())) return;
@ -5141,13 +5126,6 @@ bool HistoryWidget::kbWasHidden() const {
}
void HistoryWidget::dropEvent(QDropEvent *e) {
if (!_peer && !_getCrashReportFile(e->mimeData()).isEmpty()) {
e->acceptProposedAction();
psExecTelegram(_getCrashReportFile(e->mimeData()));
App::quit();
return;
}
_attachDrag = DragStateNone;
updateDragAreas();
e->acceptProposedAction();

View file

@ -596,11 +596,15 @@ namespace SignalHandlers {
return _writeNumber(stream, num);
}
const dump &operator<<(const dump &stream, uint32 num) {
const dump &operator<<(const dump &stream, unsigned int num) {
return _writeNumber(stream, num);
}
const dump &operator<<(const dump &stream, uint64 num) {
const dump &operator<<(const dump &stream, unsigned long num) {
return _writeNumber(stream, num);
}
const dump &operator<<(const dump &stream, unsigned long long num) {
return _writeNumber(stream, num);
}

View file

@ -93,10 +93,10 @@ namespace SignalHandlers {
};
const dump &operator<<(const dump &stream, const char *str);
const dump &operator<<(const dump &stream, int num);
const dump &operator<<(const dump &stream, uint32 num);
const dump &operator<<(const dump &stream, uint64 num);
const dump &operator<<(const dump &stream, unsigned int num);
const dump &operator<<(const dump &stream, unsigned long num);
const dump &operator<<(const dump &stream, unsigned long long num);
const dump &operator<<(const dump &stream, double num);
enum Status {
CantOpen,
LastCrashed,