9#include "businesseditorwidget.h"
12#include <KLocalizedString>
16#include "../widgets/imagewidget.h"
17#include "freebusyeditwidget.h"
19#include <KContacts/Addressee>
23BusinessEditorWidget::BusinessEditorWidget(
QWidget *parent)
25 , mOrganizationWidget(new
KLineEdit(this))
32 , mFreeBusyWidget(new
Akonadi::FreeBusyEditWidget(this))
33 , mLogoWidget(new ImageWidget(ImageWidget::Logo, this))
42 logoLayout->addStretch(0);
47 auto label =
new QLabel(
i18nc(
"@label The organization of a contact",
"Organization:"),
this);
48 generalLayout->addWidget(label, 0, 0);
50 mOrganizationWidget->setTrapReturnKey(
true);
51 mOrganizationWidget->setPlaceholderText(
i18nc(
"@info:placeholder",
"Add organization's name"));
52 label->setBuddy(mOrganizationWidget);
53 generalLayout->addWidget(mOrganizationWidget, 1, 0);
55 label =
new QLabel(
i18nc(
"@label The profession of a contact",
"Profession:"),
this);
56 generalLayout->addWidget(label, 0, 1);
58 mProfessionWidget->setPlaceholderText(
i18nc(
"@info:placeholder",
"Add profession"));
59 mProfessionWidget->setTrapReturnKey(
true);
60 label->setBuddy(mProfessionWidget);
61 generalLayout->addWidget(mProfessionWidget, 1, 1);
64 generalLayout->addWidget(label, 3, 0);
66 mTitleWidget->setPlaceholderText(
i18nc(
"@info:placeholder",
"Add the title"));
67 mTitleWidget->setTrapReturnKey(
true);
68 label->setBuddy(mTitleWidget);
69 generalLayout->addWidget(mTitleWidget, 4, 0);
71 label =
new QLabel(
i18nc(
"@label The department of a contact",
"Department:"),
this);
72 generalLayout->addWidget(label, 3, 1);
74 mDepartmentWidget->setPlaceholderText(
i18nc(
"@info:placeholder",
"Add the department"));
75 mDepartmentWidget->setTrapReturnKey(
true);
76 label->setBuddy(mDepartmentWidget);
77 generalLayout->addWidget(mDepartmentWidget, 4, 1);
79 label =
new QLabel(
i18nc(
"@label The office of a contact",
"Office:"),
this);
80 generalLayout->addWidget(label, 5, 0);
82 mOfficeWidget->setTrapReturnKey(
true);
83 mOfficeWidget->setPlaceholderText(
i18nc(
"@info:placeholder",
"Add the office"));
85 label->setBuddy(mOfficeWidget);
86 generalLayout->addWidget(mOfficeWidget, 6, 0);
88 label =
new QLabel(
i18nc(
"@label The manager's name of a contact",
"Manager's name:"),
this);
89 generalLayout->addWidget(label, 5, 1);
91 mManagerWidget->setPlaceholderText(
i18nc(
"@info:placeholder",
"Add manager's name"));
92 mManagerWidget->setTrapReturnKey(
true);
93 label->setBuddy(mManagerWidget);
94 generalLayout->addWidget(mManagerWidget, 6, 1);
96 label =
new QLabel(
i18nc(
"@label The assistant's name of a contact",
"Assistant's name:"),
this);
97 generalLayout->addWidget(label, 7, 0);
99 mAssistantWidget->setPlaceholderText(
i18nc(
"@info:placeholder",
"Add assistant's name"));
100 mAssistantWidget->setTrapReturnKey(
true);
101 label->setBuddy(mAssistantWidget);
102 generalLayout->addWidget(mAssistantWidget, 8, 0);
105 label =
new QLabel(
i18nc(
"@label The free/busy information of a contact",
"Free/Busy:"));
106 generalLayout->addWidget(label, 7, 1);
108 label->setBuddy(mFreeBusyWidget);
109 generalLayout->addWidget(mFreeBusyWidget, 8, 1);
110 generalLayout->setRowStretch(9, 1);
114BusinessEditorWidget::~BusinessEditorWidget() =
default;
118 mLogoWidget->loadContact(contact);
128 mFreeBusyWidget->loadContact(contact);
134 mLogoWidget->storeContact(contact);
144 mFreeBusyWidget->storeContact(contact);
147void BusinessEditorWidget::setReadOnly(
bool readOnly)
149 mLogoWidget->setReadOnly(readOnly);
159 mFreeBusyWidget->setReadOnly(readOnly);
162#include "moc_businesseditorwidget.cpp"
virtual void setReadOnly(bool)
virtual void setText(const QString &)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
A widget for editing the display name of a contact.
QString label(StandardShortcut id)
void addLayout(QLayout *layout, int stretch)
void addLayout(QLayout *layout, int row, int column, Qt::Alignment alignment)
void textChanged(const QString &text)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)