void PhoneWidget::toSignUp() { hideError(); // Hide error, but leave the signup label visible. _checkRequest->start(1000); _sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(0), MTP_string(_sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail)); }
void PhoneWidget::hidePhoneError() { hideError(); if (_signup) { _signup->hide(anim::type::instant); showDescription(); } }
void PhoneWidget::hidePhoneError() { hideError(); if (_signup) { _signup->hideAnimated(); showDescription(); } }
void SettingsDialog::showEvent(QShowEvent *event) { QStringList dirs = _settingsmanager->readSetting(SETTING_PATHS).toStringList(); // create lineEdits for every path amountPaths = 0; for (int i = 0; i < dirs.size(); i++) { addPathEdit(dirs.at(i)); } ui->durationSpinBox->setValue(_settingsmanager->readSetting(SETTING_SPEED).toInt()); QString settingClick = _settingsmanager->readSetting(SETTING_ON_CLICK_ACTION).toString(); ui->radioNothing->setChecked(settingClick == SETTING_ON_CLICK_ACTION_NOTHING); ui->radioOpenFolder->setChecked(settingClick == SETTING_ON_CLICK_ACTION_OPEN_FOLDER); ui->radioPause->setChecked(settingClick == SETTING_ON_CLICK_ACTION_PAUSE); ui->radiosave->setChecked(_settingsmanager->readSetting(SETTING_SAVE_ORIENTATION).toBool()); ui->radiodontsave->setChecked(!_settingsmanager->readSetting(SETTING_SAVE_ORIENTATION).toBool()); createLanguageMenu(); hideError(); ui->buttonBox->setFocus(); ui->saveGroupBox->setVisible(false); QDialog::showEvent(event); }
void ChangePhoneBox::EnterCode::prepare() { setTitle(langFactory(lng_change_phone_title)); auto descriptionText = lng_change_phone_code_description(lt_phone, textcmdStartSemibold() + App::formatPhone(_phone) + textcmdStopSemibold()); auto description = object_ptr<Ui::FlatLabel>(this, descriptionText, Ui::FlatLabel::InitType::Rich, st::changePhoneLabel); description->moveToLeft(st::boxPadding.left(), 0); auto phoneValue = QString(); _code.create(this, st::defaultInputField, langFactory(lng_change_phone_code_title), phoneValue); _code->setAutoSubmit(_codeLength, [=] { submit(); }); _code->setChangedCallback([=] { hideError(); }); _code->resize(st::boxWidth - 2 * st::boxPadding.left(), _code->height()); _code->moveToLeft(st::boxPadding.left(), description->bottomNoMargins()); connect(_code, &Ui::InputField::submitted, [=] { submit(); }); setDimensions(st::boxWidth, countHeight()); if (_callTimeout > 0) { _call.setStatus({ SentCodeCall::State::Waiting, _callTimeout }); updateCall(); } addButton(langFactory(lng_change_phone_new_submit), [=] { submit(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); }); }
void HotkeyWidget::showError() { if (mShowingError) { return; } mShowingError = true; setStyleSheet(mDefaultStyleSheet + "color: #d90000;"); QTimer::singleShot(1000, this, SLOT(hideError())); }
void SettingsDialog::onBrowseButtonClicked(QLineEdit *lineEdit) { QString previous_dir = lineEdit->text(); if (!QDir(previous_dir).exists()) { previous_dir = QDir::homePath(); } QString dir = QFileDialog::getExistingDirectory(this, tr("Pick a folder"), previous_dir); if (!dir.isEmpty()) { lineEdit->setText(dir); lineEdit->setToolTip(dir); hideError(); } }
void ChangePhoneBox::EnterPhone::submit() { if (_requestId) { return; } hideError(); auto phoneNumber = _phone->getLastText().trimmed(); _requestId = MTP::send(MTPaccount_SendChangePhoneCode(MTP_flags(0), MTP_string(phoneNumber), MTP_bool(false)), rpcDone(crl::guard(this, [this, phoneNumber](const MTPauth_SentCode &result) { return sendPhoneDone(phoneNumber, result); })), rpcFail(crl::guard(this, [this, phoneNumber](const RPCError &error) { return sendPhoneFail(phoneNumber, error); }))); }
void ChangePhoneBox::EnterCode::submit() { if (_requestId) { return; } hideError(); const auto code = _code->getDigitsOnly(); _requestId = MTP::send(MTPaccount_ChangePhone( MTP_string(_phone), MTP_string(_hash), MTP_string(code) ), rpcDone([weak = make_weak(this)](const MTPUser &result) { App::feedUser(result); if (weak) { Ui::hideLayer(); } Ui::Toast::Show(lang(lng_change_phone_success)); }), rpcFail(crl::guard(this, [this](const RPCError &error) { return sendCodeFail(error); }))); }
void CodeWidget::submit() { const auto text = QString( _code->getLastText() ).remove( QRegularExpression("[^\\d]") ).mid(0, getData()->codeLength); if (_sentRequest || _sentCode == text || text.size() != getData()->codeLength) { return; } hideError(); _checkRequest->start(1000); _sentCode = text; getData()->pwdRequest = Core::CloudPasswordCheckRequest(); getData()->hasRecovery = false; getData()->pwdHint = QString(); getData()->pwdNotEmptyPassport = false; _sentRequest = MTP::send(MTPauth_SignIn(MTP_string(getData()->phone), MTP_bytes(getData()->phoneHash), MTP_string(_sentCode)), rpcDone(&CodeWidget::codeSubmitDone), rpcFail(&CodeWidget::codeSubmitFail)); }
void CodeWidget::onInputChange() { hideError(); submit(); }