Commit 4cc49b4d authored by Laurent Montel's avatar Laurent Montel 😁

Use setReadOnly here too

parent 732aefbf
......@@ -60,5 +60,5 @@ void MailListWidget::storeContact(KContacts::Addressee &contact) const
void MailListWidget::setReadOnly(bool readOnly)
{
mMailWidgetLister->setEnabled(!readOnly);
mMailWidgetLister->setReadOnly(readOnly);
}
......@@ -136,6 +136,14 @@ void MailWidget::setPreferred(bool b)
mMailEdit->setPreferred(b);
}
void MailWidget::setReadOnly(bool readOnly)
{
mMailEdit->setReadOnly(readOnly);
mMailType->setEnabled(!readOnly);
mAddButton->setEnabled(!readOnly);
mRemoveButton->setEnabled(!readOnly);
}
void MailWidget::slotAddMail()
{
Q_EMIT addWidget(this);
......
......@@ -42,6 +42,7 @@ public:
void setMail(const KContacts::Email &email);
KContacts::Email email();
void setPreferred(bool b);
void setReadOnly(bool readOnly);
Q_SIGNALS:
void addWidget(MailWidget *);
void removeWidget(MailWidget *);
......
......@@ -69,6 +69,15 @@ void MailWidgetLister::storeContact(KContacts::Addressee &contact) const
contact.setEmailList(emailList);
}
void MailWidgetLister::setReadOnly(bool readOnly)
{
const QList<QWidget *> widgetList = widgets();
for (QWidget *widget : widgetList) {
MailWidget *w = qobject_cast<MailWidget *>(widget);
w->setReadOnly(readOnly);
}
}
QWidget *MailWidgetLister::createWidget(QWidget *parent)
{
MailWidget *w = new MailWidget(parent);
......
......@@ -38,6 +38,7 @@ public:
void loadContact(const KContacts::Addressee &contact);
void storeContact(KContacts::Addressee &contact) const;
void setReadOnly(bool readOnly);
protected:
QWidget *createWidget(QWidget *) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment