mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
half of all boxes redesigned
This commit is contained in:
@@ -30,11 +30,11 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
||||
CodeInput::CodeInput(QWidget *parent, const style::flatInput &st, const QString &ph) : FlatInput(parent, st, ph) {
|
||||
}
|
||||
|
||||
void CodeInput::correctValue(QKeyEvent *e, const QString &was) {
|
||||
QString oldText(text()), newText;
|
||||
int oldPos(cursorPosition()), newPos(-1), oldLen(oldText.length()), digitCount = 0;
|
||||
void CodeInput::correctValue(const QString &was, QString &now) {
|
||||
QString newText;
|
||||
int oldPos(cursorPosition()), newPos(-1), oldLen(now.length()), digitCount = 0;
|
||||
for (int i = 0; i < oldLen; ++i) {
|
||||
if (oldText[i].isDigit()) {
|
||||
if (now[i].isDigit()) {
|
||||
++digitCount;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void CodeInput::correctValue(QKeyEvent *e, const QString &was) {
|
||||
|
||||
newText.reserve(oldLen);
|
||||
for (int i = 0; i < oldLen; ++i) {
|
||||
QChar ch(oldText[i]);
|
||||
QChar ch(now[i]);
|
||||
if (ch.isDigit()) {
|
||||
if (!digitCount--) {
|
||||
break;
|
||||
@@ -60,8 +60,10 @@ void CodeInput::correctValue(QKeyEvent *e, const QString &was) {
|
||||
if (newPos < 0) {
|
||||
newPos = newText.length();
|
||||
}
|
||||
if (newText != oldText) {
|
||||
setText(newText);
|
||||
if (newText != now) {
|
||||
now = newText;
|
||||
setText(now);
|
||||
updatePlaceholder();
|
||||
if (newPos != oldPos) {
|
||||
setCursorPosition(newPos);
|
||||
}
|
||||
@@ -262,7 +264,7 @@ bool IntroCode::codeSubmitFail(const RPCError &error) {
|
||||
checkRequest.start(1000);
|
||||
sentRequest = MTP::send(MTPaccount_GetPassword(), rpcDone(&IntroCode::gotPassword), rpcFail(&IntroCode::codeSubmitFail));
|
||||
return true;
|
||||
} else if (error.type().startsWith(qsl("FLOOD_WAIT_"))) {
|
||||
} else if (mtpIsFlood(error)) {
|
||||
showError(lang(lng_flood_error));
|
||||
code.setFocus();
|
||||
return true;
|
||||
@@ -342,7 +344,7 @@ void IntroCode::noTelegramCodeDone(const MTPBool &result) {
|
||||
}
|
||||
|
||||
bool IntroCode::noTelegramCodeFail(const RPCError &error) {
|
||||
if (error.type().startsWith(qsl("FLOOD_WAIT_"))) {
|
||||
if (mtpIsFlood(error)) {
|
||||
showError(lang(lng_flood_error));
|
||||
code.setFocus();
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user