Set better focus in "Write new email message" window when writing new message or replying to one.

This commit is contained in:
Martin Rotter 2020-08-11 11:21:07 +02:00
parent 0351a988a7
commit 203cce77c3
3 changed files with 9 additions and 3 deletions

View File

@ -23,9 +23,12 @@ EmailRecipientControl::EmailRecipientControl(const QString& recipient, QWidget*
m_cmbRecipientType->setFocusPolicy(Qt::FocusPolicy::NoFocus);
m_btnCloseMe->setFocusPolicy(Qt::FocusPolicy::NoFocus);
m_txtRecipient->setFocusPolicy(Qt::FocusPolicy::StrongFocus);
m_txtRecipient->setPlaceholderText(tr("E-mail address"));
m_txtRecipient->setText(recipient);
setFocusProxy(m_txtRecipient);
m_btnCloseMe->setToolTip("Remove this recipient.");
m_btnCloseMe->setIcon(qApp->icons()->fromTheme(QSL("list-remove")));

View File

@ -49,7 +49,7 @@ FormAddEditEmail::FormAddEditEmail(GmailServiceRoot* root, QWidget* parent)
}
void FormAddEditEmail::execForAdd() {
addRecipientRow();
addRecipientRow()->setFocus();
exec();
}
@ -58,6 +58,7 @@ void FormAddEditEmail::execForReply(Message* original_message) {
addRecipientRow(m_originalMessage->m_author);
m_ui.m_txtSubject->setText(QSL("Re: %1").arg(m_originalMessage->m_title));
m_ui.m_txtMessage->setFocus();
exec();
}
@ -137,13 +138,15 @@ void FormAddEditEmail::onOkClicked() {
}
}
void FormAddEditEmail::addRecipientRow(const QString& recipient) {
EmailRecipientControl* FormAddEditEmail::addRecipientRow(const QString& recipient) {
auto* mail_rec = new EmailRecipientControl(recipient, this);
connect(mail_rec, &EmailRecipientControl::removalRequested, this, &FormAddEditEmail::removeRecipientRow);
mail_rec->setPossibleRecipients(m_possibleRecipients);
m_ui.m_layout->insertRow(m_ui.m_layout->count() - 5, mail_rec);
return mail_rec;
}
QList<EmailRecipientControl*> FormAddEditEmail::recipientControls() const {

View File

@ -28,7 +28,7 @@ class FormAddEditEmail : public QDialog {
private slots:
void removeRecipientRow();
void onOkClicked();
void addRecipientRow(const QString& recipient = QString());
EmailRecipientControl* addRecipientRow(const QString& recipient = QString());
private:
QList<EmailRecipientControl*> recipientControls() const;