From d28483fad4a197a8b63dfa005882f6ef8e7e4834 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 30 Jan 2016 21:38:33 +0300 Subject: [PATCH] windows and os x crash reports sent and shown --- Telegram/SourceFiles/boxes/aboutbox.cpp | 26 +++++++++++++++++++++++++ Telegram/SourceFiles/boxes/aboutbox.h | 5 ++++- Telegram/SourceFiles/historywidget.cpp | 22 --------------------- Telegram/SourceFiles/logs.cpp | 8 ++++++-- Telegram/SourceFiles/logs.h | 6 +++--- 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp index 79b8c7249..a9bc2e0ad 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.cpp +++ b/Telegram/SourceFiles/boxes/aboutbox.cpp @@ -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) { diff --git a/Telegram/SourceFiles/boxes/aboutbox.h b/Telegram/SourceFiles/boxes/aboutbox.h index 533ab0323..6be8c2ed4 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.h +++ b/Telegram/SourceFiles/boxes/aboutbox.h @@ -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(); diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 66eb87068..95830b4e8 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -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(); diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 24aa69849..3570e3b25 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -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); } diff --git a/Telegram/SourceFiles/logs.h b/Telegram/SourceFiles/logs.h index 422110709..9deebadb1 100644 --- a/Telegram/SourceFiles/logs.h +++ b/Telegram/SourceFiles/logs.h @@ -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,