[Option][GUI] Confirm before calls
This commit is contained in:
parent
e057642851
commit
c7cfe23892
7 changed files with 67 additions and 4 deletions
|
|
@ -63,6 +63,9 @@
|
||||||
"ktg_profile_supergroup_id": "Supergroup ID",
|
"ktg_profile_supergroup_id": "Supergroup ID",
|
||||||
"ktg_profile_channel_id": "Channel ID",
|
"ktg_profile_channel_id": "Channel ID",
|
||||||
"ktg_settings_show_phone_number": "Show phone in drawer",
|
"ktg_settings_show_phone_number": "Show phone in drawer",
|
||||||
|
"ktg_settings_call_confirm": "Confirm before calling",
|
||||||
|
"ktg_call_sure": "Are you sure you want to call this user?",
|
||||||
|
"ktg_call_button": "Call",
|
||||||
"ktg_settings_adaptive_bubbles": "Adaptive bubbles",
|
"ktg_settings_adaptive_bubbles": "Adaptive bubbles",
|
||||||
"ktg_settings_filters": "Folders",
|
"ktg_settings_filters": "Folders",
|
||||||
"ktg_settings_messages": "Messages",
|
"ktg_settings_messages": "Messages",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "calls/calls_box_controller.h"
|
#include "calls/calls_box_controller.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
|
|
@ -388,7 +391,18 @@ void BoxController::rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||||
auto user = row->peer()->asUser();
|
auto user = row->peer()->asUser();
|
||||||
Assert(user != nullptr);
|
Assert(user != nullptr);
|
||||||
|
|
||||||
Core::App().calls().startOutgoingCall(user, false);
|
if (::Kotato::JsonSettings::GetBool("confirm_before_calls")) {
|
||||||
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
|
.text = ktr("ktg_call_sure"),
|
||||||
|
.confirmed = [=] {
|
||||||
|
Ui::hideLayer();
|
||||||
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
|
},
|
||||||
|
.confirmText = ktr("ktg_call_button"),
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoxController::receivedCalls(const QVector<MTPMessage> &result) {
|
void BoxController::receivedCalls(const QVector<MTPMessage> &result) {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <rpl/combine.h>
|
#include <rpl/combine.h>
|
||||||
#include <rpl/combine_previous.h>
|
#include <rpl/combine_previous.h>
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/view/history_view_send_action.h"
|
#include "history/view/history_view_send_action.h"
|
||||||
#include "boxes/add_contact_box.h"
|
#include "boxes/add_contact_box.h"
|
||||||
|
|
@ -234,7 +236,18 @@ void TopBarWidget::refreshLang() {
|
||||||
void TopBarWidget::call() {
|
void TopBarWidget::call() {
|
||||||
if (const auto peer = _activeChat.key.peer()) {
|
if (const auto peer = _activeChat.key.peer()) {
|
||||||
if (const auto user = peer->asUser()) {
|
if (const auto user = peer->asUser()) {
|
||||||
Core::App().calls().startOutgoingCall(user, false);
|
if (::Kotato::JsonSettings::GetBool("confirm_before_calls")) {
|
||||||
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
|
.text = ktr("ktg_call_sure"),
|
||||||
|
.confirmed = [=] {
|
||||||
|
Ui::hideLayer();
|
||||||
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
|
},
|
||||||
|
.confirmText = ktr("ktg_call_button"),
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "history/view/media/history_view_call.h"
|
#include "history/view/media/history_view_call.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
|
#include "boxes/abstract_box.h" // Ui::hideLayer().
|
||||||
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
#include "ui/text/format_values.h"
|
#include "ui/text/format_values.h"
|
||||||
|
|
@ -61,7 +65,18 @@ QSize Call::countOptimalSize() {
|
||||||
const auto video = _video;
|
const auto video = _video;
|
||||||
_link = std::make_shared<LambdaClickHandler>([=] {
|
_link = std::make_shared<LambdaClickHandler>([=] {
|
||||||
if (user) {
|
if (user) {
|
||||||
Core::App().calls().startOutgoingCall(user, video);
|
if (::Kotato::JsonSettings::GetBool("confirm_before_calls")) {
|
||||||
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
|
.text = ktr("ktg_call_sure"),
|
||||||
|
.confirmed = [=] {
|
||||||
|
Ui::hideLayer();
|
||||||
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
|
},
|
||||||
|
.confirmText = ktr("ktg_call_button"),
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
Core::App().calls().startOutgoingCall(user, video);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "info/info_wrap_widget.h"
|
#include "info/info_wrap_widget.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "kotato/kotato_settings_menu.h"
|
#include "kotato/kotato_settings_menu.h"
|
||||||
#include "info/profile/info_profile_widget.h"
|
#include "info/profile/info_profile_widget.h"
|
||||||
#include "info/profile/info_profile_values.h"
|
#include "info/profile/info_profile_values.h"
|
||||||
|
|
@ -511,7 +513,18 @@ void WrapWidget::addProfileCallsButton() {
|
||||||
? st::infoLayerTopBarCall
|
? st::infoLayerTopBarCall
|
||||||
: st::infoTopBarCall))
|
: st::infoTopBarCall))
|
||||||
)->addClickHandler([=] {
|
)->addClickHandler([=] {
|
||||||
Core::App().calls().startOutgoingCall(user, false);
|
if (::Kotato::JsonSettings::GetBool("confirm_before_calls")) {
|
||||||
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
|
.text = ktr("ktg_call_sure"),
|
||||||
|
.confirmed = [=] {
|
||||||
|
Ui::hideLayer();
|
||||||
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
|
},
|
||||||
|
.confirmText = ktr("ktg_call_button"),
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
Core::App().calls().startOutgoingCall(user, false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, _topBar->lifetime());
|
}, _topBar->lifetime());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -349,6 +349,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||||
{ "replaces", {
|
{ "replaces", {
|
||||||
.type = SettingType::QJsonArraySetting,
|
.type = SettingType::QJsonArraySetting,
|
||||||
.limitHandler = ReplacesLimit(), }},
|
.limitHandler = ReplacesLimit(), }},
|
||||||
|
{ "confirm_before_calls", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = true, }},
|
||||||
};
|
};
|
||||||
|
|
||||||
using OldOptionKey = QString;
|
using OldOptionKey = QString;
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,8 @@ void SetupKotatoOther(
|
||||||
::Kotato::JsonSettings::Write();
|
::Kotato::JsonSettings::Write();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
SettingsMenuJsonSwitch(ktg_settings_call_confirm, confirm_before_calls);
|
||||||
}
|
}
|
||||||
|
|
||||||
Kotato::Kotato(
|
Kotato::Kotato(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue