From 218f991547ad02a3cb55df2d7d03e562eabe9482 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 31 Dec 2016 17:34:41 +0400 Subject: [PATCH] Alpha version 0.10.22: critical bug fixes. --- Telegram/Resources/winrc/Telegram.rc | 8 +- Telegram/Resources/winrc/Updater.rc | 8 +- Telegram/SourceFiles/boxes/backgroundbox.cpp | 3 +- Telegram/SourceFiles/boxes/confirmbox.cpp | 5 +- Telegram/SourceFiles/boxes/contactsbox.cpp | 3 +- Telegram/SourceFiles/boxes/sharebox.cpp | 3 +- Telegram/SourceFiles/boxes/stickers_box.cpp | 2 + Telegram/SourceFiles/core/version.h | 4 +- .../SourceFiles/dialogs/dialogs_layout.cpp | 13 ++ Telegram/SourceFiles/dialogs/dialogs_layout.h | 2 + Telegram/SourceFiles/dialogswidget.cpp | 7 + .../SourceFiles/history/history_message.cpp | 17 ++ Telegram/SourceFiles/historywidget.cpp | 105 ++++----- Telegram/SourceFiles/historywidget.h | 9 +- Telegram/SourceFiles/mainwidget.cpp | 28 +-- Telegram/SourceFiles/mainwidget.h | 8 +- Telegram/SourceFiles/mainwindow.cpp | 5 +- Telegram/SourceFiles/mediaview.cpp | 10 +- Telegram/SourceFiles/mtproto/scheme.tl | 7 +- Telegram/SourceFiles/mtproto/scheme_auto.cpp | 56 ++++- Telegram/SourceFiles/mtproto/scheme_auto.h | 199 +++++++++++++++++- Telegram/SourceFiles/overviewwidget.cpp | 102 ++++----- Telegram/SourceFiles/overviewwidget.h | 9 +- .../platform/win/main_window_win.cpp | 3 +- .../platform/win/window_title_win.cpp | 3 + .../profile/profile_common_groups_section.cpp | 1 + .../SourceFiles/profile/profile_cover.cpp | 9 +- .../SourceFiles/settings/settings_cover.cpp | 8 +- Telegram/SourceFiles/stickers/emoji_pan.cpp | 6 +- Telegram/SourceFiles/ui/abstract_button.cpp | 14 +- Telegram/SourceFiles/ui/abstract_button.h | 4 + Telegram/SourceFiles/ui/animation.h | 36 ++-- .../SourceFiles/ui/widgets/input_fields.cpp | 76 +++++-- .../SourceFiles/ui/widgets/input_fields.h | 18 +- .../SourceFiles/ui/widgets/scroll_area.cpp | 6 +- Telegram/SourceFiles/window/main_window.cpp | 14 +- Telegram/SourceFiles/window/main_window.h | 1 + .../window/notifications_manager_default.cpp | 20 ++ .../window/notifications_manager_default.h | 2 +- .../SourceFiles/window/top_bar_widget.cpp | 2 +- .../SourceFiles/window/window_main_menu.cpp | 4 +- Telegram/build/version | 6 +- 42 files changed, 634 insertions(+), 212 deletions(-) diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 1c651926b2..71326f092f 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,21,0 - PRODUCTVERSION 0,10,21,0 + FILEVERSION 0,10,22,0 + PRODUCTVERSION 0,10,22,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.10.21.0" + VALUE "FileVersion", "0.10.22.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.21.0" + VALUE "ProductVersion", "0.10.22.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index d72c2d488b..8a22fa97ea 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,21,0 - PRODUCTVERSION 0,10,21,0 + FILEVERSION 0,10,22,0 + PRODUCTVERSION 0,10,22,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "0.10.21.0" + VALUE "FileVersion", "0.10.22.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.21.0" + VALUE "ProductVersion", "0.10.22.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/boxes/backgroundbox.cpp b/Telegram/SourceFiles/boxes/backgroundbox.cpp index 24c3a5d40a..176d227bfb 100644 --- a/Telegram/SourceFiles/boxes/backgroundbox.cpp +++ b/Telegram/SourceFiles/boxes/backgroundbox.cpp @@ -65,8 +65,7 @@ BackgroundBox::Inner::Inner(QWidget *parent) : TWidget(parent) } subscribe(FileDownload::ImageLoaded(), [this] { update(); }); - using Update = Window::Theme::BackgroundUpdate; - subscribe(Window::Theme::Background(), [this](const Update &update) { + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { if (update.paletteChanged()) { _check->invalidateCache(); } diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index cba2f89595..2ac6144848 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -447,11 +447,12 @@ void RichDeleteMessageBox::deleteAndClear() { App::main()->deleteAllFromUser(_channel, _from); } if (auto item = App::histItemById(_channel ? peerToChannel(_channel->id) : 0, _msgId)) { - bool wasLast = (item->history()->lastMsg == item); + auto wasLast = (item->history()->lastMsg == item); item->destroy(); if (_msgId > 0) { - App::main()->deleteMessages(_channel, QVector(1, MTP_int(_msgId))); + auto forEveryone = true; + App::main()->deleteMessages(_channel, QVector(1, MTP_int(_msgId)), forEveryone); } else if (wasLast) { App::main()->checkPeerHistory(_channel); } diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 2e656a2555..a4a3dee209 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -638,8 +638,7 @@ void ContactsBox::Inner::init() { connect(App::main(), SIGNAL(peerNameChanged(PeerData*,const PeerData::Names&,const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*,const PeerData::Names&,const PeerData::NameFirstChars&))); connect(App::main(), SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(peerUpdated(PeerData*))); - using Update = Window::Theme::BackgroundUpdate; - subscribe(Window::Theme::Background(), [this](const Update &update) { + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { if (update.paletteChanged()) { invalidateCache(); } diff --git a/Telegram/SourceFiles/boxes/sharebox.cpp b/Telegram/SourceFiles/boxes/sharebox.cpp index a44b5e9704..138c0ade1c 100644 --- a/Telegram/SourceFiles/boxes/sharebox.cpp +++ b/Telegram/SourceFiles/boxes/sharebox.cpp @@ -296,8 +296,7 @@ ShareBox::Inner::Inner(QWidget *parent, ShareBox::FilterCallback &&filterCallbac })); subscribe(FileDownload::ImageLoaded(), [this] { update(); }); - using Update = Window::Theme::BackgroundUpdate; - subscribe(Window::Theme::Background(), [this](const Update &update) { + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { if (update.paletteChanged()) { invalidateCache(); } diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 913bd7064e..d41b9a8904 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -276,6 +276,7 @@ void StickersBox::prepare() { if (_tabs) { _tabs->raise(); + _unreadBadge->raise(); } rebuildList(); } @@ -402,6 +403,7 @@ void StickersBox::switchTab() { _section = newSection; setInnerWidget(_tab->takeWidget(), getTopSkip()); _tabs->raise(); + _unreadBadge->raise(); _tab->widget()->show(); rebuildList(); onScrollToY(_tab->getScrollTop()); diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index a9e34306f0..d0baa5682b 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 10021; -constexpr str_const AppVersionStr = "0.10.21"; +constexpr int AppVersion = 10022; +constexpr str_const AppVersionStr = "0.10.22"; constexpr bool AppAlphaVersion = true; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index 5cf0f3451c..ddc40606cc 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -336,5 +336,18 @@ void paintImportantSwitch(Painter &p, Mode current, int fullWidth, bool selected } } +void clearUnreadBadgesCache() { + if (unreadBadgeStyle) { + for (auto &data : unreadBadgeStyle->sizes) { + for (auto &left : data.left) { + left = QPixmap(); + } + for (auto &right : data.right) { + right = QPixmap(); + } + } + } +} + } // namespace Layout } // namespace Dialogs diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.h b/Telegram/SourceFiles/dialogs/dialogs_layout.h index 4e5bc6cb0b..4e83254098 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.h +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.h @@ -62,5 +62,7 @@ struct UnreadBadgeStyle { }; void paintUnreadCount(Painter &p, const QString &text, int x, int y, const UnreadBadgeStyle &st, int *outUnreadWidth = nullptr); +void clearUnreadBadgesCache(); + } // namespace Layout } // namespace Dialogs diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 9f985aa0a0..ed0c3a43e6 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -42,6 +42,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "apiwrap.h" #include "ui/widgets/dropdown_menu.h" #include "ui/widgets/input_fields.h" +#include "window/window_theme.h" #include "autoupdater.h" namespace { @@ -94,6 +95,12 @@ DialogsInner::DialogsInner(QWidget *parent, QWidget *main) : SplittedWidget(pare updateDialogRow(update.history->peer, MsgId(0), updateRect, UpdateRowSection::Default | UpdateRowSection::Filtered); }); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &data) { + if (data.paletteChanged()) { + Dialogs::Layout::clearUnreadBadgesCache(); + } + }); + refresh(); } diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 83a0de382a..fa73032523 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -1887,6 +1887,23 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) { prepareGameScoreText(from, &text, &links); } break; + case mtpc_messageActionPhoneCall: { + auto &d = action.c_messageActionPhoneCall(); + if (d.has_reason()) { + switch (d.vreason.type()) { + case mtpc_phoneCallDiscardReasonBusy: break; + case mtpc_phoneCallDiscardReasonDisconnect: break; + case mtpc_phoneCallDiscardReasonHangup: break; + case mtpc_phoneCallDiscardReasonMissed: break; + } + } else { + + } + if (d.has_duration()) { + d.vduration.v; + } + } break; + default: from = QString(); break; } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index fcd03cf5eb..f8c1f875d6 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -1265,7 +1265,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (isUponSelected > 1) { _menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected())); if (selectedForDelete == selectedForForward) { - _menu->addAction(lang(lng_context_delete_selected), _widget, SLOT(onDeleteSelected())); + _menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] { + _widget->confirmDeleteSelectedItems(); + })); } _menu->addAction(lang(lng_context_clear_selection), _widget, SLOT(onClearSelected())); } else if (App::hoveredLinkItem()) { @@ -1274,7 +1276,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _menu->addAction(lang(lng_context_forward_msg), _widget, SLOT(forwardMessage()))->setEnabled(true); } if (App::hoveredLinkItem()->canDelete()) { - _menu->addAction(lang(lng_context_delete_msg), _widget, SLOT(deleteMessage()))->setEnabled(true); + _menu->addAction(lang(lng_context_delete_msg), base::lambda_guarded(this, [this] { + _widget->confirmDeleteContextItem(); + })); } } if (App::hoveredLinkItem()->id > 0 && !App::hoveredLinkItem()->serviceMsg()) { @@ -1364,7 +1368,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (isUponSelected > 1) { _menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected())); if (selectedForDelete == selectedForForward) { - _menu->addAction(lang(lng_context_delete_selected), _widget, SLOT(onDeleteSelected())); + _menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] { + _widget->confirmDeleteSelectedItems(); + })); } _menu->addAction(lang(lng_context_clear_selection), _widget, SLOT(onClearSelected())); } else if (item && ((isUponSelected != -2 && (canForward || canDelete)) || item->id > 0)) { @@ -1374,7 +1380,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } if (canDelete) { - _menu->addAction(lang((msg && msg->uploading()) ? lng_context_cancel_upload : lng_context_delete_msg), _widget, SLOT(deleteMessage()))->setEnabled(true); + _menu->addAction(lang((msg && msg->uploading()) ? lng_context_cancel_upload : lng_context_delete_msg), base::lambda_guarded(this, [this] { + _widget->confirmDeleteContextItem(); + })); } } if (item->id > 0 && !item->serviceMsg()) { @@ -1558,7 +1566,7 @@ void HistoryInner::keyPressEvent(QKeyEvent *e) { int32 selectedForForward, selectedForDelete; getSelectionState(selectedForForward, selectedForDelete); if (!_selected.isEmpty() && selectedForDelete == selectedForForward) { - _widget->onDeleteSelected(); + _widget->confirmDeleteSelectedItems(); } } else { e->ignore(); @@ -6146,14 +6154,6 @@ void HistoryWidget::contextMenuEvent(QContextMenuEvent *e) { return _list->showContextMenu(e); } -void HistoryWidget::deleteMessage() { - HistoryItem *item = App::contextItem(); - if (!item || item->type() != HistoryItemMsg) return; - - HistoryMessage *msg = dynamic_cast(item); - App::main()->deleteLayer((msg && msg->uploading()) ? -2 : -1); -} - void HistoryWidget::forwardMessage() { HistoryItem *item = App::contextItem(); if (!item || item->type() != HistoryItemMsg || item->serviceMsg()) return; @@ -8348,60 +8348,69 @@ void HistoryWidget::onForwardSelected() { App::main()->forwardLayer(true); } -void HistoryWidget::onDeleteSelected() { - if (!_list) return; +void HistoryWidget::confirmDeleteContextItem() { + auto item = App::contextItem(); + if (!item || item->type() != HistoryItemMsg) return; - SelectedItemSet sel; - _list->fillSelectedItems(sel); - if (sel.isEmpty()) return; - - App::main()->deleteLayer(sel.size()); + auto message = item->toHistoryMessage(); + App::main()->deleteLayer((message && message->uploading()) ? -2 : -1); } -void HistoryWidget::onDeleteSelectedSure() { - Ui::hideLayer(); +void HistoryWidget::confirmDeleteSelectedItems() { if (!_list) return; - SelectedItemSet sel; - _list->fillSelectedItems(sel); - if (sel.isEmpty()) return; + SelectedItemSet selected; + _list->fillSelectedItems(selected); + if (selected.isEmpty()) return; - QMap > ids; - for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { - if (i.value()->id > 0) { - ids[i.value()->history()->peer].push_back(MTP_int(i.value()->id)); - } - } - - onClearSelected(); - for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { - i.value()->destroy(); - } - - for (QMap >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) { - App::main()->deleteMessages(i.key(), i.value()); - } + App::main()->deleteLayer(selected.size()); } -void HistoryWidget::onDeleteContextSure() { +void HistoryWidget::deleteContextItem(bool forEveryone) { Ui::hideLayer(); - HistoryItem *item = App::contextItem(); + auto item = App::contextItem(); if (!item || item->type() != HistoryItemMsg) { return; } - QVector toDelete(1, MTP_int(item->id)); - History *h = item->history(); - bool wasOnServer = (item->id > 0), wasLast = (h->lastMsg == item); + auto toDelete = QVector(1, MTP_int(item->id)); + auto history = item->history(); + auto wasOnServer = (item->id > 0); + auto wasLast = (history->lastMsg == item); item->destroy(); - if (!wasOnServer && wasLast && !h->lastMsg) { - App::main()->checkPeerHistory(h->peer); + if (!wasOnServer && wasLast && !history->lastMsg) { + App::main()->checkPeerHistory(history->peer); } if (wasOnServer) { - App::main()->deleteMessages(h->peer, toDelete); + App::main()->deleteMessages(history->peer, toDelete, forEveryone); + } +} + +void HistoryWidget::deleteSelectedItems(bool forEveryone) { + Ui::hideLayer(); + if (!_list) return; + + SelectedItemSet selected; + _list->fillSelectedItems(selected); + if (selected.isEmpty()) return; + + QMap> idsByPeer; + for_const (auto item, selected) { + if (item->id > 0) { + idsByPeer[item->history()->peer].push_back(MTP_int(item->id)); + } + } + + onClearSelected(); + for_const (auto item, selected) { + item->destroy(); + } + + for (auto i = idsByPeer.cbegin(), e = idsByPeer.cend(); i != e; ++i) { + App::main()->deleteMessages(i.key(), i.value(), forEveryone); } } diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 6af3b12669..98a1c10f33 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -698,6 +698,11 @@ public: bool isItemVisible(HistoryItem *item); + void confirmDeleteContextItem(); + void confirmDeleteSelectedItems(); + void deleteContextItem(bool forEveryone); + void deleteSelectedItems(bool forEveryone); + void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col); void ui_repaintHistoryItem(const HistoryItem *item); @@ -797,7 +802,6 @@ public slots: void onWindowVisibleChanged(); - void deleteMessage(); void forwardMessage(); void selectMessage(); @@ -807,9 +811,6 @@ public slots: void onScrollTimer(); void onForwardSelected(); - void onDeleteSelected(); - void onDeleteSelectedSure(); - void onDeleteContextSure(); void onClearSelected(); void onAnimActiveStep(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index a957d553e1..86202296c0 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -655,13 +655,13 @@ void MainWidget::hiderLayer(object_ptr h) { } } -void MainWidget::forwardLayer(int32 forwardSelected) { +void MainWidget::forwardLayer(int forwardSelected) { hiderLayer((forwardSelected < 0) ? object_ptr(this) : object_ptr(this, forwardSelected > 0)); } -void MainWidget::deleteLayer(int32 selectedCount) { +void MainWidget::deleteLayer(int selectedCount) { if (selectedCount == -1 && !_overview) { - if (HistoryItem *item = App::contextItem()) { + if (auto item = App::contextItem()) { if (item->suggestBanReportDeleteAll()) { Ui::show(Box(item->history()->peer->asChannel(), item->from()->asUser(), item->id)); return; @@ -679,18 +679,18 @@ void MainWidget::deleteLayer(int32 selectedCount) { Ui::show(Box(text, confirmText, cancelText, base::lambda_guarded(this, [this, selectedCount] { if (selectedCount < 0) { if (_overview) { - _overview->onDeleteContextSure(); + _overview->deleteContextItem(false); } else { - _history->onDeleteContextSure(); + _history->deleteContextItem(false); } if (selectedCount < -1) { App::uploader()->unpause(); } } else { if (_overview) { - _overview->onDeleteSelectedSure(); + _overview->deleteSelectedItems(false); } else { - _history->onDeleteSelectedSure(); + _history->deleteSelectedItems(false); } } }), base::lambda_guarded(this, [selectedCount] { @@ -813,11 +813,15 @@ void MainWidget::deleteHistoryPart(DeleteHistoryRequest request, const MTPmessag MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request)); } -void MainWidget::deleteMessages(PeerData *peer, const QVector &ids) { +void MainWidget::deleteMessages(PeerData *peer, const QVector &ids, bool forEveryone) { if (peer->isChannel()) { MTP::send(MTPchannels_DeleteMessages(peer->asChannel()->inputChannel, MTP_vector(ids)), rpcDone(&MainWidget::messagesAffected, peer)); } else { - MTP::send(MTPmessages_DeleteMessages(MTP_vector(ids)), rpcDone(&MainWidget::messagesAffected, peer)); + auto flags = MTPmessages_DeleteMessages::Flags(0); + if (forEveryone) { + flags |= MTPmessages_DeleteMessages::Flag::f_revoke; + } + MTP::send(MTPmessages_DeleteMessages(MTP_flags(flags), MTP_vector(ids)), rpcDone(&MainWidget::messagesAffected, peer)); } } @@ -1104,11 +1108,11 @@ void MainWidget::forwardSelectedItems() { } } -void MainWidget::deleteSelectedItems() { +void MainWidget::confirmDeleteSelectedItems() { if (_overview) { - _overview->onDeleteSelected(); + _overview->confirmDeleteSelectedItems(); } else { - _history->onDeleteSelected(); + _history->confirmDeleteSelectedItems(); } } diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 244f3caf6f..7191803ea9 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -227,8 +227,8 @@ public: int32 dlgsWidth() const; - void forwardLayer(int32 forwardSelected = 0); // -1 - send paths - void deleteLayer(int32 selectedCount = -1); // -1 - context item, else selected, -2 - cancel upload + void forwardLayer(int forwardSelected = 0); // -1 - send paths + void deleteLayer(int selectedCount = -1); // -1 - context item, else selected, -2 - cancel upload void shareContactLayer(UserData *contact); void shareUrlLayer(const QString &url, const QString &text); void inlineSwitchLayer(const QString &botAndQuery); @@ -251,7 +251,7 @@ public: bool leaveChatFailed(PeerData *peer, const RPCError &e); void deleteHistoryAfterLeave(PeerData *peer, const MTPUpdates &updates); - void deleteMessages(PeerData *peer, const QVector &ids); + void deleteMessages(PeerData *peer, const QVector &ids, bool forEveryone); void deletedContact(UserData *user, const MTPcontacts_Link &result); void deleteConversation(PeerData *peer, bool deleteHistory = true); void deleteAndExit(ChatData *chat); @@ -271,7 +271,7 @@ public: bool sendMessageFail(const RPCError &error); void forwardSelectedItems(); - void deleteSelectedItems(); + void confirmDeleteSelectedItems(); void clearSelectedItems(); Dialogs::IndexedList *contactsList(); diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 16be758c75..47810b36fa 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -212,6 +212,7 @@ QWidget *MainWindow::filedialogParent() { } void MainWindow::clearWidgets() { + auto wasMain = (_main != nullptr); Ui::hideLayer(true); _passcode.destroyDelayed(); _main.destroy(); @@ -220,7 +221,9 @@ void MainWindow::clearWidgets() { hideMediaview(); _mediaView->rpcClear(); } - App::clearHistories(); + if (wasMain) { + App::clearHistories(); + } updateGlobalMenu(); } diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index c46551c529..21f67356fa 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -197,7 +197,7 @@ bool MediaView::fileShown() const { } bool MediaView::fileBubbleShown() const { - return _doc && !fileShown() && !_themePreviewShown; + return (!_photo && !_doc) || (_doc && !fileShown() && !_themePreviewShown); } bool MediaView::gifShown() const { @@ -226,7 +226,7 @@ void MediaView::stopGif() { } void MediaView::documentUpdated(DocumentData *doc) { - if (fileBubbleShown() && _doc == doc) { + if (fileBubbleShown() && _doc && _doc == doc) { if ((_doc->loading() && _docCancel->isHidden()) || (!_doc->loading() && !_docCancel->isHidden())) { updateControls(); } else if (_doc->loading()) { @@ -244,7 +244,7 @@ void MediaView::changingMsgId(HistoryItem *row, MsgId newId) { } void MediaView::updateDocSize() { - if (!fileBubbleShown()) return; + if (!_doc || !fileBubbleShown()) return; if (_doc->loading()) { quint64 ready = _doc->loadOffset(), total = _doc->size; @@ -277,7 +277,7 @@ void MediaView::updateDocSize() { } void MediaView::updateControls() { - if (fileBubbleShown()) { + if (_doc && fileBubbleShown()) { if (_doc->loading()) { _docDownload->hide(); _docSaveAs->hide(); @@ -2144,7 +2144,7 @@ bool MediaView::moveToNext(int32 delta) { case MediaTypeSticker: displayDocument(media->getDocument(), item); preloadData(delta); break; } } else { - displayDocument(0, item); + displayDocument(nullptr, item); preloadData(delta); } } diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index 6b7cbbc8eb..21c131cad3 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -253,6 +253,7 @@ messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageActio messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; +messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; dialog#66ffba14 flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; @@ -345,6 +346,7 @@ inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; +inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; @@ -875,7 +877,7 @@ messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_of messages.search#d4569248 flags:# peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; -messages.deleteMessages#a5f18925 id:Vector = messages.AffectedMessages; +messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; @@ -902,6 +904,7 @@ messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:byte messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; +messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; messages.getWebPagePreview#25223e24 message:string = MessageMedia; @@ -1008,4 +1011,4 @@ phone.acceptCall#220f0b20 peer:InputPhoneCall g_b:bytes key_fingerprint:long pro phone.discardCall#5dfbcddc peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Bool; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; -// LAYER 61 +// LAYER 62 diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp index 7f2d96e72f..418e1b58f3 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -1703,6 +1703,24 @@ void _serialize_messageActionGameScore(MTPStringLogger &to, int32 stage, int32 l } } +void _serialize_messageActionPhoneCall(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDmessageActionPhoneCall::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messageActionPhoneCall"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" call_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" reason: "); ++stages.back(); if (flag & MTPDmessageActionPhoneCall::Flag::f_reason) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 3: to.add(" duration: "); ++stages.back(); if (flag & MTPDmessageActionPhoneCall::Flag::f_duration) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_dialog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { MTPDdialog::Flags flag(iflag); @@ -2385,6 +2403,22 @@ void _serialize_inputMessagesFilterChatPhotos(MTPStringLogger &to, int32 stage, to.add("{ inputMessagesFilterChatPhotos }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +void _serialize_inputMessagesFilterPhoneCalls(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDinputMessagesFilterPhoneCalls::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ inputMessagesFilterPhoneCalls"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" missed: "); ++stages.back(); if (flag & MTPDinputMessagesFilterPhoneCalls::Flag::f_missed) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_updateNewMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -7346,6 +7380,19 @@ void _serialize_messages_readEncryptedHistory(MTPStringLogger &to, int32 stage, } } +void _serialize_messages_reportEncryptedSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_reportEncryptedSpam"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_messages_uninstallStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -8407,6 +8454,8 @@ void _serialize_messages_readHistory(MTPStringLogger &to, int32 stage, int32 lev } void _serialize_messages_deleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_deleteMessages::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -8414,7 +8463,9 @@ void _serialize_messages_deleteMessages(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" revoke: "); ++stages.back(); if (flag & MTPmessages_deleteMessages::Flag::f_revoke) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -9869,6 +9920,7 @@ namespace { _serializers.insert(mtpc_messageActionPinMessage, _serialize_messageActionPinMessage); _serializers.insert(mtpc_messageActionHistoryClear, _serialize_messageActionHistoryClear); _serializers.insert(mtpc_messageActionGameScore, _serialize_messageActionGameScore); + _serializers.insert(mtpc_messageActionPhoneCall, _serialize_messageActionPhoneCall); _serializers.insert(mtpc_dialog, _serialize_dialog); _serializers.insert(mtpc_photoEmpty, _serialize_photoEmpty); _serializers.insert(mtpc_photo, _serialize_photo); @@ -9930,6 +9982,7 @@ namespace { _serializers.insert(mtpc_inputMessagesFilterVoice, _serialize_inputMessagesFilterVoice); _serializers.insert(mtpc_inputMessagesFilterMusic, _serialize_inputMessagesFilterMusic); _serializers.insert(mtpc_inputMessagesFilterChatPhotos, _serialize_inputMessagesFilterChatPhotos); + _serializers.insert(mtpc_inputMessagesFilterPhoneCalls, _serialize_inputMessagesFilterPhoneCalls); _serializers.insert(mtpc_updateNewMessage, _serialize_updateNewMessage); _serializers.insert(mtpc_updateMessageID, _serialize_updateMessageID); _serializers.insert(mtpc_updateDeleteMessages, _serialize_updateDeleteMessages); @@ -10310,6 +10363,7 @@ namespace { _serializers.insert(mtpc_messages_discardEncryption, _serialize_messages_discardEncryption); _serializers.insert(mtpc_messages_setEncryptedTyping, _serialize_messages_setEncryptedTyping); _serializers.insert(mtpc_messages_readEncryptedHistory, _serialize_messages_readEncryptedHistory); + _serializers.insert(mtpc_messages_reportEncryptedSpam, _serialize_messages_reportEncryptedSpam); _serializers.insert(mtpc_messages_uninstallStickerSet, _serialize_messages_uninstallStickerSet); _serializers.insert(mtpc_messages_editChatAdmin, _serialize_messages_editChatAdmin); _serializers.insert(mtpc_messages_reorderStickerSets, _serialize_messages_reorderStickerSets); diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index e926619075..040b36e0dd 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -30,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org namespace MTP { namespace internal { -static constexpr mtpPrime CurrentLayer = 61; +static constexpr mtpPrime CurrentLayer = 62; class TypeCreator; @@ -182,6 +182,7 @@ enum { mtpc_messageActionPinMessage = 0x94bd38ed, mtpc_messageActionHistoryClear = 0x9fbab604, mtpc_messageActionGameScore = 0x92a72876, + mtpc_messageActionPhoneCall = 0x80e11a7f, mtpc_dialog = 0x66ffba14, mtpc_photoEmpty = 0x2331b22d, mtpc_photo = 0x9288dd29, @@ -243,6 +244,7 @@ enum { mtpc_inputMessagesFilterVoice = 0x50f5c392, mtpc_inputMessagesFilterMusic = 0x3751b49e, mtpc_inputMessagesFilterChatPhotos = 0x3a20ecb8, + mtpc_inputMessagesFilterPhoneCalls = 0x80c99768, mtpc_updateNewMessage = 0x1f2b0afd, mtpc_updateMessageID = 0x4e90bfd6, mtpc_updateDeleteMessages = 0xa20db0e5, @@ -654,7 +656,7 @@ enum { mtpc_messages_search = 0xd4569248, mtpc_messages_readHistory = 0xe306d3a, mtpc_messages_deleteHistory = 0x1c015b09, - mtpc_messages_deleteMessages = 0xa5f18925, + mtpc_messages_deleteMessages = 0xe58e95d2, mtpc_messages_receivedMessages = 0x5a954c0, mtpc_messages_setTyping = 0xa3825e50, mtpc_messages_sendMessage = 0xfa88427a, @@ -681,6 +683,7 @@ enum { mtpc_messages_sendEncryptedFile = 0x9a901b66, mtpc_messages_sendEncryptedService = 0x32d439a4, mtpc_messages_receivedQueue = 0x55a5bb66, + mtpc_messages_reportEncryptedSpam = 0x4b0c8c0f, mtpc_messages_readMessageContents = 0x36a73f77, mtpc_messages_getAllStickers = 0x1c9618b1, mtpc_messages_getWebPagePreview = 0x25223e24, @@ -978,6 +981,7 @@ class MTPDmessageActionChannelCreate; class MTPDmessageActionChatMigrateTo; class MTPDmessageActionChannelMigrateFrom; class MTPDmessageActionGameScore; +class MTPDmessageActionPhoneCall; class MTPdialog; class MTPDdialog; @@ -1077,6 +1081,7 @@ class MTPmessages_affectedHistory; class MTPDmessages_affectedHistory; class MTPmessagesFilter; +class MTPDinputMessagesFilterPhoneCalls; class MTPupdate; class MTPDupdateNewMessage; @@ -3910,6 +3915,16 @@ public: return *(const MTPDmessageActionGameScore*)data; } + MTPDmessageActionPhoneCall &_messageActionPhoneCall() { + t_assert(data != nullptr && _type == mtpc_messageActionPhoneCall); + split(); + return *(MTPDmessageActionPhoneCall*)data; + } + const MTPDmessageActionPhoneCall &c_messageActionPhoneCall() const { + t_assert(data != nullptr && _type == mtpc_messageActionPhoneCall); + return *(const MTPDmessageActionPhoneCall*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -3929,6 +3944,7 @@ private: explicit MTPmessageAction(MTPDmessageActionChatMigrateTo *_data); explicit MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data); explicit MTPmessageAction(MTPDmessageActionGameScore *_data); + explicit MTPmessageAction(MTPDmessageActionPhoneCall *_data); friend class MTP::internal::TypeCreator; @@ -4999,14 +5015,24 @@ private: }; typedef MTPBoxed MTPmessages_AffectedHistory; -class MTPmessagesFilter { +class MTPmessagesFilter : private mtpDataOwner { public: - MTPmessagesFilter() : _type(0) { + MTPmessagesFilter() : mtpDataOwner(0), _type(0) { } - MTPmessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPmessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { read(from, end, cons); } + MTPDinputMessagesFilterPhoneCalls &_inputMessagesFilterPhoneCalls() { + t_assert(data != nullptr && _type == mtpc_inputMessagesFilterPhoneCalls); + split(); + return *(MTPDinputMessagesFilterPhoneCalls*)data; + } + const MTPDinputMessagesFilterPhoneCalls &c_inputMessagesFilterPhoneCalls() const { + t_assert(data != nullptr && _type == mtpc_inputMessagesFilterPhoneCalls); + return *(const MTPDinputMessagesFilterPhoneCalls*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -5016,6 +5042,7 @@ public: private: explicit MTPmessagesFilter(mtpTypeId type); + explicit MTPmessagesFilter(MTPDinputMessagesFilterPhoneCalls *_data); friend class MTP::internal::TypeCreator; @@ -11803,6 +11830,31 @@ public: MTPint vscore; }; +class MTPDmessageActionPhoneCall : public mtpDataImpl { +public: + enum class Flag : int32 { + f_reason = (1 << 0), + f_duration = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_reason() const { return vflags.v & Flag::f_reason; } + bool has_duration() const { return vflags.v & Flag::f_duration; } + + MTPDmessageActionPhoneCall() { + } + MTPDmessageActionPhoneCall(const MTPflags &_flags, const MTPlong &_call_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) : vflags(_flags), vcall_id(_call_id), vreason(_reason), vduration(_duration) { + } + + MTPflags vflags; + MTPlong vcall_id; + MTPPhoneCallDiscardReason vreason; + MTPint vduration; +}; + class MTPDdialog : public mtpDataImpl { public: enum class Flag : int32 { @@ -12355,6 +12407,25 @@ public: MTPint voffset; }; +class MTPDinputMessagesFilterPhoneCalls : public mtpDataImpl { +public: + enum class Flag : int32 { + f_missed = (1 << 0), + MAX_FIELD = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_missed() const { return vflags.v & Flag::f_missed; } + + MTPDinputMessagesFilterPhoneCalls() { + } + MTPDinputMessagesFilterPhoneCalls(const MTPflags &_flags) : vflags(_flags) { + } + + MTPflags vflags; +}; + class MTPDupdateNewMessage : public mtpDataImpl { public: MTPDupdateNewMessage() { @@ -19645,6 +19716,16 @@ public: class MTPmessages_deleteMessages { // RPC method 'messages.deleteMessages' public: + enum class Flag : int32 { + f_revoke = (1 << 0), + MAX_FIELD = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_revoke() const { return vflags.v & Flag::f_revoke; } + + MTPflags vflags; MTPVector vid; MTPmessages_deleteMessages() { @@ -19652,24 +19733,28 @@ public: MTPmessages_deleteMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_deleteMessages) { read(from, end, cons); } - MTPmessages_deleteMessages(const MTPVector &_id) : vid(_id) { + MTPmessages_deleteMessages(const MTPflags &_flags, const MTPVector &_id) : vflags(_flags), vid(_id) { } uint32 innerLength() const { - return vid.innerLength(); + return vflags.innerLength() + vid.innerLength(); } mtpTypeId type() const { return mtpc_messages_deleteMessages; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_deleteMessages) { + vflags.read(from, end); vid.read(from, end); } void write(mtpBuffer &to) const { + vflags.write(to); vid.write(to); } typedef MTPmessages_AffectedMessages ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_deleteMessages::Flags) + class MTPmessages_DeleteMessages : public MTPBoxed { public: MTPmessages_DeleteMessages() { @@ -19678,7 +19763,7 @@ public: } MTPmessages_DeleteMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_DeleteMessages(const MTPVector &_id) : MTPBoxed(MTPmessages_deleteMessages(_id)) { + MTPmessages_DeleteMessages(const MTPflags &_flags, const MTPVector &_id) : MTPBoxed(MTPmessages_deleteMessages(_flags, _id)) { } }; @@ -20870,6 +20955,45 @@ public: } }; +class MTPmessages_reportEncryptedSpam { // RPC method 'messages.reportEncryptedSpam' +public: + MTPInputEncryptedChat vpeer; + + MTPmessages_reportEncryptedSpam() { + } + MTPmessages_reportEncryptedSpam(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_reportEncryptedSpam) { + read(from, end, cons); + } + MTPmessages_reportEncryptedSpam(const MTPInputEncryptedChat &_peer) : vpeer(_peer) { + } + + uint32 innerLength() const { + return vpeer.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_reportEncryptedSpam; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_reportEncryptedSpam) { + vpeer.read(from, end); + } + void write(mtpBuffer &to) const { + vpeer.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPmessages_ReportEncryptedSpam : public MTPBoxed { +public: + MTPmessages_ReportEncryptedSpam() { + } + MTPmessages_ReportEncryptedSpam(const MTPmessages_reportEncryptedSpam &v) : MTPBoxed(v) { + } + MTPmessages_ReportEncryptedSpam(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_ReportEncryptedSpam(const MTPInputEncryptedChat &_peer) : MTPBoxed(MTPmessages_reportEncryptedSpam(_peer)) { + } +}; + class MTPmessages_readMessageContents { // RPC method 'messages.readMessageContents' public: MTPVector vid; @@ -25719,6 +25843,9 @@ public: inline static MTPmessageAction new_messageActionGameScore(const MTPlong &_game_id, MTPint _score) { return MTPmessageAction(new MTPDmessageActionGameScore(_game_id, _score)); } + inline static MTPmessageAction new_messageActionPhoneCall(const MTPflags &_flags, const MTPlong &_call_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) { + return MTPmessageAction(new MTPDmessageActionPhoneCall(_flags, _call_id, _reason, _duration)); + } inline static MTPdialog new_dialog(const MTPflags &_flags, const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts, const MTPDraftMessage &_draft) { return MTPdialog(new MTPDdialog(_flags, _peer, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _notify_settings, _pts, _draft)); } @@ -25902,6 +26029,9 @@ public: inline static MTPmessagesFilter new_inputMessagesFilterChatPhotos() { return MTPmessagesFilter(mtpc_inputMessagesFilterChatPhotos); } + inline static MTPmessagesFilter new_inputMessagesFilterPhoneCalls(const MTPflags &_flags) { + return MTPmessagesFilter(new MTPDinputMessagesFilterPhoneCalls(_flags)); + } inline static MTPupdate new_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count)); } @@ -30051,6 +30181,10 @@ inline uint32 MTPmessageAction::innerLength() const { const MTPDmessageActionGameScore &v(c_messageActionGameScore()); return v.vgame_id.innerLength() + v.vscore.innerLength(); } + case mtpc_messageActionPhoneCall: { + const MTPDmessageActionPhoneCall &v(c_messageActionPhoneCall()); + return v.vflags.innerLength() + v.vcall_id.innerLength() + (v.has_reason() ? v.vreason.innerLength() : 0) + (v.has_duration() ? v.vduration.innerLength() : 0); + } } return 0; } @@ -30118,6 +30252,14 @@ inline void MTPmessageAction::read(const mtpPrime *&from, const mtpPrime *end, m v.vgame_id.read(from, end); v.vscore.read(from, end); } break; + case mtpc_messageActionPhoneCall: _type = cons; { + if (!data) setData(new MTPDmessageActionPhoneCall()); + MTPDmessageActionPhoneCall &v(_messageActionPhoneCall()); + v.vflags.read(from, end); + v.vcall_id.read(from, end); + if (v.has_reason()) { v.vreason.read(from, end); } else { v.vreason = MTPPhoneCallDiscardReason(); } + if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); } + } break; default: throw mtpErrorUnexpected(cons, "MTPmessageAction"); } } @@ -30166,6 +30308,13 @@ inline void MTPmessageAction::write(mtpBuffer &to) const { v.vgame_id.write(to); v.vscore.write(to); } break; + case mtpc_messageActionPhoneCall: { + const MTPDmessageActionPhoneCall &v(c_messageActionPhoneCall()); + v.vflags.write(to); + v.vcall_id.write(to); + if (v.has_reason()) v.vreason.write(to); + if (v.has_duration()) v.vduration.write(to); + } break; } } inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -30184,6 +30333,7 @@ inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _ty case mtpc_messageActionPinMessage: break; case mtpc_messageActionHistoryClear: break; case mtpc_messageActionGameScore: setData(new MTPDmessageActionGameScore()); break; + case mtpc_messageActionPhoneCall: setData(new MTPDmessageActionPhoneCall()); break; default: throw mtpErrorBadTypeId(type, "MTPmessageAction"); } } @@ -30207,6 +30357,8 @@ inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_ } inline MTPmessageAction::MTPmessageAction(MTPDmessageActionGameScore *_data) : mtpDataOwner(_data), _type(mtpc_messageActionGameScore) { } +inline MTPmessageAction::MTPmessageAction(MTPDmessageActionPhoneCall *_data) : mtpDataOwner(_data), _type(mtpc_messageActionPhoneCall) { +} inline MTPmessageAction MTP_messageActionEmpty() { return MTP::internal::TypeCreator::new_messageActionEmpty(); } @@ -30249,6 +30401,10 @@ inline MTPmessageAction MTP_messageActionHistoryClear() { inline MTPmessageAction MTP_messageActionGameScore(const MTPlong &_game_id, MTPint _score) { return MTP::internal::TypeCreator::new_messageActionGameScore(_game_id, _score); } +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessageActionPhoneCall::Flags) +inline MTPmessageAction MTP_messageActionPhoneCall(const MTPflags &_flags, const MTPlong &_call_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) { + return MTP::internal::TypeCreator::new_messageActionPhoneCall(_flags, _call_id, _reason, _duration); +} inline MTPdialog::MTPdialog() : mtpDataOwner(new MTPDdialog()) { } @@ -31653,6 +31809,12 @@ inline MTPmessages_affectedHistory MTP_messages_affectedHistory(MTPint _pts, MTP } inline uint32 MTPmessagesFilter::innerLength() const { + switch (_type) { + case mtpc_inputMessagesFilterPhoneCalls: { + const MTPDinputMessagesFilterPhoneCalls &v(c_inputMessagesFilterPhoneCalls()); + return v.vflags.innerLength(); + } + } return 0; } inline mtpTypeId MTPmessagesFilter::type() const { @@ -31660,6 +31822,7 @@ inline mtpTypeId MTPmessagesFilter::type() const { return _type; } inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); switch (cons) { case mtpc_inputMessagesFilterEmpty: _type = cons; break; case mtpc_inputMessagesFilterPhotos: _type = cons; break; @@ -31672,12 +31835,23 @@ inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, case mtpc_inputMessagesFilterVoice: _type = cons; break; case mtpc_inputMessagesFilterMusic: _type = cons; break; case mtpc_inputMessagesFilterChatPhotos: _type = cons; break; + case mtpc_inputMessagesFilterPhoneCalls: _type = cons; { + if (!data) setData(new MTPDinputMessagesFilterPhoneCalls()); + MTPDinputMessagesFilterPhoneCalls &v(_inputMessagesFilterPhoneCalls()); + v.vflags.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPmessagesFilter"); } } inline void MTPmessagesFilter::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_inputMessagesFilterPhoneCalls: { + const MTPDinputMessagesFilterPhoneCalls &v(c_inputMessagesFilterPhoneCalls()); + v.vflags.write(to); + } break; + } } -inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) { +inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : mtpDataOwner(0), _type(type) { switch (type) { case mtpc_inputMessagesFilterEmpty: break; case mtpc_inputMessagesFilterPhotos: break; @@ -31690,9 +31864,12 @@ inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) { case mtpc_inputMessagesFilterVoice: break; case mtpc_inputMessagesFilterMusic: break; case mtpc_inputMessagesFilterChatPhotos: break; + case mtpc_inputMessagesFilterPhoneCalls: setData(new MTPDinputMessagesFilterPhoneCalls()); break; default: throw mtpErrorBadTypeId(type, "MTPmessagesFilter"); } } +inline MTPmessagesFilter::MTPmessagesFilter(MTPDinputMessagesFilterPhoneCalls *_data) : mtpDataOwner(_data), _type(mtpc_inputMessagesFilterPhoneCalls) { +} inline MTPmessagesFilter MTP_inputMessagesFilterEmpty() { return MTP::internal::TypeCreator::new_inputMessagesFilterEmpty(); } @@ -31726,6 +31903,10 @@ inline MTPmessagesFilter MTP_inputMessagesFilterMusic() { inline MTPmessagesFilter MTP_inputMessagesFilterChatPhotos() { return MTP::internal::TypeCreator::new_inputMessagesFilterChatPhotos(); } +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputMessagesFilterPhoneCalls::Flags) +inline MTPmessagesFilter MTP_inputMessagesFilterPhoneCalls(const MTPflags &_flags) { + return MTP::internal::TypeCreator::new_inputMessagesFilterPhoneCalls(_flags); +} inline uint32 MTPupdate::innerLength() const { switch (_type) { diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index bb2e39aba8..3cb48929b6 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -85,8 +85,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, Ui::ScrollArea *scroll, P _searchTimer.setSingleShot(true); connect(&_searchTimer, SIGNAL(timeout()), this, SLOT(onSearchMessages())); - using Update = Window::Theme::BackgroundUpdate; - subscribe(Window::Theme::Background(), [this](const Update &update) { + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { if (update.paletteChanged()) { invalidateCache(); } @@ -1227,7 +1226,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (isUponSelected > 1) { _menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected())); if (selectedForDelete == selectedForForward) { - _menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected())); + _menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] { + _overview->confirmDeleteSelectedItems(); + })); } _menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected())); } else if (App::hoveredLinkItem()) { @@ -1236,7 +1237,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _menu->addAction(lang(lng_context_forward_msg), this, SLOT(forwardMessage()))->setEnabled(true); } if (App::hoveredLinkItem()->canDelete()) { - _menu->addAction(lang(lng_context_delete_msg), this, SLOT(deleteMessage()))->setEnabled(true); + _menu->addAction(lang(lng_context_delete_msg), base::lambda_guarded(this, [this] { + _overview->confirmDeleteContextItem(); + })); } } if (App::hoveredLinkItem()->id > 0) { @@ -1256,7 +1259,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (isUponSelected > 1) { _menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected())); if (selectedForDelete == selectedForForward) { - _menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected())); + _menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] { + _overview->confirmDeleteSelectedItems(); + })); } _menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected())); } else { @@ -1265,7 +1270,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _menu->addAction(lang(lng_context_forward_msg), this, SLOT(forwardMessage()))->setEnabled(true); } if (App::mousedItem()->canDelete()) { - _menu->addAction(lang(lng_context_delete_msg), this, SLOT(deleteMessage()))->setEnabled(true); + _menu->addAction(lang(lng_context_delete_msg), base::lambda_guarded(this, [this] { + _overview->confirmDeleteContextItem(); + })); } } if (App::mousedItem()->id > 0) { @@ -1404,14 +1411,6 @@ void OverviewInner::forwardMessage() { App::main()->forwardLayer(); } -void OverviewInner::deleteMessage() { - HistoryItem *item = App::contextItem(); - if (!item || item->type() != HistoryItemMsg) return; - - HistoryMessage *msg = item->toHistoryMessage(); - App::main()->deleteLayer((msg && msg->uploading()) ? -2 : -1); -} - MsgId OverviewInner::complexMsgId(const HistoryItem *item) const { return item ? ((item->history() == _migrated) ? -item->id : item->id) : 0; } @@ -2273,7 +2272,15 @@ void OverviewWidget::onForwardSelected() { App::main()->forwardLayer(true); } -void OverviewWidget::onDeleteSelected() { +void OverviewWidget::confirmDeleteContextItem() { + auto item = App::contextItem(); + if (!item || item->type() != HistoryItemMsg) return; + + auto message = item->toHistoryMessage(); + App::main()->deleteLayer((message && message->uploading()) ? -2 : -1); +} + +void OverviewWidget::confirmDeleteSelectedItems() { SelectedItemSet sel; _inner->fillSelectedItems(sel); if (sel.isEmpty()) return; @@ -2281,49 +2288,50 @@ void OverviewWidget::onDeleteSelected() { App::main()->deleteLayer(sel.size()); } -void OverviewWidget::onDeleteSelectedSure() { +void OverviewWidget::deleteContextItem(bool forEveryone) { Ui::hideLayer(); - SelectedItemSet sel; - _inner->fillSelectedItems(sel); - if (sel.isEmpty()) return; - - QMap > ids; - for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { - if (i.value()->id > 0) { - ids[i.value()->history()->peer].push_back(MTP_int(i.value()->id)); - } - } - - onClearSelected(); - for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { - i.value()->destroy(); - } - - for (QMap >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) { - App::main()->deleteMessages(i.key(), i.value()); - } -} - -void OverviewWidget::onDeleteContextSure() { - Ui::hideLayer(); - - HistoryItem *item = App::contextItem(); + auto item = App::contextItem(); if (!item || item->type() != HistoryItemMsg) { return; } - QVector toDelete(1, MTP_int(item->id)); - History *h = item->history(); - bool wasOnServer = (item->id > 0), wasLast = (h->lastMsg == item); + auto toDelete = QVector(1, MTP_int(item->id)); + auto history = item->history(); + auto wasOnServer = (item->id > 0); + auto wasLast = (history->lastMsg == item); item->destroy(); - if (!wasOnServer && wasLast && !h->lastMsg) { - App::main()->checkPeerHistory(h->peer); + if (!wasOnServer && wasLast && !history->lastMsg) { + App::main()->checkPeerHistory(history->peer); } if (wasOnServer) { - App::main()->deleteMessages(h->peer, toDelete); + App::main()->deleteMessages(history->peer, toDelete, forEveryone); + } +} + +void OverviewWidget::deleteSelectedItems(bool forEveryone) { + Ui::hideLayer(); + + SelectedItemSet selected; + _inner->fillSelectedItems(selected); + if (selected.isEmpty()) return; + + QMap> idsByPeer; + for_const (auto item, selected) { + if (item->id > 0) { + idsByPeer[item->history()->peer].push_back(MTP_int(item->id)); + } + } + + onClearSelected(); + for_const (auto item, selected) { + item->destroy(); + } + + for (auto i = idsByPeer.cbegin(), e = idsByPeer.cend(); i != e; ++i) { + App::main()->deleteMessages(i.key(), i.value(), forEveryone); } } diff --git a/Telegram/SourceFiles/overviewwidget.h b/Telegram/SourceFiles/overviewwidget.h index 91ad75a651..0645e7744b 100644 --- a/Telegram/SourceFiles/overviewwidget.h +++ b/Telegram/SourceFiles/overviewwidget.h @@ -109,7 +109,6 @@ public slots: void showContextInFolder(); void goToMessage(); - void deleteMessage(); void forwardMessage(); void selectMessage(); @@ -332,6 +331,11 @@ public: RPCSender::rpcClear(); } + void confirmDeleteContextItem(); + void confirmDeleteSelectedItems(); + void deleteContextItem(bool forEveryone); + void deleteSelectedItems(bool forEveryone); + void ui_repaintHistoryItem(const HistoryItem *item); void notify_historyItemLayoutChanged(const HistoryItem *item); @@ -350,9 +354,6 @@ public slots: void onScrollTimer(); void onForwardSelected(); - void onDeleteSelected(); - void onDeleteSelectedSure(); - void onDeleteContextSure(); void onClearSelected(); private: diff --git a/Telegram/SourceFiles/platform/win/main_window_win.cpp b/Telegram/SourceFiles/platform/win/main_window_win.cpp index a83cfc8a2d..aeb86d9f7e 100644 --- a/Telegram/SourceFiles/platform/win/main_window_win.cpp +++ b/Telegram/SourceFiles/platform/win/main_window_win.cpp @@ -618,8 +618,7 @@ MainWindow::MainWindow() if (!_taskbarCreatedMsgId) { _taskbarCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated"); } - using Update = Window::Theme::BackgroundUpdate; - subscribe(Window::Theme::Background(), [this](const Update &update) { + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { if (update.paletteChanged()) { _psShadowWindows.setColor(st::windowShadowFg->c); } diff --git a/Telegram/SourceFiles/platform/win/window_title_win.cpp b/Telegram/SourceFiles/platform/win/window_title_win.cpp index 30f6d44a8b..497d1155fa 100644 --- a/Telegram/SourceFiles/platform/win/window_title_win.cpp +++ b/Telegram/SourceFiles/platform/win/window_title_win.cpp @@ -37,14 +37,17 @@ TitleWidget::TitleWidget(QWidget *parent) : Window::TitleWidget(parent) window()->setWindowState(Qt::WindowMinimized); _minimize->clearState(); }); + _minimize->setPointerCursor(false); _maximizeRestore->setClickedCallback([this]() { window()->setWindowState(_maximized ? Qt::WindowNoState : Qt::WindowMaximized); _maximizeRestore->clearState(); }); + _maximizeRestore->setPointerCursor(false); _close->setClickedCallback([this]() { window()->close(); _close->clearState(); }); + _close->setPointerCursor(false); setAttribute(Qt::WA_OpaquePaintEvent); resize(width(), st::titleHeight); diff --git a/Telegram/SourceFiles/profile/profile_common_groups_section.cpp b/Telegram/SourceFiles/profile/profile_common_groups_section.cpp index 3b58493978..30d6010083 100644 --- a/Telegram/SourceFiles/profile/profile_common_groups_section.cpp +++ b/Telegram/SourceFiles/profile/profile_common_groups_section.cpp @@ -238,6 +238,7 @@ void InnerWidget::paintRow(Painter &p, int index, TimeMs ms) { y += st::profileCommonGroupsPadding.top(); item->peer->paintUserpic(p, rtl() ? (width() - x - st::profileCommonGroupsPhotoSize) : x, y, st::profileCommonGroupsPhotoSize); + p.setPen(st::profileMemberNameFg); x += st::profileCommonGroupsPhotoSize + st::profileCommonGroupsNameLeft; y += st::profileCommonGroupsNameTop; auto nameWidth = _contentWidth - (x - _contentLeft) - st::profileCommonGroupsPadding.right(); diff --git a/Telegram/SourceFiles/profile/profile_cover.cpp b/Telegram/SourceFiles/profile/profile_cover.cpp index c4cfca6232..a6043ef670 100644 --- a/Telegram/SourceFiles/profile/profile_cover.cpp +++ b/Telegram/SourceFiles/profile/profile_cover.cpp @@ -69,7 +69,8 @@ CoverWidget::CoverWidget(QWidget *parent, PeerData *peer) : TWidget(parent) auto observeEvents = ButtonsUpdateFlags | UpdateFlag::NameChanged | UpdateFlag::UserOnlineChanged - | UpdateFlag::MembersChanged; + | UpdateFlag::MembersChanged + | UpdateFlag::PhotoChanged; subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { notifyPeerUpdated(update); })); @@ -90,7 +91,8 @@ CoverWidget::CoverWidget(QWidget *parent, PeerData *peer) : TWidget(parent) } PhotoData *CoverWidget::validatePhoto() const { - PhotoData *photo = (_peer->photoId && _peer->photoId != UnknownPeerPhotoId) ? App::photo(_peer->photoId) : nullptr; + auto photo = (_peer->photoId && _peer->photoId != UnknownPeerPhotoId) ? App::photo(_peer->photoId) : nullptr; + _userpicButton->setPointerCursor(photo != nullptr && photo->date != 0); if ((_peer->photoId == UnknownPeerPhotoId) || (_peer->photoId && (!photo || !photo->date))) { App::api()->requestFullPeer(_peer); return nullptr; @@ -343,6 +345,9 @@ void CoverWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { if (update.flags & UpdateFlag::NameChanged) { refreshNameText(); } + if (update.flags & UpdateFlag::PhotoChanged) { + validatePhoto(); + } if (update.flags & (UpdateFlag::UserOnlineChanged | UpdateFlag::MembersChanged)) { refreshStatusText(); } diff --git a/Telegram/SourceFiles/settings/settings_cover.cpp b/Telegram/SourceFiles/settings/settings_cover.cpp index 9be5fef378..d15f6fb185 100644 --- a/Telegram/SourceFiles/settings/settings_cover.cpp +++ b/Telegram/SourceFiles/settings/settings_cover.cpp @@ -54,7 +54,7 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent, connect(_editName, SIGNAL(clicked()), this, SLOT(onEditName())); connect(_editNameInline, SIGNAL(clicked()), this, SLOT(onEditName())); - auto observeEvents = Notify::PeerUpdate::Flag::NameChanged; + auto observeEvents = Notify::PeerUpdate::Flag::NameChanged | Notify::PeerUpdate::Flag::PhotoChanged; subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { notifyPeerUpdated(update); })); @@ -75,7 +75,8 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent, } PhotoData *CoverWidget::validatePhoto() const { - PhotoData *photo = (_self->photoId && _self->photoId != UnknownPeerPhotoId) ? App::photo(_self->photoId) : nullptr; + auto photo = (_self->photoId && _self->photoId != UnknownPeerPhotoId) ? App::photo(_self->photoId) : nullptr; + _userpicButton->setPointerCursor(photo != nullptr && photo->date != 0); if ((_self->photoId == UnknownPeerPhotoId) || (_self->photoId && (!photo || !photo->date))) { App::api()->requestFullPeer(_self); return nullptr; @@ -265,6 +266,9 @@ void CoverWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { if (update.flags & Notify::PeerUpdate::Flag::NameChanged) { refreshNameText(); } + if (update.flags & Notify::PeerUpdate::Flag::PhotoChanged) { + validatePhoto(); + } } void CoverWidget::refreshNameText() { diff --git a/Telegram/SourceFiles/stickers/emoji_pan.cpp b/Telegram/SourceFiles/stickers/emoji_pan.cpp index 4943761e49..1f9bde042f 100644 --- a/Telegram/SourceFiles/stickers/emoji_pan.cpp +++ b/Telegram/SourceFiles/stickers/emoji_pan.cpp @@ -2826,9 +2826,12 @@ void EmojiPan::paintEvent(QPaintEvent *e) { Painter p(this); auto ms = getms(); - auto showAnimating = _a_show.animating(ms); + + // This call can finish _a_show animation and destroy _showAnimation. auto opacityAnimating = _a_opacity.animating(ms); + auto switching = (_slideAnimation != nullptr); + auto showAnimating = _a_show.animating(ms); if (_showAnimation && !showAnimating) { _showAnimation.reset(); if (!switching && !opacityAnimating) { @@ -2837,6 +2840,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) { } if (showAnimating) { + t_assert(_showAnimation != nullptr); if (auto opacity = _a_opacity.current(_hiding ? 0. : 1.)) { _showAnimation->paintFrame(p, 0, 0, width(), _a_show.current(1.), opacity); } diff --git a/Telegram/SourceFiles/ui/abstract_button.cpp b/Telegram/SourceFiles/ui/abstract_button.cpp index ca61f508cb..6a6c6df05a 100644 --- a/Telegram/SourceFiles/ui/abstract_button.cpp +++ b/Telegram/SourceFiles/ui/abstract_button.cpp @@ -83,8 +83,14 @@ void AbstractButton::mouseReleaseEvent(QMouseEvent *e) { } } +void AbstractButton::setPointerCursor(bool enablePointerCursor) { + if (_enablePointerCursor != enablePointerCursor) { + _enablePointerCursor = enablePointerCursor; + updateCursor(); + } +} + void AbstractButton::setOver(bool over, StateChangeSource source) { - setCursor(over ? style::cur_pointer : style::cur_default); if (over && !(_state & StateFlag::Over)) { auto was = _state; _state |= StateFlag::Over; @@ -94,6 +100,12 @@ void AbstractButton::setOver(bool over, StateChangeSource source) { _state &= ~State(StateFlag::Over); onStateChanged(was, source); } + updateCursor(); +} + +void AbstractButton::updateCursor() { + auto pointerCursor = _enablePointerCursor && (_state & StateFlag::Over); + setCursor(pointerCursor ? style::cur_pointer : style::cur_default); } void AbstractButton::setDisabled(bool disabled) { diff --git a/Telegram/SourceFiles/ui/abstract_button.h b/Telegram/SourceFiles/ui/abstract_button.h index 24b8d20017..f539cc515e 100644 --- a/Telegram/SourceFiles/ui/abstract_button.h +++ b/Telegram/SourceFiles/ui/abstract_button.h @@ -48,6 +48,8 @@ public: return _state & StateFlag::Disabled; } + void setPointerCursor(bool enablePointerCursor); + void setAcceptBoth(bool acceptBoth = true); void setClickedCallback(base::lambda &&callback) { @@ -96,12 +98,14 @@ protected: } private: + void updateCursor(); void checkIfOver(QPoint localPos); State _state = StateFlag::None; bool _acceptBoth = false; Qt::KeyboardModifiers _modifiers; + bool _enablePointerCursor = true; base::lambda _clickedCallback; diff --git a/Telegram/SourceFiles/ui/animation.h b/Telegram/SourceFiles/ui/animation.h index dce5c34fba..93b53ff81d 100644 --- a/Telegram/SourceFiles/ui/animation.h +++ b/Telegram/SourceFiles/ui/animation.h @@ -452,23 +452,24 @@ class AnimationCallbacksRelative : public AnimationImplementation { public: typedef void (Type::*Method)(float64, bool); - AnimationCallbacksRelative(Type *obj, Method method) : _started(0), _obj(obj), _method(method) { + AnimationCallbacksRelative(Type *obj, Method method) : _obj(obj), _method(method) { } void start() { - _started = float64(getms()); + _started = getms(); } void step(BasicAnimation *a, TimeMs ms, bool timer) { - (_obj->*_method)(ms - _started, timer); + (_obj->*_method)(qMax(ms - _started, TimeMs(0)), timer); } private: - float64 _started; - Type *_obj; - Method _method; + TimeMs _started = 0; + Type *_obj = nullptr; + Method _method = nullptr; }; + template AnimationCallbacks animation(Type *obj, typename AnimationCallbacksRelative::Method method) { return AnimationCallbacks(new AnimationCallbacksRelative(obj, method)); @@ -487,10 +488,11 @@ public: } private: - Type *_obj; - Method _method; + Type *_obj = nullptr; + Method _method = nullptr; }; + template AnimationCallbacks animation(Type *obj, typename AnimationCallbacksAbsolute::Method method) { return AnimationCallbacks(new AnimationCallbacksAbsolute(obj, method)); @@ -501,24 +503,25 @@ class AnimationCallbacksRelativeWithParam : public AnimationImplementation { public: typedef void (Type::*Method)(Param, float64, bool); - AnimationCallbacksRelativeWithParam(Param param, Type *obj, Method method) : _started(0), _param(param), _obj(obj), _method(method) { + AnimationCallbacksRelativeWithParam(Param param, Type *obj, Method method) : _param(param), _obj(obj), _method(method) { } void start() { - _started = float64(getms()); + _started = getms(); } void step(BasicAnimation *a, TimeMs ms, bool timer) { - (_obj->*_method)(_param, ms - _started, timer); + (_obj->*_method)(_param, qMax(ms - _started, TimeMs(0)), timer); } private: - float64 _started; + TimeMs _started = 0; Param _param; - Type *_obj; - Method _method; + Type *_obj = nullptr; + Method _method = nullptr; }; + template AnimationCallbacks animation(Param param, Type *obj, typename AnimationCallbacksRelativeWithParam::Method method) { return AnimationCallbacks(new AnimationCallbacksRelativeWithParam(param, obj, method)); @@ -538,10 +541,11 @@ public: private: Param _param; - Type *_obj; - Method _method; + Type *_obj = nullptr; + Method _method = nullptr; }; + template AnimationCallbacks animation(Param param, Type *obj, typename AnimationCallbacksAbsoluteWithParam::Method method) { return AnimationCallbacks(new AnimationCallbacksAbsoluteWithParam(param, obj, method)); diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.cpp b/Telegram/SourceFiles/ui/widgets/input_fields.cpp index 03106237c2..94522faf48 100644 --- a/Telegram/SourceFiles/ui/widgets/input_fields.cpp +++ b/Telegram/SourceFiles/ui/widgets/input_fields.cpp @@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "ui/widgets/popup_menu.h" #include "mainwindow.h" #include "ui/countryinput.h" +#include "window/window_theme.h" #include "lang.h" #include "numbers.h" @@ -145,9 +146,12 @@ FlatTextarea::FlatTextarea(QWidget *parent, const style::FlatTextarea &st, const setPlaceholder(pholder); - QPalette p(palette()); - p.setColor(QPalette::Text, _st.textColor->c); - setPalette(p); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { + if (update.paletteChanged()) { + updatePalette(); + } + }); + updatePalette(); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -179,6 +183,12 @@ FlatTextarea::FlatTextarea(QWidget *parent, const style::FlatTextarea &st, const } } +void FlatTextarea::updatePalette() { + auto p = palette(); + p.setColor(QPalette::Text, _st.textColor->c); + setPalette(p); +} + TextWithTags FlatTextarea::getTextWithTagsPart(int start, int end) { TextWithTags result; result.text = getTextPart(start, end, &result.tags); @@ -1457,9 +1467,12 @@ FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, const QString setFont(_st.font->f); setAlignment(_st.align); - QPalette p(palette()); - p.setColor(QPalette::Text, _st.textColor->c); - setPalette(p); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { + if (update.paletteChanged()) { + updatePalette(); + } + }); + updatePalette(); connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChange(const QString &))); connect(this, SIGNAL(textEdited(const QString &)), this, SLOT(onTextEdited())); @@ -1474,6 +1487,12 @@ FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, const QString connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer())); } +void FlatInput::updatePalette() { + auto p = palette(); + p.setColor(QPalette::Text, _st.textColor->c); + setPalette(p); +} + void FlatInput::customUpDown(bool custom) { _customUpDown = custom; } @@ -1699,9 +1718,12 @@ InputArea::InputArea(QWidget *parent, const style::InputField &st, const QString createPlaceholderPath(); - QPalette p(palette()); - p.setColor(QPalette::Text, _st.textFg->c); - setPalette(p); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { + if (update.paletteChanged()) { + updatePalette(); + } + }); + updatePalette(); _inner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _inner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -1736,6 +1758,12 @@ InputArea::InputArea(QWidget *parent, const style::InputField &st, const QString finishAnimations(); } +void InputArea::updatePalette() { + auto p = palette(); + p.setColor(QPalette::Text, _st.textFg->c); + setPalette(p); +} + void InputArea::onTouchTimer() { _touchRightButton = true; } @@ -2443,9 +2471,12 @@ InputField::InputField(QWidget *parent, const style::InputField &st, const QStri createPlaceholderPath(); - QPalette p(palette()); - p.setColor(QPalette::Text, _st.textFg->c); - setPalette(p); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { + if (update.paletteChanged()) { + updatePalette(); + } + }); + updatePalette(); _inner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _inner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -2478,6 +2509,12 @@ InputField::InputField(QWidget *parent, const style::InputField &st, const QStri finishAnimations(); } +void InputField::updatePalette() { + auto p = palette(); + p.setColor(QPalette::Text, _st.textFg->c); + setPalette(p); +} + void InputField::onTouchTimer() { _touchRightButton = true; } @@ -3184,9 +3221,12 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st, setFont(_st.font); setAlignment(_st.textAlign); - QPalette p(palette()); - p.setColor(QPalette::Text, _st.textFg->c); - setPalette(p); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { + if (update.paletteChanged()) { + updatePalette(); + } + }); + updatePalette(); createPlaceholderPath(); @@ -3213,6 +3253,12 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st, finishAnimations(); } +void MaskedInputField::updatePalette() { + auto p = palette(); + p.setColor(QPalette::Text, _st.textFg->c); + setPalette(p); +} + void MaskedInputField::setCorrectedText(QString &now, int &nowCursor, const QString &newText, int newPos) { if (newPos < 0 || newPos > newText.size()) { newPos = newText.size(); diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.h b/Telegram/SourceFiles/ui/widgets/input_fields.h index 9470d9407c..47ebb77775 100644 --- a/Telegram/SourceFiles/ui/widgets/input_fields.h +++ b/Telegram/SourceFiles/ui/widgets/input_fields.h @@ -28,7 +28,7 @@ namespace Ui { static UserData * const LookingUpInlineBot = SharedMemoryLocation(); -class FlatTextarea : public QTextEdit { +class FlatTextarea : public QTextEdit, private base::Subscriber { Q_OBJECT T_WIDGET @@ -163,6 +163,8 @@ protected: void checkContentHeight(); private: + void updatePalette(); + // "start" and "end" are in coordinates of text where emoji are replaced // by ObjectReplacementCharacter. If "end" = -1 means get text till the end. QString getTextPart(int start, int end, TagList *outTagsList, bool *outTagsChanged = nullptr) const; @@ -240,7 +242,7 @@ inline bool operator!=(const FlatTextarea::LinkRange &a, const FlatTextarea::Lin return !(a == b); } -class FlatInput : public QLineEdit { +class FlatInput : public QLineEdit, private base::Subscriber { Q_OBJECT T_WIDGET @@ -304,6 +306,7 @@ protected: void phPrepare(Painter &p, float64 placeholderFocused); private: + void updatePalette(); void updatePlaceholderText(); QString _oldtext, _ph, _fullph; @@ -327,7 +330,7 @@ enum class CtrlEnterSubmit { Both, }; -class InputArea : public TWidget { +class InputArea : public TWidget, private base::Subscriber { Q_OBJECT public: @@ -450,6 +453,8 @@ private: }; friend class Inner; + void updatePalette(); + bool heightAutoupdated(); void checkContentHeight(); void createPlaceholderPath(); @@ -503,7 +508,7 @@ private: }; -class InputField : public TWidget { +class InputField : public TWidget, private base::Subscriber { Q_OBJECT public: @@ -636,6 +641,8 @@ private: }; friend class Inner; + void updatePalette(); + void createPlaceholderPath(); void setErrorShown(bool error); @@ -685,7 +692,7 @@ private: bool _correcting = false; }; -class MaskedInputField : public QLineEdit { +class MaskedInputField : public QLineEdit, private base::Subscriber { Q_OBJECT T_WIDGET @@ -778,6 +785,7 @@ protected: const style::InputField &_st; private: + void updatePalette(); void createPlaceholderPath(); void setErrorShown(bool error); diff --git a/Telegram/SourceFiles/ui/widgets/scroll_area.cpp b/Telegram/SourceFiles/ui/widgets/scroll_area.cpp index c14da76965..c80f5ba480 100644 --- a/Telegram/SourceFiles/ui/widgets/scroll_area.cpp +++ b/Telegram/SourceFiles/ui/widgets/scroll_area.cpp @@ -27,11 +27,13 @@ namespace Ui { ScrollShadow::ScrollShadow(ScrollArea *parent, const style::ScrollArea *st) : QWidget(parent), _st(st) { setVisible(false); + t_assert(_st != nullptr); + t_assert(_st->shColor.v() != nullptr); } void ScrollShadow::paintEvent(QPaintEvent *e) { - QPainter p(this); - p.fillRect(rect(), _st->shColor->b); + Painter p(this); + p.fillRect(rect(), _st->shColor); } void ScrollShadow::changeVisibility(bool shown) { diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 3d4a00ee84..769b1d2aa9 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -32,12 +32,12 @@ MainWindow::MainWindow() : QWidget() , _positionUpdatedTimer(this) , _body(this) , _titleText(qsl("Telegram")) { - using Update = Theme::BackgroundUpdate; - subscribe(Theme::Background(), [this](const Update &data) { + subscribe(Theme::Background(), [this](const Theme::BackgroundUpdate &data) { if (data.paletteChanged()) { if (_title) { _title->update(); } + updatePalette(); } }); subscribe(Global::RefUnreadCounterUpdate(), [this] { updateUnreadCounter(); }); @@ -49,9 +49,7 @@ void MainWindow::init() { _positionUpdatedTimer->setSingleShot(true); connect(_positionUpdatedTimer, SIGNAL(timeout()), this, SLOT(savePositionByTimer())); - auto p = palette(); - p.setColor(QPalette::Window, st::windowBg->c); - setPalette(p); + updatePalette(); if ((_title = Platform::CreateTitleWidget(this))) { _title->init(); @@ -61,6 +59,12 @@ void MainWindow::init() { updateUnreadCounter(); } +void MainWindow::updatePalette() { + auto p = palette(); + p.setColor(QPalette::Window, st::windowBg->c); + setPalette(p); +} + HitTestResult MainWindow::hitTest(const QPoint &p) const { auto titleResult = _title ? _title->hitTest(p - _title->geometry().topLeft()) : Window::HitTestResult::None; if (titleResult != Window::HitTestResult::None) { diff --git a/Telegram/SourceFiles/window/main_window.h b/Telegram/SourceFiles/window/main_window.h index 306881e579..50325b5165 100644 --- a/Telegram/SourceFiles/window/main_window.h +++ b/Telegram/SourceFiles/window/main_window.h @@ -82,6 +82,7 @@ private slots: } private: + void updatePalette(); void updateControlsGeometry(); void updateUnreadCounter(); void initSize(); diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index b83406a618..d7c0dae445 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "ui/widgets/buttons.h" #include "ui/widgets/input_fields.h" #include "dialogs/dialogs_layout.h" +#include "window/window_theme.h" #include "styles/style_dialogs.h" #include "styles/style_boxes.h" #include "styles/style_window.h" @@ -505,6 +506,19 @@ Notification::Notification(History *history, PeerData *peer, PeerData *author, H prepareActionsCache(); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &data) { + if (data.paletteChanged()) { + updateNotifyDisplay(); + if (!_buttonsCache.isNull()) { + prepareActionsCache(); + } + update(); + if (_background) { + _background->update(); + } + } + }); + show(); } @@ -851,6 +865,12 @@ HideAllButton::HideAllButton(QPoint startPosition, int shift, Direction shiftDir hide(); createWinId(); + subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &data) { + if (data.paletteChanged()) { + update(); + } + }); + show(); } diff --git a/Telegram/SourceFiles/window/notifications_manager_default.h b/Telegram/SourceFiles/window/notifications_manager_default.h index c99451c179..ef284bc6f3 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.h +++ b/Telegram/SourceFiles/window/notifications_manager_default.h @@ -120,7 +120,7 @@ private: namespace internal { -class Widget : public TWidget { +class Widget : public TWidget, protected base::Subscriber { public: enum class Direction { Up, diff --git a/Telegram/SourceFiles/window/top_bar_widget.cpp b/Telegram/SourceFiles/window/top_bar_widget.cpp index 6d8bce51f5..10ec52b70e 100644 --- a/Telegram/SourceFiles/window/top_bar_widget.cpp +++ b/Telegram/SourceFiles/window/top_bar_widget.cpp @@ -83,7 +83,7 @@ void TopBarWidget::onForwardSelection() { } void TopBarWidget::onDeleteSelection() { - if (App::main()) App::main()->deleteSelectedItems(); + if (App::main()) App::main()->confirmDeleteSelectedItems(); } void TopBarWidget::onClearSelection() { diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index 42dec52e03..94f8171bc3 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -80,7 +80,9 @@ void MainMenu::checkSelf() { if (auto self = App::self()) { _userpicButton.create(this, self, st::mainMenuUserpicSize); _userpicButton->setClickedCallback([] { - App::wnd()->showSettings(); + if (auto self = App::self()) { + Ui::showPeerHistory(App::history(self), ShowAtUnreadMsgId); + } }); _userpicButton->show(); updateControlsGeometry(); diff --git a/Telegram/build/version b/Telegram/build/version index d9c4aadb63..8c9c04ee47 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 10021 +AppVersion 10022 AppVersionStrMajor 0.10 -AppVersionStrSmall 0.10.21 -AppVersionStr 0.10.21 +AppVersionStrSmall 0.10.22 +AppVersionStr 0.10.22 AlphaChannel 1 BetaVersion 0